mirror of
https://github.com/Instadapp/fluid-contracts-public.git
synced 2024-07-29 21:57:37 +00:00
d7a58e88ff
ARB: deploy protocols
409 lines
194 KiB
JSON
409 lines
194 KiB
JSON
{
|
|
"address": "0xbd6C8ee7CB9a13333e043C4d5fCf3ac125f7f890",
|
|
"abi": [
|
|
{
|
|
"inputs": [],
|
|
"stateMutability": "nonpayable",
|
|
"type": "constructor"
|
|
},
|
|
{
|
|
"inputs": [
|
|
{
|
|
"internalType": "uint256",
|
|
"name": "colLiquidated",
|
|
"type": "uint256"
|
|
},
|
|
{
|
|
"internalType": "uint256",
|
|
"name": "debtLiquidated",
|
|
"type": "uint256"
|
|
}
|
|
],
|
|
"name": "FluidLiquidateResult",
|
|
"type": "error"
|
|
},
|
|
{
|
|
"inputs": [
|
|
{
|
|
"internalType": "uint256",
|
|
"name": "errorId_",
|
|
"type": "uint256"
|
|
}
|
|
],
|
|
"name": "FluidSafeTransferError",
|
|
"type": "error"
|
|
},
|
|
{
|
|
"inputs": [
|
|
{
|
|
"internalType": "uint256",
|
|
"name": "errorId_",
|
|
"type": "uint256"
|
|
}
|
|
],
|
|
"name": "FluidVaultError",
|
|
"type": "error"
|
|
},
|
|
{
|
|
"anonymous": false,
|
|
"inputs": [
|
|
{
|
|
"indexed": false,
|
|
"internalType": "uint256",
|
|
"name": "colAbsorbedRaw_",
|
|
"type": "uint256"
|
|
},
|
|
{
|
|
"indexed": false,
|
|
"internalType": "uint256",
|
|
"name": "debtAbsorbedRaw_",
|
|
"type": "uint256"
|
|
}
|
|
],
|
|
"name": "LogAbsorb",
|
|
"type": "event"
|
|
},
|
|
{
|
|
"anonymous": false,
|
|
"inputs": [
|
|
{
|
|
"indexed": false,
|
|
"internalType": "address",
|
|
"name": "liquidator_",
|
|
"type": "address"
|
|
},
|
|
{
|
|
"indexed": false,
|
|
"internalType": "uint256",
|
|
"name": "colAmt_",
|
|
"type": "uint256"
|
|
},
|
|
{
|
|
"indexed": false,
|
|
"internalType": "uint256",
|
|
"name": "debtAmt_",
|
|
"type": "uint256"
|
|
},
|
|
{
|
|
"indexed": false,
|
|
"internalType": "address",
|
|
"name": "to_",
|
|
"type": "address"
|
|
}
|
|
],
|
|
"name": "LogLiquidate",
|
|
"type": "event"
|
|
},
|
|
{
|
|
"anonymous": false,
|
|
"inputs": [
|
|
{
|
|
"indexed": false,
|
|
"internalType": "address",
|
|
"name": "user_",
|
|
"type": "address"
|
|
},
|
|
{
|
|
"indexed": false,
|
|
"internalType": "uint256",
|
|
"name": "nftId_",
|
|
"type": "uint256"
|
|
},
|
|
{
|
|
"indexed": false,
|
|
"internalType": "int256",
|
|
"name": "colAmt_",
|
|
"type": "int256"
|
|
},
|
|
{
|
|
"indexed": false,
|
|
"internalType": "int256",
|
|
"name": "debtAmt_",
|
|
"type": "int256"
|
|
},
|
|
{
|
|
"indexed": false,
|
|
"internalType": "address",
|
|
"name": "to_",
|
|
"type": "address"
|
|
}
|
|
],
|
|
"name": "LogOperate",
|
|
"type": "event"
|
|
},
|
|
{
|
|
"anonymous": false,
|
|
"inputs": [
|
|
{
|
|
"indexed": false,
|
|
"internalType": "int256",
|
|
"name": "colAmt_",
|
|
"type": "int256"
|
|
},
|
|
{
|
|
"indexed": false,
|
|
"internalType": "int256",
|
|
"name": "debtAmt_",
|
|
"type": "int256"
|
|
}
|
|
],
|
|
"name": "LogRebalance",
|
|
"type": "event"
|
|
},
|
|
{
|
|
"anonymous": false,
|
|
"inputs": [
|
|
{
|
|
"indexed": false,
|
|
"internalType": "uint256",
|
|
"name": "supplyExPrice_",
|
|
"type": "uint256"
|
|
},
|
|
{
|
|
"indexed": false,
|
|
"internalType": "uint256",
|
|
"name": "borrowExPrice_",
|
|
"type": "uint256"
|
|
}
|
|
],
|
|
"name": "LogUpdateExchangePrice",
|
|
"type": "event"
|
|
},
|
|
{
|
|
"inputs": [
|
|
{
|
|
"internalType": "uint256",
|
|
"name": "vaultVariables_",
|
|
"type": "uint256"
|
|
},
|
|
{
|
|
"internalType": "int256",
|
|
"name": "maxTick_",
|
|
"type": "int256"
|
|
}
|
|
],
|
|
"name": "absorb",
|
|
"outputs": [
|
|
{
|
|
"internalType": "uint256",
|
|
"name": "",
|
|
"type": "uint256"
|
|
}
|
|
],
|
|
"stateMutability": "nonpayable",
|
|
"type": "function"
|
|
},
|
|
{
|
|
"inputs": [],
|
|
"name": "rebalance",
|
|
"outputs": [
|
|
{
|
|
"internalType": "int256",
|
|
"name": "supplyAmt_",
|
|
"type": "int256"
|
|
},
|
|
{
|
|
"internalType": "int256",
|
|
"name": "borrowAmt_",
|
|
"type": "int256"
|
|
}
|
|
],
|
|
"stateMutability": "payable",
|
|
"type": "function"
|
|
}
|
|
],
|
|
"transactionHash": "0x3362b659bc43fbf7c5b74f9fba1a74358e321bf5e2866a57085702e60c59fa6c",
|
|
"receipt": {
|
|
"to": "0x4e59b44847b379578588920cA78FbF26c0B4956C",
|
|
"from": "0x0Ed35B1609Ec45c7079E80d11149a52717e4859A",
|
|
"contractAddress": null,
|
|
"transactionIndex": 49,
|
|
"gasUsed": "1718719",
|
|
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
|
"blockHash": "0xd9f958d53c4f835bb5645eed655121c5a127d285230257980736b45b99c82ccf",
|
|
"transactionHash": "0x3362b659bc43fbf7c5b74f9fba1a74358e321bf5e2866a57085702e60c59fa6c",
|
|
"logs": [],
|
|
"blockNumber": 19959871,
|
|
"cumulativeGasUsed": "4885899",
|
|
"status": 1,
|
|
"byzantium": true
|
|
},
|
|
"args": [],
|
|
"numDeployments": 3,
|
|
"solcInputHash": "033d84042c3fe6a1afa58a71e8e52d69",
|
|
"metadata": "{\"compiler\":{\"version\":\"0.8.21+commit.d9974bed\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"colLiquidated\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"debtLiquidated\",\"type\":\"uint256\"}],\"name\":\"FluidLiquidateResult\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"errorId_\",\"type\":\"uint256\"}],\"name\":\"FluidSafeTransferError\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"errorId_\",\"type\":\"uint256\"}],\"name\":\"FluidVaultError\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"colAbsorbedRaw_\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"debtAbsorbedRaw_\",\"type\":\"uint256\"}],\"name\":\"LogAbsorb\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"liquidator_\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"colAmt_\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"debtAmt_\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"to_\",\"type\":\"address\"}],\"name\":\"LogLiquidate\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"user_\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nftId_\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"int256\",\"name\":\"colAmt_\",\"type\":\"int256\"},{\"indexed\":false,\"internalType\":\"int256\",\"name\":\"debtAmt_\",\"type\":\"int256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"to_\",\"type\":\"address\"}],\"name\":\"LogOperate\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"int256\",\"name\":\"colAmt_\",\"type\":\"int256\"},{\"indexed\":false,\"internalType\":\"int256\",\"name\":\"debtAmt_\",\"type\":\"int256\"}],\"name\":\"LogRebalance\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"supplyExPrice_\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"borrowExPrice_\",\"type\":\"uint256\"}],\"name\":\"LogUpdateExchangePrice\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"vaultVariables_\",\"type\":\"uint256\"},{\"internalType\":\"int256\",\"name\":\"maxTick_\",\"type\":\"int256\"}],\"name\":\"absorb\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rebalance\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"supplyAmt_\",\"type\":\"int256\"},{\"internalType\":\"int256\",\"name\":\"borrowAmt_\",\"type\":\"int256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"absorb(uint256,int256)\":{\"details\":\"absorb function absorbs the bad debt if the bad debt is above max limit. The main use of it is if the bad debt didn't got liquidated in time maybe due to sudden price drop or bad debt was extremely small to liquidate and the bad debt goes above 100% ratio then there's no incentive for anyone to liquidate now hence absorb functions absorbs that bad debt to allow newer bad debt to liquidate seamlessly. if absorbing were to happen after this it's on governance on how to deal with it although it can still be removed through liquidate via liquidator if the price goes back up and liquidation becomes beneficial upon absorbed user position gets 100% liquidated.\"},\"rebalance()\":{\"details\":\"Checks total supply of vault's in Liquidity Layer & Vault contract and rebalance it accordingly if vault supply is more than Liquidity Layer then deposit difference through reserve/rebalance contract if vault supply is less than Liquidity Layer then withdraw difference to reserve/rebalance contract if vault borrow is more than Liquidity Layer then borrow difference to reserve/rebalance contract if vault borrow is less than Liquidity Layer then payback difference through reserve/rebalance contract\"}},\"version\":1},\"userdoc\":{\"errors\":{\"FluidLiquidateResult(uint256,uint256)\":[{\"notice\":\"used to simulate liquidation to find the maximum liquidatable amounts\"}]},\"events\":{\"LogAbsorb(uint256,uint256)\":{\"notice\":\"emitted when `absorb()` was executed to absorb bad debt.\"},\"LogLiquidate(address,uint256,uint256,address)\":{\"notice\":\"emitted when a liquidation has been executed.\"},\"LogOperate(address,uint256,int256,int256,address)\":{\"notice\":\"emitted when an operate() method is executed that changes collateral (`colAmt_`) / debt (debtAmt_`) amount for a `user_` position with `nftId_`. Receiver of any funds is the address `to_`.\"},\"LogRebalance(int256,int256)\":{\"notice\":\"emitted when a `rebalance()` has been executed, balancing out total supply / borrow between Vault and Fluid Liquidity pools. if `colAmt_` is positive then loss, meaning transfer from rebalancer address to vault and deposit. if `colAmt_` is negative then profit, meaning withdrawn from vault and sent to rebalancer address. if `debtAmt_` is positive then profit, meaning borrow from vault and sent to rebalancer address. if `debtAmt_` is negative then loss, meaning transfer from rebalancer address to vault and payback.\"},\"LogUpdateExchangePrice(uint256,uint256)\":{\"notice\":\"emitted when the exchange prices are updated in storage.\"}},\"kind\":\"user\",\"methods\":{},\"notice\":\"Fluid Vault protocol secondary methods contract. Implements `absorb()` and `rebalance()` methods, extracted from main contract due to contract size limits. Methods are limited to be called via delegateCall only (as done by Vault CoreModule \\\"VaultT1\\\" contract).\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/protocols/vault/vaultT1/coreModule/main2.sol\":\"FluidVaultT1Secondary\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10000000},\"remappings\":[]},\"sources\":{\"contracts/infiniteProxy/interfaces/iProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.21;\\n\\ninterface IProxy {\\n function setAdmin(address newAdmin_) external;\\n\\n function setDummyImplementation(address newDummyImplementation_) external;\\n\\n function addImplementation(address implementation_, bytes4[] calldata sigs_) external;\\n\\n function removeImplementation(address implementation_) external;\\n\\n function getAdmin() external view returns (address);\\n\\n function getDummyImplementation() external view returns (address);\\n\\n function getImplementationSigs(address impl_) external view returns (bytes4[] memory);\\n\\n function getSigsImplementation(bytes4 sig_) external view returns (address);\\n\\n function readFromStorage(bytes32 slot_) external view returns (uint256 result_);\\n}\\n\",\"keccak256\":\"0xbb605491d4bac08e816248feecae7dd17cfc1877c88b2e555abece2970f5ea00\",\"license\":\"MIT\"},\"contracts/libraries/bigMathMinified.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity 0.8.21;\\n\\n/// @title library that represents a number in BigNumber(coefficient and exponent) format to store in smaller bits.\\n/// @notice the number is divided into two parts: a coefficient and an exponent. This comes at a cost of losing some precision\\n/// at the end of the number because the exponent simply fills it with zeroes. This precision is oftentimes negligible and can\\n/// result in significant gas cost reduction due to storage space reduction.\\n/// Also note, a valid big number is as follows: if the exponent is > 0, then coefficient last bits should be occupied to have max precision.\\n/// @dev roundUp is more like a increase 1, which happens everytime for the same number.\\n/// roundDown simply sets trailing digits after coefficientSize to zero (floor), only once for the same number.\\nlibrary BigMathMinified {\\n /// @dev constants to use for `roundUp` input param to increase readability\\n bool internal constant ROUND_DOWN = false;\\n bool internal constant ROUND_UP = true;\\n\\n /// @dev converts `normal` number to BigNumber with `exponent` and `coefficient` (or precision).\\n /// e.g.:\\n /// 5035703444687813576399599 (normal) = (coefficient[32bits], exponent[8bits])[40bits]\\n /// 5035703444687813576399599 (decimal) => 10000101010010110100000011111011110010100110100000000011100101001101001101011101111 (binary)\\n /// => 10000101010010110100000011111011000000000000000000000000000000000000000000000000000\\n /// ^-------------------- 51(exponent) -------------- ^\\n /// coefficient = 1000,0101,0100,1011,0100,0000,1111,1011 (2236301563)\\n /// exponent = 0011,0011 (51)\\n /// bigNumber = 1000,0101,0100,1011,0100,0000,1111,1011,0011,0011 (572493200179)\\n ///\\n /// @param normal number which needs to be converted into Big Number\\n /// @param coefficientSize at max how many bits of precision there should be (64 = uint64 (64 bits precision))\\n /// @param exponentSize at max how many bits of exponent there should be (8 = uint8 (8 bits exponent))\\n /// @param roundUp signals if result should be rounded down or up\\n /// @return bigNumber converted bigNumber (coefficient << exponent)\\n function toBigNumber(\\n uint256 normal,\\n uint256 coefficientSize,\\n uint256 exponentSize,\\n bool roundUp\\n ) internal pure returns (uint256 bigNumber) {\\n assembly {\\n let lastBit_\\n let number_ := normal\\n if gt(number_, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) {\\n number_ := shr(0x80, number_)\\n lastBit_ := 0x80\\n }\\n if gt(number_, 0xFFFFFFFFFFFFFFFF) {\\n number_ := shr(0x40, number_)\\n lastBit_ := add(lastBit_, 0x40)\\n }\\n if gt(number_, 0xFFFFFFFF) {\\n number_ := shr(0x20, number_)\\n lastBit_ := add(lastBit_, 0x20)\\n }\\n if gt(number_, 0xFFFF) {\\n number_ := shr(0x10, number_)\\n lastBit_ := add(lastBit_, 0x10)\\n }\\n if gt(number_, 0xFF) {\\n number_ := shr(0x8, number_)\\n lastBit_ := add(lastBit_, 0x8)\\n }\\n if gt(number_, 0xF) {\\n number_ := shr(0x4, number_)\\n lastBit_ := add(lastBit_, 0x4)\\n }\\n if gt(number_, 0x3) {\\n number_ := shr(0x2, number_)\\n lastBit_ := add(lastBit_, 0x2)\\n }\\n if gt(number_, 0x1) {\\n lastBit_ := add(lastBit_, 1)\\n }\\n if gt(number_, 0) {\\n lastBit_ := add(lastBit_, 1)\\n }\\n if lt(lastBit_, coefficientSize) {\\n // for throw exception\\n lastBit_ := coefficientSize\\n }\\n let exponent := sub(lastBit_, coefficientSize)\\n let coefficient := shr(exponent, normal)\\n if and(roundUp, gt(exponent, 0)) {\\n // rounding up is only needed if exponent is > 0, as otherwise the coefficient fully holds the original number\\n coefficient := add(coefficient, 1)\\n if eq(shl(coefficientSize, 1), coefficient) {\\n // case were coefficient was e.g. 111, with adding 1 it became 1000 (in binary) and coefficientSize 3 bits\\n // final coefficient would exceed it's size. -> reduce coefficent to 100 and increase exponent by 1.\\n coefficient := shl(sub(coefficientSize, 1), 1)\\n exponent := add(exponent, 1)\\n }\\n }\\n if iszero(lt(exponent, shl(exponentSize, 1))) {\\n // if exponent is >= exponentSize, the normal number is too big to fit within\\n // BigNumber with too small sizes for coefficient and exponent\\n revert(0, 0)\\n }\\n bigNumber := shl(exponentSize, coefficient)\\n bigNumber := add(bigNumber, exponent)\\n }\\n }\\n\\n /// @dev get `normal` number from `bigNumber`, `exponentSize` and `exponentMask`\\n function fromBigNumber(\\n uint256 bigNumber,\\n uint256 exponentSize,\\n uint256 exponentMask\\n ) internal pure returns (uint256 normal) {\\n assembly {\\n let coefficient := shr(exponentSize, bigNumber)\\n let exponent := and(bigNumber, exponentMask)\\n normal := shl(exponent, coefficient)\\n }\\n }\\n\\n /// @dev gets the most significant bit `lastBit` of a `normal` number (length of given number of binary format).\\n /// e.g.\\n /// 5035703444687813576399599 = 10000101010010110100000011111011110010100110100000000011100101001101001101011101111\\n /// lastBit = ^--------------------------------- 83 ----------------------------------------^\\n function mostSignificantBit(uint256 normal) internal pure returns (uint lastBit) {\\n assembly {\\n let number_ := normal\\n if gt(normal, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) {\\n number_ := shr(0x80, number_)\\n lastBit := 0x80\\n }\\n if gt(number_, 0xFFFFFFFFFFFFFFFF) {\\n number_ := shr(0x40, number_)\\n lastBit := add(lastBit, 0x40)\\n }\\n if gt(number_, 0xFFFFFFFF) {\\n number_ := shr(0x20, number_)\\n lastBit := add(lastBit, 0x20)\\n }\\n if gt(number_, 0xFFFF) {\\n number_ := shr(0x10, number_)\\n lastBit := add(lastBit, 0x10)\\n }\\n if gt(number_, 0xFF) {\\n number_ := shr(0x8, number_)\\n lastBit := add(lastBit, 0x8)\\n }\\n if gt(number_, 0xF) {\\n number_ := shr(0x4, number_)\\n lastBit := add(lastBit, 0x4)\\n }\\n if gt(number_, 0x3) {\\n number_ := shr(0x2, number_)\\n lastBit := add(lastBit, 0x2)\\n }\\n if gt(number_, 0x1) {\\n lastBit := add(lastBit, 1)\\n }\\n if gt(number_, 0) {\\n lastBit := add(lastBit, 1)\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf0be1002909edf30aec3dc6623c2bd2407ed94064b62674c01032b844dec206a\",\"license\":\"BUSL-1.1\"},\"contracts/libraries/errorTypes.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity 0.8.21;\\n\\nlibrary LibsErrorTypes {\\n /***********************************|\\n | LiquidityCalcs | \\n |__________________________________*/\\n\\n /// @notice thrown when supply or borrow exchange price is zero at calc token data (token not configured yet)\\n uint256 internal constant LiquidityCalcs__ExchangePriceZero = 70001;\\n\\n /// @notice thrown when rate data is set to a version that is not implemented\\n uint256 internal constant LiquidityCalcs__UnsupportedRateVersion = 70002;\\n\\n /// @notice thrown when the calculated borrow rate turns negative. This should never happen.\\n uint256 internal constant LiquidityCalcs__BorrowRateNegative = 70003;\\n\\n /***********************************|\\n | SafeTransfer | \\n |__________________________________*/\\n\\n /// @notice thrown when safe transfer from for an ERC20 fails\\n uint256 internal constant SafeTransfer__TransferFromFailed = 71001;\\n\\n /// @notice thrown when safe transfer for an ERC20 fails\\n uint256 internal constant SafeTransfer__TransferFailed = 71002;\\n}\\n\",\"keccak256\":\"0xaf7732f30d00dd38082d37aa37887be485fc94b0c76ff302aff615d03381674f\",\"license\":\"BUSL-1.1\"},\"contracts/libraries/liquidityCalcs.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity 0.8.21;\\n\\nimport { LibsErrorTypes as ErrorTypes } from \\\"./errorTypes.sol\\\";\\nimport { LiquiditySlotsLink } from \\\"./liquiditySlotsLink.sol\\\";\\nimport { BigMathMinified } from \\\"./bigMathMinified.sol\\\";\\n\\n/// @notice implements calculation methods used for Fluid liquidity such as updated exchange prices,\\n/// borrow rate, withdrawal / borrow limits, revenue amount.\\nlibrary LiquidityCalcs {\\n error FluidLiquidityCalcsError(uint256 errorId_);\\n\\n /// @notice emitted if the calculated borrow rate surpassed max borrow rate (16 bits) and was capped at maximum value 65535\\n event BorrowRateMaxCap();\\n\\n /// @dev constants as from Liquidity variables.sol\\n uint256 internal constant EXCHANGE_PRICES_PRECISION = 1e12;\\n\\n /// @dev Ignoring leap years\\n uint256 internal constant SECONDS_PER_YEAR = 365 days;\\n // constants used for BigMath conversion from and to storage\\n uint256 internal constant DEFAULT_EXPONENT_SIZE = 8;\\n uint256 internal constant DEFAULT_EXPONENT_MASK = 0xFF;\\n\\n uint256 internal constant FOUR_DECIMALS = 1e4;\\n uint256 internal constant TWELVE_DECIMALS = 1e12;\\n uint256 internal constant X14 = 0x3fff;\\n uint256 internal constant X15 = 0x7fff;\\n uint256 internal constant X16 = 0xffff;\\n uint256 internal constant X18 = 0x3ffff;\\n uint256 internal constant X24 = 0xffffff;\\n uint256 internal constant X33 = 0x1ffffffff;\\n uint256 internal constant X64 = 0xffffffffffffffff;\\n\\n ///////////////////////////////////////////////////////////////////////////\\n ////////// CALC EXCHANGE PRICES /////////\\n ///////////////////////////////////////////////////////////////////////////\\n\\n /// @dev calculates interest (exchange prices) for a token given its' exchangePricesAndConfig from storage.\\n /// @param exchangePricesAndConfig_ exchange prices and config packed uint256 read from storage\\n /// @return supplyExchangePrice_ updated supplyExchangePrice\\n /// @return borrowExchangePrice_ updated borrowExchangePrice\\n function calcExchangePrices(\\n uint256 exchangePricesAndConfig_\\n ) internal view returns (uint256 supplyExchangePrice_, uint256 borrowExchangePrice_) {\\n // Extracting exchange prices\\n supplyExchangePrice_ =\\n (exchangePricesAndConfig_ >> LiquiditySlotsLink.BITS_EXCHANGE_PRICES_SUPPLY_EXCHANGE_PRICE) &\\n X64;\\n borrowExchangePrice_ =\\n (exchangePricesAndConfig_ >> LiquiditySlotsLink.BITS_EXCHANGE_PRICES_BORROW_EXCHANGE_PRICE) &\\n X64;\\n\\n if (supplyExchangePrice_ == 0 || borrowExchangePrice_ == 0) {\\n revert FluidLiquidityCalcsError(ErrorTypes.LiquidityCalcs__ExchangePriceZero);\\n }\\n\\n uint256 temp_ = exchangePricesAndConfig_ & X16; // temp_ = borrowRate\\n\\n unchecked {\\n // last timestamp can not be > current timestamp\\n uint256 secondsSinceLastUpdate_ = block.timestamp -\\n ((exchangePricesAndConfig_ >> LiquiditySlotsLink.BITS_EXCHANGE_PRICES_LAST_TIMESTAMP) & X33);\\n\\n uint256 borrowRatio_ = (exchangePricesAndConfig_ >> LiquiditySlotsLink.BITS_EXCHANGE_PRICES_BORROW_RATIO) &\\n X15;\\n if (secondsSinceLastUpdate_ == 0 || temp_ == 0 || borrowRatio_ == 1) {\\n // if no time passed, borrow rate is 0, or no raw borrowings: no exchange price update needed\\n // (if borrowRatio_ == 1 means there is only borrowInterestFree, as first bit is 1 and rest is 0)\\n return (supplyExchangePrice_, borrowExchangePrice_);\\n }\\n\\n // calculate new borrow exchange price.\\n // formula borrowExchangePriceIncrease: previous price * borrow rate * secondsSinceLastUpdate_.\\n // nominator is max uint112 (uint64 * uint16 * uint32). Divisor can not be 0.\\n borrowExchangePrice_ +=\\n (borrowExchangePrice_ * temp_ * secondsSinceLastUpdate_) /\\n (SECONDS_PER_YEAR * FOUR_DECIMALS);\\n\\n // FOR SUPPLY EXCHANGE PRICE:\\n // all yield paid by borrowers (in mode with interest) goes to suppliers in mode with interest.\\n // formula: previous price * supply rate * secondsSinceLastUpdate_.\\n // where supply rate = (borrow rate - revenueFee%) * ratioSupplyYield. And\\n // ratioSupplyYield = utilization * supplyRatio * borrowRatio\\n //\\n // Example:\\n // supplyRawInterest is 80, supplyInterestFree is 20. totalSupply is 100. BorrowedRawInterest is 50.\\n // BorrowInterestFree is 10. TotalBorrow is 60. borrow rate 40%, revenueFee 10%.\\n // yield is 10 (so half a year must have passed).\\n // supplyRawInterest must become worth 89. totalSupply must become 109. BorrowedRawInterest must become 60.\\n // borrowInterestFree must still be 10. supplyInterestFree still 20. totalBorrow 70.\\n // supplyExchangePrice would have to go from 1 to 1,125 (+ 0.125). borrowExchangePrice from 1 to 1,2 (+0.2).\\n // utilization is 60%. supplyRatio = 20 / 80 = 25% (only 80% of lenders receiving yield).\\n // borrowRatio = 10 / 50 = 20% (only 83,333% of borrowers paying yield):\\n // x of borrowers paying yield = 100% - (20 / (100 + 20)) = 100% - 16.6666666% = 83,333%.\\n // ratioSupplyYield = 60% * 83,33333% * (100% + 20%) = 62,5%\\n // supplyRate = (40% * (100% - 10%)) * = 36% * 62,5% = 22.5%\\n // increase in supplyExchangePrice, assuming 100 as previous price.\\n // 100 * 22,5% * 1/2 (half a year) = 0,1125.\\n // cross-check supplyRawInterest worth = 80 * 1.1125 = 89. totalSupply worth = 89 + 20.\\n\\n // -------------- 1. calculate ratioSupplyYield --------------------------------\\n // step1: utilization * supplyRatio (or actually part of lenders receiving yield)\\n\\n // temp_ => supplyRatio (in 1e2: 100% = 10_000; 1% = 100 -> max value 16_383)\\n // if first bit 0 then ratio is supplyInterestFree / supplyWithInterest (supplyWithInterest is bigger)\\n // else ratio is supplyWithInterest / supplyInterestFree (supplyInterestFree is bigger)\\n temp_ = (exchangePricesAndConfig_ >> LiquiditySlotsLink.BITS_EXCHANGE_PRICES_SUPPLY_RATIO) & X15;\\n\\n if (temp_ == 1) {\\n // if no raw supply: no exchange price update needed\\n // (if supplyRatio_ == 1 means there is only supplyInterestFree, as first bit is 1 and rest is 0)\\n return (supplyExchangePrice_, borrowExchangePrice_);\\n }\\n\\n // ratioSupplyYield precision is 1e27 as 100% for increased precision when supplyInterestFree > supplyWithInterest\\n if (temp_ & 1 == 1) {\\n // ratio is supplyWithInterest / supplyInterestFree (supplyInterestFree is bigger)\\n temp_ = temp_ >> 1;\\n\\n // Note: case where temp_ == 0 (only supplyInterestFree, no yield) already covered by early return\\n // in the if statement a little above.\\n\\n // based on above example but supplyRawInterest is 20, supplyInterestFree is 80. no fee.\\n // supplyRawInterest must become worth 30. totalSupply must become 110.\\n // supplyExchangePrice would have to go from 1 to 1,5. borrowExchangePrice from 1 to 1,2.\\n // so ratioSupplyYield must come out as 2.5 (250%).\\n // supplyRatio would be (20 * 10_000 / 80) = 2500. but must be inverted.\\n temp_ = (1e27 * FOUR_DECIMALS) / temp_; // e.g. 1e31 / 2500 = 4e27. (* 1e27 for precision)\\n // e.g. 5_000 * (1e27 + 4e27) / 1e27 = 25_000 (=250%).\\n temp_ =\\n // utilization * (100% + 100% / supplyRatio)\\n (((exchangePricesAndConfig_ >> LiquiditySlotsLink.BITS_EXCHANGE_PRICES_UTILIZATION) & X14) *\\n (1e27 + temp_)) / // extract utilization (max 16_383 so there is no way this can overflow).\\n (FOUR_DECIMALS);\\n // max possible value of temp_ here is 16383 * (1e27 + 1e31) / 1e4 = ~1.64e31\\n } else {\\n // ratio is supplyInterestFree / supplyWithInterest (supplyWithInterest is bigger)\\n temp_ = temp_ >> 1;\\n // if temp_ == 0 then only supplyWithInterest => full yield. temp_ is already 0\\n\\n // e.g. 5_000 * 10_000 + (20 * 10_000 / 80) / 10_000 = 5000 * 12500 / 10000 = 6250 (=62.5%).\\n temp_ =\\n // 1e27 * utilization * (100% + supplyRatio) / 100%\\n (1e27 *\\n ((exchangePricesAndConfig_ >> LiquiditySlotsLink.BITS_EXCHANGE_PRICES_UTILIZATION) & X14) * // extract utilization (max 16_383 so there is no way this can overflow).\\n (FOUR_DECIMALS + temp_)) /\\n (FOUR_DECIMALS * FOUR_DECIMALS);\\n // max possible temp_ value: 1e27 * 16383 * 2e4 / 1e8 = 3.2766e27\\n }\\n // from here temp_ => ratioSupplyYield (utilization * supplyRatio part) scaled by 1e27. max possible value ~1.64e31\\n\\n // step2 of ratioSupplyYield: add borrowRatio (only x% of borrowers paying yield)\\n if (borrowRatio_ & 1 == 1) {\\n // ratio is borrowWithInterest / borrowInterestFree (borrowInterestFree is bigger)\\n borrowRatio_ = borrowRatio_ >> 1;\\n // borrowRatio_ => x of total bororwers paying yield. scale to 1e27.\\n\\n // Note: case where borrowRatio_ == 0 (only borrowInterestFree, no yield) already covered\\n // at the beginning of the method by early return if `borrowRatio_ == 1`.\\n\\n // based on above example but borrowRawInterest is 10, borrowInterestFree is 50. no fee. borrowRatio = 20%.\\n // so only 16.66% of borrowers are paying yield. so the 100% - part of the formula is not needed.\\n // x of borrowers paying yield = (borrowRatio / (100 + borrowRatio)) = 16.6666666%\\n // borrowRatio_ => x of total bororwers paying yield. scale to 1e27.\\n borrowRatio_ = (borrowRatio_ * 1e27) / (FOUR_DECIMALS + borrowRatio_);\\n // max value here for borrowRatio_ is (1e31 / (1e4 + 1e4))= 5e26 (= 50% of borrowers paying yield).\\n } else {\\n // ratio is borrowInterestFree / borrowWithInterest (borrowWithInterest is bigger)\\n borrowRatio_ = borrowRatio_ >> 1;\\n\\n // borrowRatio_ => x of total bororwers paying yield. scale to 1e27.\\n // x of borrowers paying yield = 100% - (borrowRatio / (100 + borrowRatio)) = 100% - 16.6666666% = 83,333%.\\n borrowRatio_ = (1e27 - ((borrowRatio_ * 1e27) / (FOUR_DECIMALS + borrowRatio_)));\\n // borrowRatio can never be > 100%. so max subtraction can be 100% - 100% / 200%.\\n // or if borrowRatio_ is 0 -> 100% - 0. or if borrowRatio_ is 1 -> 100% - 1 / 101.\\n // max value here for borrowRatio_ is 1e27 - 0 = 1e27 (= 100% of borrowers paying yield).\\n }\\n\\n // temp_ => ratioSupplyYield. scaled down from 1e25 = 1% each to normal percent precision 1e2 = 1%.\\n // max nominator value is ~1.64e31 * 1e27 = 1.64e58. max result = 1.64e8\\n temp_ = (FOUR_DECIMALS * temp_ * borrowRatio_) / 1e54;\\n\\n // 2. calculate supply rate\\n // temp_ => supply rate (borrow rate - revenueFee%) * ratioSupplyYield.\\n // division part is done in next step to increase precision. (divided by 2x FOUR_DECIMALS, fee + borrowRate)\\n // Note that all calculation divisions for supplyExchangePrice are rounded down.\\n // Note supply rate can be bigger than the borrowRate, e.g. if there are only few lenders with interest\\n // but more suppliers not earning interest.\\n temp_ = ((exchangePricesAndConfig_ & X16) * // borrow rate\\n temp_ * // ratioSupplyYield\\n (FOUR_DECIMALS - ((exchangePricesAndConfig_ >> LiquiditySlotsLink.BITS_EXCHANGE_PRICES_FEE) & X14))); // revenueFee\\n // fee can not be > 100%. max possible = 65535 * ~1.64e8 * 1e4 =~1.074774e17.\\n\\n // 3. calculate increase in supply exchange price\\n supplyExchangePrice_ += ((supplyExchangePrice_ * temp_ * secondsSinceLastUpdate_) /\\n (SECONDS_PER_YEAR * FOUR_DECIMALS * FOUR_DECIMALS * FOUR_DECIMALS));\\n // max possible nominator = max uint 64 * 1.074774e17 * max uint32 = ~8.52e45. Denominator can not be 0.\\n }\\n }\\n\\n ///////////////////////////////////////////////////////////////////////////\\n ////////// CALC REVENUE /////////\\n ///////////////////////////////////////////////////////////////////////////\\n\\n /// @dev gets the `revenueAmount_` for a token given its' totalAmounts and exchangePricesAndConfig from storage\\n /// and the current balance of the Fluid liquidity contract for the token.\\n /// @param totalAmounts_ total amounts packed uint256 read from storage\\n /// @param exchangePricesAndConfig_ exchange prices and config packed uint256 read from storage\\n /// @param liquidityTokenBalance_ current balance of Liquidity contract (IERC20(token_).balanceOf(address(this)))\\n /// @return revenueAmount_ collectable revenue amount\\n function calcRevenue(\\n uint256 totalAmounts_,\\n uint256 exchangePricesAndConfig_,\\n uint256 liquidityTokenBalance_\\n ) internal view returns (uint256 revenueAmount_) {\\n // @dev no need to super-optimize this method as it is only used by admin\\n\\n // calculate the new exchange prices based on earned interest\\n (uint256 supplyExchangePrice_, uint256 borrowExchangePrice_) = calcExchangePrices(exchangePricesAndConfig_);\\n\\n // total supply = interest free + with interest converted from raw\\n uint256 totalSupply_ = getTotalSupply(totalAmounts_, supplyExchangePrice_);\\n\\n if (totalSupply_ > 0) {\\n // available revenue: balanceOf(token) + totalBorrowings - totalLendings.\\n revenueAmount_ = liquidityTokenBalance_ + getTotalBorrow(totalAmounts_, borrowExchangePrice_);\\n // ensure there is no possible case because of rounding etc. where this would revert,\\n // explicitly check if >\\n revenueAmount_ = revenueAmount_ > totalSupply_ ? revenueAmount_ - totalSupply_ : 0;\\n // Note: if utilization > 100% (totalSupply < totalBorrow), then all the amount above 100% utilization\\n // can only be revenue.\\n } else {\\n // if supply is 0, then rest of balance can be withdrawn as revenue so that no amounts get stuck\\n revenueAmount_ = liquidityTokenBalance_;\\n }\\n }\\n\\n ///////////////////////////////////////////////////////////////////////////\\n ////////// CALC LIMITS /////////\\n ///////////////////////////////////////////////////////////////////////////\\n\\n /// @dev calculates withdrawal limit before an operate execution:\\n /// amount of user supply that must stay supplied (not amount that can be withdrawn).\\n /// i.e. if user has supplied 100m and can withdraw 5M, this method returns the 95M, not the withdrawable amount 5M\\n /// @param userSupplyData_ user supply data packed uint256 from storage\\n /// @param userSupply_ current user supply amount already extracted from `userSupplyData_` and converted from BigMath\\n /// @return currentWithdrawalLimit_ current withdrawal limit updated for expansion since last interaction.\\n /// returned value is in raw for with interest mode, normal amount for interest free mode!\\n function calcWithdrawalLimitBeforeOperate(\\n uint256 userSupplyData_,\\n uint256 userSupply_\\n ) internal view returns (uint256 currentWithdrawalLimit_) {\\n // @dev must support handling the case where timestamp is 0 (config is set but no interactions yet).\\n // first tx where timestamp is 0 will enter `if (lastWithdrawalLimit_ == 0)` because lastWithdrawalLimit_ is not set yet.\\n // returning max withdrawal allowed, which is not exactly right but doesn't matter because the first interaction must be\\n // a deposit anyway. Important is that it would not revert.\\n\\n // Note the first time a deposit brings the user supply amount to above the base withdrawal limit, the active limit\\n // is the fully expanded limit immediately.\\n\\n // extract last set withdrawal limit\\n uint256 lastWithdrawalLimit_ = (userSupplyData_ >>\\n LiquiditySlotsLink.BITS_USER_SUPPLY_PREVIOUS_WITHDRAWAL_LIMIT) & X64;\\n lastWithdrawalLimit_ =\\n (lastWithdrawalLimit_ >> DEFAULT_EXPONENT_SIZE) <<\\n (lastWithdrawalLimit_ & DEFAULT_EXPONENT_MASK);\\n if (lastWithdrawalLimit_ == 0) {\\n // withdrawal limit is not activated. Max withdrawal allowed\\n return 0;\\n }\\n\\n uint256 maxWithdrawableLimit_;\\n uint256 temp_;\\n unchecked {\\n // extract max withdrawable percent of user supply and\\n // calculate maximum withdrawable amount expandPercentage of user supply at full expansion duration elapsed\\n // e.g.: if 10% expandPercentage, meaning 10% is withdrawable after full expandDuration has elapsed.\\n\\n // userSupply_ needs to be atleast 1e73 to overflow max limit of ~1e77 in uint256 (no token in existence where this is possible).\\n maxWithdrawableLimit_ =\\n (((userSupplyData_ >> LiquiditySlotsLink.BITS_USER_SUPPLY_EXPAND_PERCENT) & X14) * userSupply_) /\\n FOUR_DECIMALS;\\n\\n // time elapsed since last withdrawal limit was set (in seconds)\\n // @dev last process timestamp is guaranteed to exist for withdrawal, as a supply must have happened before.\\n // last timestamp can not be > current timestamp\\n temp_ =\\n block.timestamp -\\n ((userSupplyData_ >> LiquiditySlotsLink.BITS_USER_SUPPLY_LAST_UPDATE_TIMESTAMP) & X33);\\n }\\n // calculate withdrawable amount of expandPercent that is elapsed of expandDuration.\\n // e.g. if 60% of expandDuration has elapsed, then user should be able to withdraw 6% of user supply, down to 94%.\\n // Note: no explicit check for this needed, it is covered by setting minWithdrawalLimit_ if needed.\\n temp_ =\\n (maxWithdrawableLimit_ * temp_) /\\n // extract expand duration: After this, decrement won't happen (user can withdraw 100% of withdraw limit)\\n ((userSupplyData_ >> LiquiditySlotsLink.BITS_USER_SUPPLY_EXPAND_DURATION) & X24); // expand duration can never be 0\\n // calculate expanded withdrawal limit: last withdrawal limit - withdrawable amount.\\n // Note: withdrawable amount here can grow bigger than userSupply if timeElapsed is a lot bigger than expandDuration,\\n // which would cause the subtraction `lastWithdrawalLimit_ - withdrawableAmount_` to revert. In that case, set 0\\n // which will cause minimum (fully expanded) withdrawal limit to be set in lines below.\\n unchecked {\\n // underflow explicitly checked & handled\\n currentWithdrawalLimit_ = lastWithdrawalLimit_ > temp_ ? lastWithdrawalLimit_ - temp_ : 0;\\n // calculate minimum withdrawal limit: minimum amount of user supply that must stay supplied at full expansion.\\n // subtraction can not underflow as maxWithdrawableLimit_ is a percentage amount (<=100%) of userSupply_\\n temp_ = userSupply_ - maxWithdrawableLimit_;\\n }\\n // if withdrawal limit is decreased below minimum then set minimum\\n // (e.g. when more than expandDuration time has elapsed)\\n if (temp_ > currentWithdrawalLimit_) {\\n currentWithdrawalLimit_ = temp_;\\n }\\n }\\n\\n /// @dev calculates withdrawal limit after an operate execution:\\n /// amount of user supply that must stay supplied (not amount that can be withdrawn).\\n /// i.e. if user has supplied 100m and can withdraw 5M, this method returns the 95M, not the withdrawable amount 5M\\n /// @param userSupplyData_ user supply data packed uint256 from storage\\n /// @param userSupply_ current user supply amount already extracted from `userSupplyData_` and added / subtracted with the executed operate amount\\n /// @param newWithdrawalLimit_ current withdrawal limit updated for expansion since last interaction, result from `calcWithdrawalLimitBeforeOperate`\\n /// @return withdrawalLimit_ updated withdrawal limit that should be written to storage. returned value is in\\n /// raw for with interest mode, normal amount for interest free mode!\\n function calcWithdrawalLimitAfterOperate(\\n uint256 userSupplyData_,\\n uint256 userSupply_,\\n uint256 newWithdrawalLimit_\\n ) internal pure returns (uint256) {\\n // temp_ => base withdrawal limit. below this, maximum withdrawals are allowed\\n uint256 temp_ = (userSupplyData_ >> LiquiditySlotsLink.BITS_USER_SUPPLY_BASE_WITHDRAWAL_LIMIT) & X18;\\n temp_ = (temp_ >> DEFAULT_EXPONENT_SIZE) << (temp_ & DEFAULT_EXPONENT_MASK);\\n\\n // if user supply is below base limit then max withdrawals are allowed\\n if (userSupply_ < temp_) {\\n return 0;\\n }\\n // temp_ => withdrawal limit expandPercent (is in 1e2 decimals)\\n temp_ = (userSupplyData_ >> LiquiditySlotsLink.BITS_USER_SUPPLY_EXPAND_PERCENT) & X14;\\n unchecked {\\n // temp_ => minimum withdrawal limit: userSupply - max withdrawable limit (userSupply * expandPercent))\\n // userSupply_ needs to be atleast 1e73 to overflow max limit of ~1e77 in uint256 (no token in existence where this is possible).\\n // subtraction can not underflow as maxWithdrawableLimit_ is a percentage amount (<=100%) of userSupply_\\n temp_ = userSupply_ - ((userSupply_ * temp_) / FOUR_DECIMALS);\\n }\\n // if new (before operation) withdrawal limit is less than minimum limit then set minimum limit.\\n // e.g. can happen on new deposits. withdrawal limit is instantly fully expanded in a scenario where\\n // increased deposit amount outpaces withrawals.\\n if (temp_ > newWithdrawalLimit_) {\\n return temp_;\\n }\\n return newWithdrawalLimit_;\\n }\\n\\n /// @dev calculates borrow limit before an operate execution:\\n /// total amount user borrow can reach (not borrowable amount in current operation).\\n /// i.e. if user has borrowed 50M and can still borrow 5M, this method returns the total 55M, not the borrowable amount 5M\\n /// @param userBorrowData_ user borrow data packed uint256 from storage\\n /// @param userBorrow_ current user borrow amount already extracted from `userBorrowData_`\\n /// @return currentBorrowLimit_ current borrow limit updated for expansion since last interaction. returned value is in\\n /// raw for with interest mode, normal amount for interest free mode!\\n function calcBorrowLimitBeforeOperate(\\n uint256 userBorrowData_,\\n uint256 userBorrow_\\n ) internal view returns (uint256 currentBorrowLimit_) {\\n // @dev must support handling the case where timestamp is 0 (config is set but no interactions yet) -> base limit.\\n // first tx where timestamp is 0 will enter `if (maxExpandedBorrowLimit_ < baseBorrowLimit_)` because `userBorrow_` and thus\\n // `maxExpansionLimit_` and thus `maxExpandedBorrowLimit_` is 0 and `baseBorrowLimit_` can not be 0.\\n\\n // temp_ = extract borrow expand percent (is in 1e2 decimals)\\n uint256 temp_ = (userBorrowData_ >> LiquiditySlotsLink.BITS_USER_BORROW_EXPAND_PERCENT) & X14;\\n\\n uint256 maxExpansionLimit_;\\n uint256 maxExpandedBorrowLimit_;\\n unchecked {\\n // calculate max expansion limit: Max amount limit can expand to since last interaction\\n // userBorrow_ needs to be atleast 1e73 to overflow max limit of ~1e77 in uint256 (no token in existence where this is possible).\\n maxExpansionLimit_ = ((userBorrow_ * temp_) / FOUR_DECIMALS);\\n\\n // calculate max borrow limit: Max point limit can increase to since last interaction\\n maxExpandedBorrowLimit_ = userBorrow_ + maxExpansionLimit_;\\n }\\n\\n // currentBorrowLimit_ = extract base borrow limit\\n currentBorrowLimit_ = (userBorrowData_ >> LiquiditySlotsLink.BITS_USER_BORROW_BASE_BORROW_LIMIT) & X18;\\n currentBorrowLimit_ =\\n (currentBorrowLimit_ >> DEFAULT_EXPONENT_SIZE) <<\\n (currentBorrowLimit_ & DEFAULT_EXPONENT_MASK);\\n\\n if (maxExpandedBorrowLimit_ < currentBorrowLimit_) {\\n return currentBorrowLimit_;\\n }\\n // time elapsed since last borrow limit was set (in seconds)\\n unchecked {\\n // temp_ = timeElapsed_ (last timestamp can not be > current timestamp)\\n temp_ =\\n block.timestamp -\\n ((userBorrowData_ >> LiquiditySlotsLink.BITS_USER_BORROW_LAST_UPDATE_TIMESTAMP) & X33); // extract last update timestamp\\n }\\n\\n // currentBorrowLimit_ = expandedBorrowableAmount + extract last set borrow limit\\n currentBorrowLimit_ =\\n // calculate borrow limit expansion since last interaction for `expandPercent` that is elapsed of `expandDuration`.\\n // divisor is extract expand duration (after this, full expansion to expandPercentage happened).\\n ((maxExpansionLimit_ * temp_) /\\n ((userBorrowData_ >> LiquiditySlotsLink.BITS_USER_BORROW_EXPAND_DURATION) & X24)) + // expand duration can never be 0\\n // extract last set borrow limit\\n BigMathMinified.fromBigNumber(\\n (userBorrowData_ >> LiquiditySlotsLink.BITS_USER_BORROW_PREVIOUS_BORROW_LIMIT) & X64,\\n DEFAULT_EXPONENT_SIZE,\\n DEFAULT_EXPONENT_MASK\\n );\\n\\n // if timeElapsed is bigger than expandDuration, new borrow limit would be > max expansion,\\n // so set to `maxExpandedBorrowLimit_` in that case.\\n // also covers the case where last process timestamp = 0 (timeElapsed would simply be very big)\\n if (currentBorrowLimit_ > maxExpandedBorrowLimit_) {\\n currentBorrowLimit_ = maxExpandedBorrowLimit_;\\n }\\n // temp_ = extract hard max borrow limit. Above this user can never borrow (not expandable above)\\n temp_ = (userBorrowData_ >> LiquiditySlotsLink.BITS_USER_BORROW_MAX_BORROW_LIMIT) & X18;\\n temp_ = (temp_ >> DEFAULT_EXPONENT_SIZE) << (temp_ & DEFAULT_EXPONENT_MASK);\\n\\n if (currentBorrowLimit_ > temp_) {\\n currentBorrowLimit_ = temp_;\\n }\\n }\\n\\n /// @dev calculates borrow limit after an operate execution:\\n /// total amount user borrow can reach (not borrowable amount in current operation).\\n /// i.e. if user has borrowed 50M and can still borrow 5M, this method returns the total 55M, not the borrowable amount 5M\\n /// @param userBorrowData_ user borrow data packed uint256 from storage\\n /// @param userBorrow_ current user borrow amount already extracted from `userBorrowData_` and added / subtracted with the executed operate amount\\n /// @param newBorrowLimit_ current borrow limit updated for expansion since last interaction, result from `calcBorrowLimitBeforeOperate`\\n /// @return borrowLimit_ updated borrow limit that should be written to storage.\\n /// returned value is in raw for with interest mode, normal amount for interest free mode!\\n function calcBorrowLimitAfterOperate(\\n uint256 userBorrowData_,\\n uint256 userBorrow_,\\n uint256 newBorrowLimit_\\n ) internal pure returns (uint256 borrowLimit_) {\\n // temp_ = extract borrow expand percent\\n uint256 temp_ = (userBorrowData_ >> LiquiditySlotsLink.BITS_USER_BORROW_EXPAND_PERCENT) & X14; // (is in 1e2 decimals)\\n\\n unchecked {\\n // borrowLimit_ = calculate maximum borrow limit at full expansion.\\n // userBorrow_ needs to be at least 1e73 to overflow max limit of ~1e77 in uint256 (no token in existence where this is possible).\\n borrowLimit_ = userBorrow_ + ((userBorrow_ * temp_) / FOUR_DECIMALS);\\n }\\n\\n // temp_ = extract base borrow limit\\n temp_ = (userBorrowData_ >> LiquiditySlotsLink.BITS_USER_BORROW_BASE_BORROW_LIMIT) & X18;\\n temp_ = (temp_ >> DEFAULT_EXPONENT_SIZE) << (temp_ & DEFAULT_EXPONENT_MASK);\\n\\n if (borrowLimit_ < temp_) {\\n // below base limit, borrow limit is always base limit\\n return temp_;\\n }\\n // temp_ = extract hard max borrow limit. Above this user can never borrow (not expandable above)\\n temp_ = (userBorrowData_ >> LiquiditySlotsLink.BITS_USER_BORROW_MAX_BORROW_LIMIT) & X18;\\n temp_ = (temp_ >> DEFAULT_EXPONENT_SIZE) << (temp_ & DEFAULT_EXPONENT_MASK);\\n\\n // make sure fully expanded borrow limit is not above hard max borrow limit\\n if (borrowLimit_ > temp_) {\\n borrowLimit_ = temp_;\\n }\\n // if new borrow limit (from before operate) is > max borrow limit, set max borrow limit.\\n // (e.g. on a repay shrinking instantly to fully expanded borrow limit from new borrow amount. shrinking is instant)\\n if (newBorrowLimit_ > borrowLimit_) {\\n return borrowLimit_;\\n }\\n return newBorrowLimit_;\\n }\\n\\n ///////////////////////////////////////////////////////////////////////////\\n ////////// CALC RATES /////////\\n ///////////////////////////////////////////////////////////////////////////\\n\\n /// @dev Calculates new borrow rate from utilization for a token\\n /// @param rateData_ rate data packed uint256 from storage for the token\\n /// @param utilization_ totalBorrow / totalSupply. 1e4 = 100% utilization\\n /// @return rate_ rate for that particular token in 1e2 precision (e.g. 5% rate = 500)\\n function calcBorrowRateFromUtilization(uint256 rateData_, uint256 utilization_) internal returns (uint256 rate_) {\\n // extract rate version: 4 bits (0xF) starting from bit 0\\n uint256 rateVersion_ = (rateData_ & 0xF);\\n\\n if (rateVersion_ == 1) {\\n rate_ = calcRateV1(rateData_, utilization_);\\n } else if (rateVersion_ == 2) {\\n rate_ = calcRateV2(rateData_, utilization_);\\n } else {\\n revert FluidLiquidityCalcsError(ErrorTypes.LiquidityCalcs__UnsupportedRateVersion);\\n }\\n\\n if (rate_ > X16) {\\n // hard cap for borrow rate at maximum value 16 bits (65535) to make sure it does not overflow storage space.\\n // this is unlikely to ever happen if configs stay within expected levels.\\n rate_ = X16;\\n // emit event to more easily become aware\\n emit BorrowRateMaxCap();\\n }\\n }\\n\\n /// @dev calculates the borrow rate based on utilization for rate data version 1 (with one kink) in 1e2 precision\\n /// @param rateData_ rate data packed uint256 from storage for the token\\n /// @param utilization_ in 1e2 (100% = 1e4)\\n /// @return rate_ rate in 1e2 precision\\n function calcRateV1(uint256 rateData_, uint256 utilization_) internal pure returns (uint256 rate_) {\\n /// For rate v1 (one kink) ------------------------------------------------------\\n /// Next 16 bits => 4 - 19 => Rate at utilization 0% (in 1e2: 100% = 10_000; 1% = 100 -> max value 65535)\\n /// Next 16 bits => 20- 35 => Utilization at kink1 (in 1e2: 100% = 10_000; 1% = 100 -> max value 65535)\\n /// Next 16 bits => 36- 51 => Rate at utilization kink1 (in 1e2: 100% = 10_000; 1% = 100 -> max value 65535)\\n /// Next 16 bits => 52- 67 => Rate at utilization 100% (in 1e2: 100% = 10_000; 1% = 100 -> max value 65535)\\n /// Last 188 bits => 68-255 => blank, might come in use in future\\n\\n // y = mx + c.\\n // y is borrow rate\\n // x is utilization\\n // m = slope (m can also be negative for declining rates)\\n // c is constant (c can be negative)\\n\\n uint256 y1_;\\n uint256 y2_;\\n uint256 x1_;\\n uint256 x2_;\\n\\n // extract kink1: 16 bits (0xFFFF) starting from bit 20\\n // kink is in 1e2, same as utilization, so no conversion needed for direct comparison of the two\\n uint256 kink1_ = (rateData_ >> LiquiditySlotsLink.BITS_RATE_DATA_V1_UTILIZATION_AT_KINK) & X16;\\n if (utilization_ < kink1_) {\\n // if utilization is less than kink\\n y1_ = (rateData_ >> LiquiditySlotsLink.BITS_RATE_DATA_V1_RATE_AT_UTILIZATION_ZERO) & X16;\\n y2_ = (rateData_ >> LiquiditySlotsLink.BITS_RATE_DATA_V1_RATE_AT_UTILIZATION_KINK) & X16;\\n x1_ = 0; // 0%\\n x2_ = kink1_;\\n } else {\\n // else utilization is greater than kink\\n y1_ = (rateData_ >> LiquiditySlotsLink.BITS_RATE_DATA_V1_RATE_AT_UTILIZATION_KINK) & X16;\\n y2_ = (rateData_ >> LiquiditySlotsLink.BITS_RATE_DATA_V1_RATE_AT_UTILIZATION_MAX) & X16;\\n x1_ = kink1_;\\n x2_ = FOUR_DECIMALS; // 100%\\n }\\n\\n int256 constant_;\\n int256 slope_;\\n unchecked {\\n // calculating slope with twelve decimal precision. m = (y2 - y1) / (x2 - x1).\\n // utilization of x2 can not be <= utilization of x1 (so no underflow or 0 divisor)\\n // y is in 1e2 so can not overflow when multiplied with TWELVE_DECIMALS\\n slope_ = (int256(y2_ - y1_) * int256(TWELVE_DECIMALS)) / int256((x2_ - x1_));\\n\\n // calculating constant at 12 decimal precision. slope is already in 12 decimal hence only multiple with y1. c = y - mx.\\n // maximum y1_ value is 65535. 65535 * 1e12 can not overflow int256\\n // maximum slope is 65535 - 0 * TWELVE_DECIMALS / 1 = 65535 * 1e12;\\n // maximum x1_ is 100% (9_999 actually) => slope_ * x1_ can not overflow int256\\n // subtraction most extreme case would be 0 - max value slope_ * x1_ => can not underflow int256\\n constant_ = int256(y1_ * TWELVE_DECIMALS) - (slope_ * int256(x1_));\\n\\n // calculating new borrow rate\\n // - slope_ max value is 65535 * 1e12,\\n // - utilization max value is let's say 500% (extreme case where borrow rate increases borrow amount without new supply)\\n // - constant max value is 65535 * 1e12\\n // so max values are 65535 * 1e12 * 50_000 + 65535 * 1e12 -> 3.2768*10^21, which easily fits int256\\n // divisor TWELVE_DECIMALS can not be 0\\n slope_ = (slope_ * int256(utilization_)) + constant_; // reusing `slope_` as variable for gas savings\\n if (slope_ < 0) {\\n revert FluidLiquidityCalcsError(ErrorTypes.LiquidityCalcs__BorrowRateNegative);\\n }\\n rate_ = uint256(slope_) / TWELVE_DECIMALS;\\n }\\n }\\n\\n /// @dev calculates the borrow rate based on utilization for rate data version 2 (with two kinks) in 1e4 precision\\n /// @param rateData_ rate data packed uint256 from storage for the token\\n /// @param utilization_ in 1e2 (100% = 1e4)\\n /// @return rate_ rate in 1e4 precision\\n function calcRateV2(uint256 rateData_, uint256 utilization_) internal pure returns (uint256 rate_) {\\n /// For rate v2 (two kinks) -----------------------------------------------------\\n /// Next 16 bits => 4 - 19 => Rate at utilization 0% (in 1e2: 100% = 10_000; 1% = 100 -> max value 65535)\\n /// Next 16 bits => 20- 35 => Utilization at kink1 (in 1e2: 100% = 10_000; 1% = 100 -> max value 65535)\\n /// Next 16 bits => 36- 51 => Rate at utilization kink1 (in 1e2: 100% = 10_000; 1% = 100 -> max value 65535)\\n /// Next 16 bits => 52- 67 => Utilization at kink2 (in 1e2: 100% = 10_000; 1% = 100 -> max value 65535)\\n /// Next 16 bits => 68- 83 => Rate at utilization kink2 (in 1e2: 100% = 10_000; 1% = 100 -> max value 65535)\\n /// Next 16 bits => 84- 99 => Rate at utilization 100% (in 1e2: 100% = 10_000; 1% = 100 -> max value 65535)\\n /// Last 156 bits => 100-255 => blank, might come in use in future\\n\\n // y = mx + c.\\n // y is borrow rate\\n // x is utilization\\n // m = slope (m can also be negative for declining rates)\\n // c is constant (c can be negative)\\n\\n uint256 y1_;\\n uint256 y2_;\\n uint256 x1_;\\n uint256 x2_;\\n\\n // extract kink1: 16 bits (0xFFFF) starting from bit 20\\n // kink is in 1e2, same as utilization, so no conversion needed for direct comparison of the two\\n uint256 kink1_ = (rateData_ >> LiquiditySlotsLink.BITS_RATE_DATA_V2_UTILIZATION_AT_KINK1) & X16;\\n if (utilization_ < kink1_) {\\n // if utilization is less than kink1\\n y1_ = (rateData_ >> LiquiditySlotsLink.BITS_RATE_DATA_V2_RATE_AT_UTILIZATION_ZERO) & X16;\\n y2_ = (rateData_ >> LiquiditySlotsLink.BITS_RATE_DATA_V2_RATE_AT_UTILIZATION_KINK1) & X16;\\n x1_ = 0; // 0%\\n x2_ = kink1_;\\n } else {\\n // extract kink2: 16 bits (0xFFFF) starting from bit 52\\n uint256 kink2_ = (rateData_ >> LiquiditySlotsLink.BITS_RATE_DATA_V2_UTILIZATION_AT_KINK2) & X16;\\n if (utilization_ < kink2_) {\\n // if utilization is less than kink2\\n y1_ = (rateData_ >> LiquiditySlotsLink.BITS_RATE_DATA_V2_RATE_AT_UTILIZATION_KINK1) & X16;\\n y2_ = (rateData_ >> LiquiditySlotsLink.BITS_RATE_DATA_V2_RATE_AT_UTILIZATION_KINK2) & X16;\\n x1_ = kink1_;\\n x2_ = kink2_;\\n } else {\\n // else utilization is greater than kink2\\n y1_ = (rateData_ >> LiquiditySlotsLink.BITS_RATE_DATA_V2_RATE_AT_UTILIZATION_KINK2) & X16;\\n y2_ = (rateData_ >> LiquiditySlotsLink.BITS_RATE_DATA_V2_RATE_AT_UTILIZATION_MAX) & X16;\\n x1_ = kink2_;\\n x2_ = FOUR_DECIMALS;\\n }\\n }\\n\\n int256 constant_;\\n int256 slope_;\\n unchecked {\\n // calculating slope with twelve decimal precision. m = (y2 - y1) / (x2 - x1).\\n // utilization of x2 can not be <= utilization of x1 (so no underflow or 0 divisor)\\n // y is in 1e2 so can not overflow when multiplied with TWELVE_DECIMALS\\n slope_ = (int256(y2_ - y1_) * int256(TWELVE_DECIMALS)) / int256((x2_ - x1_));\\n\\n // calculating constant at 12 decimal precision. slope is already in 12 decimal hence only multiple with y1. c = y - mx.\\n // maximum y1_ value is 65535. 65535 * 1e12 can not overflow int256\\n // maximum slope is 65535 - 0 * TWELVE_DECIMALS / 1 = 65535 * 1e12;\\n // maximum x1_ is 100% (9_999 actually) => slope_ * x1_ can not overflow int256\\n // subtraction most extreme case would be 0 - max value slope_ * x1_ => can not underflow int256\\n constant_ = int256(y1_ * TWELVE_DECIMALS) - (slope_ * int256(x1_));\\n\\n // calculating new borrow rate\\n // - slope_ max value is 65535 * 1e12,\\n // - utilization max value is let's say 500% (extreme case where borrow rate increases borrow amount without new supply)\\n // - constant max value is 65535 * 1e12\\n // so max values are 65535 * 1e12 * 50_000 + 65535 * 1e12 -> 3.2768*10^21, which easily fits int256\\n // divisor TWELVE_DECIMALS can not be 0\\n slope_ = (slope_ * int256(utilization_)) + constant_; // reusing `slope_` as variable for gas savings\\n if (slope_ < 0) {\\n revert FluidLiquidityCalcsError(ErrorTypes.LiquidityCalcs__BorrowRateNegative);\\n }\\n rate_ = uint256(slope_) / TWELVE_DECIMALS;\\n }\\n }\\n\\n /// @dev reads the total supply out of Liquidity packed storage `totalAmounts_` for `supplyExchangePrice_`\\n function getTotalSupply(\\n uint256 totalAmounts_,\\n uint256 supplyExchangePrice_\\n ) internal pure returns (uint256 totalSupply_) {\\n // totalSupply_ => supplyInterestFree\\n totalSupply_ = (totalAmounts_ >> LiquiditySlotsLink.BITS_TOTAL_AMOUNTS_SUPPLY_INTEREST_FREE) & X64;\\n totalSupply_ = (totalSupply_ >> DEFAULT_EXPONENT_SIZE) << (totalSupply_ & DEFAULT_EXPONENT_MASK);\\n\\n uint256 totalSupplyRaw_ = totalAmounts_ & X64; // no shifting as supplyRaw is first 64 bits\\n totalSupplyRaw_ = (totalSupplyRaw_ >> DEFAULT_EXPONENT_SIZE) << (totalSupplyRaw_ & DEFAULT_EXPONENT_MASK);\\n\\n // totalSupply = supplyInterestFree + supplyRawInterest normalized from raw\\n totalSupply_ += ((totalSupplyRaw_ * supplyExchangePrice_) / EXCHANGE_PRICES_PRECISION);\\n }\\n\\n /// @dev reads the total borrow out of Liquidity packed storage `totalAmounts_` for `borrowExchangePrice_`\\n function getTotalBorrow(\\n uint256 totalAmounts_,\\n uint256 borrowExchangePrice_\\n ) internal pure returns (uint256 totalBorrow_) {\\n // totalBorrow_ => borrowInterestFree\\n // no & mask needed for borrow interest free as it occupies the last bits in the storage slot\\n totalBorrow_ = (totalAmounts_ >> LiquiditySlotsLink.BITS_TOTAL_AMOUNTS_BORROW_INTEREST_FREE);\\n totalBorrow_ = (totalBorrow_ >> DEFAULT_EXPONENT_SIZE) << (totalBorrow_ & DEFAULT_EXPONENT_MASK);\\n\\n uint256 totalBorrowRaw_ = (totalAmounts_ >> LiquiditySlotsLink.BITS_TOTAL_AMOUNTS_BORROW_WITH_INTEREST) & X64;\\n totalBorrowRaw_ = (totalBorrowRaw_ >> DEFAULT_EXPONENT_SIZE) << (totalBorrowRaw_ & DEFAULT_EXPONENT_MASK);\\n\\n // totalBorrow = borrowInterestFree + borrowRawInterest normalized from raw\\n totalBorrow_ += ((totalBorrowRaw_ * borrowExchangePrice_) / EXCHANGE_PRICES_PRECISION);\\n }\\n}\\n\",\"keccak256\":\"0xa65e2f84b2c33769ceb6b28fbd3221be29da2f8ac96e4d8b8cea91948d81a707\",\"license\":\"BUSL-1.1\"},\"contracts/libraries/liquiditySlotsLink.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity 0.8.21;\\n\\n/// @notice library that helps in reading / working with storage slot data of Fluid Liquidity.\\n/// @dev as all data for Fluid Liquidity is internal, any data must be fetched directly through manual\\n/// slot reading through this library or, if gas usage is less important, through the FluidLiquidityResolver.\\nlibrary LiquiditySlotsLink {\\n /// @dev storage slot for status at Liquidity\\n uint256 internal constant LIQUIDITY_STATUS_SLOT = 1;\\n /// @dev storage slot for auths mapping at Liquidity\\n uint256 internal constant LIQUIDITY_AUTHS_MAPPING_SLOT = 2;\\n /// @dev storage slot for guardians mapping at Liquidity\\n uint256 internal constant LIQUIDITY_GUARDIANS_MAPPING_SLOT = 3;\\n /// @dev storage slot for user class mapping at Liquidity\\n uint256 internal constant LIQUIDITY_USER_CLASS_MAPPING_SLOT = 4;\\n /// @dev storage slot for exchangePricesAndConfig mapping at Liquidity\\n uint256 internal constant LIQUIDITY_EXCHANGE_PRICES_MAPPING_SLOT = 5;\\n /// @dev storage slot for rateData mapping at Liquidity\\n uint256 internal constant LIQUIDITY_RATE_DATA_MAPPING_SLOT = 6;\\n /// @dev storage slot for totalAmounts mapping at Liquidity\\n uint256 internal constant LIQUIDITY_TOTAL_AMOUNTS_MAPPING_SLOT = 7;\\n /// @dev storage slot for user supply double mapping at Liquidity\\n uint256 internal constant LIQUIDITY_USER_SUPPLY_DOUBLE_MAPPING_SLOT = 8;\\n /// @dev storage slot for user borrow double mapping at Liquidity\\n uint256 internal constant LIQUIDITY_USER_BORROW_DOUBLE_MAPPING_SLOT = 9;\\n /// @dev storage slot for listed tokens array at Liquidity\\n uint256 internal constant LIQUIDITY_LISTED_TOKENS_ARRAY_SLOT = 10;\\n /// @dev storage slot for listed tokens array at Liquidity\\n uint256 internal constant LIQUIDITY_CONFIGS2_MAPPING_SLOT = 11;\\n\\n // --------------------------------\\n // @dev stacked uint256 storage slots bits position data for each:\\n\\n // ExchangePricesAndConfig\\n uint256 internal constant BITS_EXCHANGE_PRICES_BORROW_RATE = 0;\\n uint256 internal constant BITS_EXCHANGE_PRICES_FEE = 16;\\n uint256 internal constant BITS_EXCHANGE_PRICES_UTILIZATION = 30;\\n uint256 internal constant BITS_EXCHANGE_PRICES_UPDATE_THRESHOLD = 44;\\n uint256 internal constant BITS_EXCHANGE_PRICES_LAST_TIMESTAMP = 58;\\n uint256 internal constant BITS_EXCHANGE_PRICES_SUPPLY_EXCHANGE_PRICE = 91;\\n uint256 internal constant BITS_EXCHANGE_PRICES_BORROW_EXCHANGE_PRICE = 155;\\n uint256 internal constant BITS_EXCHANGE_PRICES_SUPPLY_RATIO = 219;\\n uint256 internal constant BITS_EXCHANGE_PRICES_BORROW_RATIO = 234;\\n uint256 internal constant BITS_EXCHANGE_PRICES_USES_CONFIGS2 = 249;\\n\\n // RateData:\\n uint256 internal constant BITS_RATE_DATA_VERSION = 0;\\n // RateData: V1\\n uint256 internal constant BITS_RATE_DATA_V1_RATE_AT_UTILIZATION_ZERO = 4;\\n uint256 internal constant BITS_RATE_DATA_V1_UTILIZATION_AT_KINK = 20;\\n uint256 internal constant BITS_RATE_DATA_V1_RATE_AT_UTILIZATION_KINK = 36;\\n uint256 internal constant BITS_RATE_DATA_V1_RATE_AT_UTILIZATION_MAX = 52;\\n // RateData: V2\\n uint256 internal constant BITS_RATE_DATA_V2_RATE_AT_UTILIZATION_ZERO = 4;\\n uint256 internal constant BITS_RATE_DATA_V2_UTILIZATION_AT_KINK1 = 20;\\n uint256 internal constant BITS_RATE_DATA_V2_RATE_AT_UTILIZATION_KINK1 = 36;\\n uint256 internal constant BITS_RATE_DATA_V2_UTILIZATION_AT_KINK2 = 52;\\n uint256 internal constant BITS_RATE_DATA_V2_RATE_AT_UTILIZATION_KINK2 = 68;\\n uint256 internal constant BITS_RATE_DATA_V2_RATE_AT_UTILIZATION_MAX = 84;\\n\\n // TotalAmounts\\n uint256 internal constant BITS_TOTAL_AMOUNTS_SUPPLY_WITH_INTEREST = 0;\\n uint256 internal constant BITS_TOTAL_AMOUNTS_SUPPLY_INTEREST_FREE = 64;\\n uint256 internal constant BITS_TOTAL_AMOUNTS_BORROW_WITH_INTEREST = 128;\\n uint256 internal constant BITS_TOTAL_AMOUNTS_BORROW_INTEREST_FREE = 192;\\n\\n // UserSupplyData\\n uint256 internal constant BITS_USER_SUPPLY_MODE = 0;\\n uint256 internal constant BITS_USER_SUPPLY_AMOUNT = 1;\\n uint256 internal constant BITS_USER_SUPPLY_PREVIOUS_WITHDRAWAL_LIMIT = 65;\\n uint256 internal constant BITS_USER_SUPPLY_LAST_UPDATE_TIMESTAMP = 129;\\n uint256 internal constant BITS_USER_SUPPLY_EXPAND_PERCENT = 162;\\n uint256 internal constant BITS_USER_SUPPLY_EXPAND_DURATION = 176;\\n uint256 internal constant BITS_USER_SUPPLY_BASE_WITHDRAWAL_LIMIT = 200;\\n uint256 internal constant BITS_USER_SUPPLY_IS_PAUSED = 255;\\n\\n // UserBorrowData\\n uint256 internal constant BITS_USER_BORROW_MODE = 0;\\n uint256 internal constant BITS_USER_BORROW_AMOUNT = 1;\\n uint256 internal constant BITS_USER_BORROW_PREVIOUS_BORROW_LIMIT = 65;\\n uint256 internal constant BITS_USER_BORROW_LAST_UPDATE_TIMESTAMP = 129;\\n uint256 internal constant BITS_USER_BORROW_EXPAND_PERCENT = 162;\\n uint256 internal constant BITS_USER_BORROW_EXPAND_DURATION = 176;\\n uint256 internal constant BITS_USER_BORROW_BASE_BORROW_LIMIT = 200;\\n uint256 internal constant BITS_USER_BORROW_MAX_BORROW_LIMIT = 218;\\n uint256 internal constant BITS_USER_BORROW_IS_PAUSED = 255;\\n\\n // Configs2\\n uint256 internal constant BITS_CONFIGS2_MAX_UTILIZATION = 0;\\n\\n // --------------------------------\\n\\n /// @notice Calculating the slot ID for Liquidity contract for single mapping at `slot_` for `key_`\\n function calculateMappingStorageSlot(uint256 slot_, address key_) internal pure returns (bytes32) {\\n return keccak256(abi.encode(key_, slot_));\\n }\\n\\n /// @notice Calculating the slot ID for Liquidity contract for double mapping at `slot_` for `key1_` and `key2_`\\n function calculateDoubleMappingStorageSlot(\\n uint256 slot_,\\n address key1_,\\n address key2_\\n ) internal pure returns (bytes32) {\\n bytes32 intermediateSlot_ = keccak256(abi.encode(key1_, slot_));\\n return keccak256(abi.encode(key2_, intermediateSlot_));\\n }\\n}\\n\",\"keccak256\":\"0x0ae3e1d231bb6c14b54fc1f5ffa306edc0ac827a6a92279c77c0c09627fe08ae\",\"license\":\"BUSL-1.1\"},\"contracts/libraries/safeTransfer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT OR Apache-2.0\\npragma solidity 0.8.21;\\n\\nimport { LibsErrorTypes as ErrorTypes } from \\\"./errorTypes.sol\\\";\\n\\n/// @notice provides minimalistic methods for safe transfers, e.g. ERC20 safeTransferFrom\\nlibrary SafeTransfer {\\n error FluidSafeTransferError(uint256 errorId_);\\n\\n /// @dev Transfer `amount_` of `token_` from `from_` to `to_`, spending the approval given by `from_` to the\\n /// calling contract. If `token_` returns no value, non-reverting calls are assumed to be successful.\\n /// Minimally modified from Solmate SafeTransferLib (address as input param for token, Custom Error):\\n /// https://github.com/transmissions11/solmate/blob/50e15bb566f98b7174da9b0066126a4c3e75e0fd/src/utils/SafeTransferLib.sol#L31-L63\\n function safeTransferFrom(address token_, address from_, address to_, uint256 amount_) internal {\\n bool success_;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n // Get a pointer to some free memory.\\n let freeMemoryPointer := mload(0x40)\\n\\n // Write the abi-encoded calldata into memory, beginning with the function selector.\\n mstore(freeMemoryPointer, 0x23b872dd00000000000000000000000000000000000000000000000000000000)\\n mstore(add(freeMemoryPointer, 4), and(from_, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the \\\"from_\\\" argument.\\n mstore(add(freeMemoryPointer, 36), and(to_, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the \\\"to_\\\" argument.\\n mstore(add(freeMemoryPointer, 68), amount_) // Append the \\\"amount_\\\" argument. Masking not required as it's a full 32 byte type.\\n\\n success_ := and(\\n // Set success to whether the call reverted, if not we check it either\\n // returned exactly 1 (can't just be non-zero data), or had no return data.\\n or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),\\n // We use 100 because the length of our calldata totals up like so: 4 + 32 * 3.\\n // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.\\n // Counterintuitively, this call must be positioned second to the or() call in the\\n // surrounding and() call or else returndatasize() will be zero during the computation.\\n call(gas(), token_, 0, freeMemoryPointer, 100, 0, 32)\\n )\\n }\\n\\n if (!success_) {\\n revert FluidSafeTransferError(ErrorTypes.SafeTransfer__TransferFromFailed);\\n }\\n }\\n\\n /// @dev Transfer `amount_` of `token_` to `to_`.\\n /// If `token_` returns no value, non-reverting calls are assumed to be successful.\\n /// Minimally modified from Solmate SafeTransferLib (address as input param for token, Custom Error):\\n /// https://github.com/transmissions11/solmate/blob/50e15bb566f98b7174da9b0066126a4c3e75e0fd/src/utils/SafeTransferLib.sol#L65-L95\\n function safeTransfer(address token_, address to_, uint256 amount_) internal {\\n bool success_;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n // Get a pointer to some free memory.\\n let freeMemoryPointer := mload(0x40)\\n\\n // Write the abi-encoded calldata into memory, beginning with the function selector.\\n mstore(freeMemoryPointer, 0xa9059cbb00000000000000000000000000000000000000000000000000000000)\\n mstore(add(freeMemoryPointer, 4), and(to_, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the \\\"to_\\\" argument.\\n mstore(add(freeMemoryPointer, 36), amount_) // Append the \\\"amount_\\\" argument. Masking not required as it's a full 32 byte type.\\n\\n success_ := and(\\n // Set success to whether the call reverted, if not we check it either\\n // returned exactly 1 (can't just be non-zero data), or had no return data.\\n or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),\\n // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.\\n // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.\\n // Counterintuitively, this call must be positioned second to the or() call in the\\n // surrounding and() call or else returndatasize() will be zero during the computation.\\n call(gas(), token_, 0, freeMemoryPointer, 68, 0, 32)\\n )\\n }\\n\\n if (!success_) {\\n revert FluidSafeTransferError(ErrorTypes.SafeTransfer__TransferFailed);\\n }\\n }\\n\\n /// @dev Transfer `amount_` of ` native token to `to_`.\\n /// Minimally modified from Solmate SafeTransferLib (Custom Error):\\n /// https://github.com/transmissions11/solmate/blob/50e15bb566f98b7174da9b0066126a4c3e75e0fd/src/utils/SafeTransferLib.sol#L15-L25\\n function safeTransferNative(address to_, uint256 amount_) internal {\\n bool success_;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n // Transfer the ETH and store if it succeeded or not.\\n success_ := call(gas(), to_, amount_, 0, 0, 0, 0)\\n }\\n\\n if (!success_) {\\n revert FluidSafeTransferError(ErrorTypes.SafeTransfer__TransferFailed);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x7069d5801ef91035c666e05f11ccccdad310bbfc8f75b390cf44f69ff39d180d\",\"license\":\"MIT OR Apache-2.0\"},\"contracts/libraries/tickMath.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity 0.8.21;\\n\\n/// @title library that calculates number \\\"tick\\\" and \\\"ratioX96\\\" from this: ratioX96 = (1.0015^tick) * 2^96\\n/// @notice this library is used in Fluid Vault protocol for optimiziation.\\n/// @dev \\\"tick\\\" supports between -32767 and 32767. \\\"ratioX96\\\" supports between 37075072 and 169307877264527972847801929085841449095838922544595\\nlibrary TickMath {\\n /// The minimum tick that can be passed in getRatioAtTick. 1.0015**-32767\\n int24 internal constant MIN_TICK = -32767;\\n /// The maximum tick that can be passed in getRatioAtTick. 1.0015**32767\\n int24 internal constant MAX_TICK = 32767;\\n\\n uint256 internal constant FACTOR00 = 0x100000000000000000000000000000000;\\n uint256 internal constant FACTOR01 = 0xff9dd7de423466c20352b1246ce4856f; // 2^128/1.0015**1 = 339772707859149738855091969477551883631\\n uint256 internal constant FACTOR02 = 0xff3bd55f4488ad277531fa1c725a66d0; // 2^128/1.0015**2 = 339263812140938331358054887146831636176\\n uint256 internal constant FACTOR03 = 0xfe78410fd6498b73cb96a6917f853259; // 2^128/1.0015**4 = 338248306163758188337119769319392490073\\n uint256 internal constant FACTOR04 = 0xfcf2d9987c9be178ad5bfeffaa123273; // 2^128/1.0015**8 = 336226404141693512316971918999264834163\\n uint256 internal constant FACTOR05 = 0xf9ef02c4529258b057769680fc6601b3; // 2^128/1.0015**16 = 332218786018727629051611634067491389875\\n uint256 internal constant FACTOR06 = 0xf402d288133a85a17784a411f7aba082; // 2^128/1.0015**32 = 324346285652234375371948336458280706178\\n uint256 internal constant FACTOR07 = 0xe895615b5beb6386553757b0352bda90; // 2^128/1.0015**64 = 309156521885964218294057947947195947664\\n uint256 internal constant FACTOR08 = 0xd34f17a00ffa00a8309940a15930391a; // 2^128/1.0015**128 = 280877777739312896540849703637713172762 \\n uint256 internal constant FACTOR09 = 0xae6b7961714e20548d88ea5123f9a0ff; // 2^128/1.0015**256 = 231843708922198649176471782639349113087\\n uint256 internal constant FACTOR10 = 0x76d6461f27082d74e0feed3b388c0ca1; // 2^128/1.0015**512 = 157961477267171621126394973980180876449\\n uint256 internal constant FACTOR11 = 0x372a3bfe0745d8b6b19d985d9a8b85bb; // 2^128/1.0015**1024 = 73326833024599564193373530205717235131\\n uint256 internal constant FACTOR12 = 0x0be32cbee48979763cf7247dd7bb539d; // 2^128/1.0015**2048 = 15801066890623697521348224657638773661\\n uint256 internal constant FACTOR13 = 0x8d4f70c9ff4924dac37612d1e2921e; // 2^128/1.0015**4096 = 733725103481409245883800626999235102\\n uint256 internal constant FACTOR14 = 0x4e009ae5519380809a02ca7aec77; // 2^128/1.0015**8192 = 1582075887005588088019997442108535\\n uint256 internal constant FACTOR15 = 0x17c45e641b6e95dee056ff10; // 2^128/1.0015**16384 = 7355550435635883087458926352\\n\\n /// The minimum value that can be returned from getRatioAtTick. Equivalent to getRatioAtTick(MIN_TICK). ~ Equivalent to `(1 << 96) * (1.0015**-32767)`\\n uint256 internal constant MIN_RATIOX96 = 37075072;\\n /// The maximum value that can be returned from getRatioAtTick. Equivalent to getRatioAtTick(MAX_TICK).\\n /// ~ Equivalent to `(1 << 96) * (1.0015**32767)`, rounding etc. leading to minor difference\\n uint256 internal constant MAX_RATIOX96 = 169307877264527972847801929085841449095838922544595;\\n\\n uint256 internal constant ZERO_TICK_SCALED_RATIO = 0x1000000000000000000000000; // 1 << 96 // 79228162514264337593543950336\\n uint256 internal constant _1E26 = 1e26;\\n\\n /// @notice ratioX96 = (1.0015^tick) * 2^96\\n /// @dev Throws if |tick| > max tick\\n /// @param tick The input tick for the above formula\\n /// @return ratioX96 ratio = (debt amount/collateral amount)\\n function getRatioAtTick(int tick) internal pure returns (uint256 ratioX96) {\\n assembly {\\n let absTick_ := sub(xor(tick, sar(255, tick)), sar(255, tick))\\n\\n if gt(absTick_, MAX_TICK) {\\n revert(0, 0)\\n }\\n let factor_ := FACTOR00\\n if and(absTick_, 0x1) {\\n factor_ := FACTOR01\\n }\\n if and(absTick_, 0x2) {\\n factor_ := shr(128, mul(factor_, FACTOR02))\\n }\\n if and(absTick_, 0x4) {\\n factor_ := shr(128, mul(factor_, FACTOR03))\\n }\\n if and(absTick_, 0x8) {\\n factor_ := shr(128, mul(factor_, FACTOR04))\\n }\\n if and(absTick_, 0x10) {\\n factor_ := shr(128, mul(factor_, FACTOR05))\\n }\\n if and(absTick_, 0x20) {\\n factor_ := shr(128, mul(factor_, FACTOR06))\\n }\\n if and(absTick_, 0x40) {\\n factor_ := shr(128, mul(factor_, FACTOR07))\\n }\\n if and(absTick_, 0x80) {\\n factor_ := shr(128, mul(factor_, FACTOR08))\\n }\\n if and(absTick_, 0x100) {\\n factor_ := shr(128, mul(factor_, FACTOR09))\\n }\\n if and(absTick_, 0x200) {\\n factor_ := shr(128, mul(factor_, FACTOR10))\\n }\\n if and(absTick_, 0x400) {\\n factor_ := shr(128, mul(factor_, FACTOR11))\\n }\\n if and(absTick_, 0x800) {\\n factor_ := shr(128, mul(factor_, FACTOR12))\\n }\\n if and(absTick_, 0x1000) {\\n factor_ := shr(128, mul(factor_, FACTOR13))\\n }\\n if and(absTick_, 0x2000) {\\n factor_ := shr(128, mul(factor_, FACTOR14))\\n }\\n if and(absTick_, 0x4000) {\\n factor_ := shr(128, mul(factor_, FACTOR15))\\n }\\n\\n let precision_ := 0\\n if iszero(and(tick, 0x8000000000000000000000000000000000000000000000000000000000000000)) {\\n factor_ := div(0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff, factor_)\\n // we round up in the division so getTickAtRatio of the output price is always consistent\\n if mod(factor_, 0x100000000) {\\n precision_ := 1\\n }\\n }\\n ratioX96 := add(shr(32, factor_), precision_)\\n }\\n }\\n\\n /// @notice ratioX96 = (1.0015^tick) * 2^96\\n /// @dev Throws if ratioX96 > max ratio || ratioX96 < min ratio\\n /// @param ratioX96 The input ratio; ratio = (debt amount/collateral amount)\\n /// @return tick The output tick for the above formula. Returns in round down form. if tick is 123.23 then 123, if tick is -123.23 then returns -124\\n /// @return perfectRatioX96 perfect ratio for the above tick\\n function getTickAtRatio(uint256 ratioX96) internal pure returns (int tick, uint perfectRatioX96) {\\n assembly {\\n if or(gt(ratioX96, MAX_RATIOX96), lt(ratioX96, MIN_RATIOX96)) {\\n revert(0, 0)\\n }\\n\\n let cond := lt(ratioX96, ZERO_TICK_SCALED_RATIO)\\n let factor_\\n\\n if iszero(cond) {\\n // if ratioX96 >= ZERO_TICK_SCALED_RATIO\\n factor_ := div(mul(ratioX96, _1E26), ZERO_TICK_SCALED_RATIO)\\n }\\n if cond {\\n // ratioX96 < ZERO_TICK_SCALED_RATIO\\n factor_ := div(mul(ZERO_TICK_SCALED_RATIO, _1E26), ratioX96)\\n }\\n\\n // put in https://www.wolframalpha.com/ whole equation: (1.0015^tick) * 2^96 * 10^26 / 79228162514264337593543950336\\n\\n // for tick = 16384\\n // ratioX96 = (1.0015^16384) * 2^96 = 3665252098134783297721995888537077351735\\n // 3665252098134783297721995888537077351735 * 10^26 / 79228162514264337593543950336 =\\n // 4626198540796508716348404308345255985.06131964639489434655721\\n if iszero(lt(factor_, 4626198540796508716348404308345255985)) {\\n tick := or(tick, 0x4000)\\n factor_ := div(mul(factor_, _1E26), 4626198540796508716348404308345255985)\\n }\\n // for tick = 8192\\n // ratioX96 = (1.0015^8192) * 2^96 = 17040868196391020479062776466509865\\n // 17040868196391020479062776466509865 * 10^26 / 79228162514264337593543950336 =\\n // 21508599537851153911767490449162.3037648642153898377655505172\\n if iszero(lt(factor_, 21508599537851153911767490449162)) {\\n tick := or(tick, 0x2000)\\n factor_ := div(mul(factor_, _1E26), 21508599537851153911767490449162)\\n }\\n // for tick = 4096\\n // ratioX96 = (1.0015^4096) * 2^96 = 36743933851015821532611831851150\\n // 36743933851015821532611831851150 * 10^26 / 79228162514264337593543950336 =\\n // 46377364670549310883002866648.9777607649742626173648716941385\\n if iszero(lt(factor_, 46377364670549310883002866649)) {\\n tick := or(tick, 0x1000)\\n factor_ := div(mul(factor_, _1E26), 46377364670549310883002866649)\\n }\\n // for tick = 2048\\n // ratioX96 = (1.0015^2048) * 2^96 = 1706210527034005899209104452335\\n // 1706210527034005899209104452335 * 10^26 / 79228162514264337593543950336 =\\n // 2153540449365864845468344760.06357108484096046743300420319322\\n if iszero(lt(factor_, 2153540449365864845468344760)) {\\n tick := or(tick, 0x800)\\n factor_ := div(mul(factor_, _1E26), 2153540449365864845468344760)\\n }\\n // for tick = 1024\\n // ratioX96 = (1.0015^1024) * 2^96 = 367668226692760093024536487236\\n // 367668226692760093024536487236 * 10^26 / 79228162514264337593543950336 =\\n // 464062544207767844008185024.950588990554136265212906454481127\\n if iszero(lt(factor_, 464062544207767844008185025)) {\\n tick := or(tick, 0x400)\\n factor_ := div(mul(factor_, _1E26), 464062544207767844008185025)\\n }\\n // for tick = 512\\n // ratioX96 = (1.0015^512) * 2^96 = 170674186729409605620119663668\\n // 170674186729409605620119663668 * 10^26 / 79228162514264337593543950336 =\\n // 215421109505955298802281577.031879604792139232258508172947569\\n if iszero(lt(factor_, 215421109505955298802281577)) {\\n tick := or(tick, 0x200)\\n factor_ := div(mul(factor_, _1E26), 215421109505955298802281577)\\n }\\n // for tick = 256\\n // ratioX96 = (1.0015^256) * 2^96 = 116285004205991934861656513301\\n // 116285004205991934861656513301 * 10^26 / 79228162514264337593543950336 =\\n // 146772309890508740607270614.667650899656438875541505058062410\\n if iszero(lt(factor_, 146772309890508740607270615)) {\\n tick := or(tick, 0x100)\\n factor_ := div(mul(factor_, _1E26), 146772309890508740607270615)\\n }\\n // for tick = 128\\n // ratioX96 = (1.0015^128) * 2^96 = 95984619659632141743747099590\\n // 95984619659632141743747099590 * 10^26 / 79228162514264337593543950336 =\\n // 121149622323187099817270416.157248837742741760456796835775887\\n if iszero(lt(factor_, 121149622323187099817270416)) {\\n tick := or(tick, 0x80)\\n factor_ := div(mul(factor_, _1E26), 121149622323187099817270416)\\n }\\n // for tick = 64\\n // ratioX96 = (1.0015^64) * 2^96 = 87204845308406958006717891124\\n // 87204845308406958006717891124 * 10^26 / 79228162514264337593543950336 =\\n // 110067989135437147685980801.568068573422377364214113968609839\\n if iszero(lt(factor_, 110067989135437147685980801)) {\\n tick := or(tick, 0x40)\\n factor_ := div(mul(factor_, _1E26), 110067989135437147685980801)\\n }\\n // for tick = 32\\n // ratioX96 = (1.0015^32) * 2^96 = 83120873769022354029916374475\\n // 83120873769022354029916374475 * 10^26 / 79228162514264337593543950336 =\\n // 104913292358707887270979599.831816586773651266562785765558183\\n if iszero(lt(factor_, 104913292358707887270979600)) {\\n tick := or(tick, 0x20)\\n factor_ := div(mul(factor_, _1E26), 104913292358707887270979600)\\n }\\n // for tick = 16\\n // ratioX96 = (1.0015^16) * 2^96 = 81151180492336368327184716176\\n // 81151180492336368327184716176 * 10^26 / 79228162514264337593543950336 =\\n // 102427189924701091191840927.762844039579442328381455567932128\\n if iszero(lt(factor_, 102427189924701091191840928)) {\\n tick := or(tick, 0x10)\\n factor_ := div(mul(factor_, _1E26), 102427189924701091191840928)\\n }\\n // for tick = 8\\n // ratioX96 = (1.0015^8) * 2^96 = 80183906840906820640659903620\\n // 80183906840906820640659903620 * 10^26 / 79228162514264337593543950336 =\\n // 101206318935480056907421312.890625\\n if iszero(lt(factor_, 101206318935480056907421313)) {\\n tick := or(tick, 0x8)\\n factor_ := div(mul(factor_, _1E26), 101206318935480056907421313)\\n }\\n // for tick = 4\\n // ratioX96 = (1.0015^4) * 2^96 = 79704602139525152702959747603\\n // 79704602139525152702959747603 * 10^26 / 79228162514264337593543950336 =\\n // 100601351350506250000000000\\n if iszero(lt(factor_, 100601351350506250000000000)) {\\n tick := or(tick, 0x4)\\n factor_ := div(mul(factor_, _1E26), 100601351350506250000000000)\\n }\\n // for tick = 2\\n // ratioX96 = (1.0015^2) * 2^96 = 79466025265172787701084167660\\n // 79466025265172787701084167660 * 10^26 / 79228162514264337593543950336 =\\n // 100300225000000000000000000\\n if iszero(lt(factor_, 100300225000000000000000000)) {\\n tick := or(tick, 0x2)\\n factor_ := div(mul(factor_, _1E26), 100300225000000000000000000)\\n }\\n // for tick = 1\\n // ratioX96 = (1.0015^1) * 2^96 = 79347004758035734099934266261\\n // 79347004758035734099934266261 * 10^26 / 79228162514264337593543950336 =\\n // 100150000000000000000000000\\n if iszero(lt(factor_, 100150000000000000000000000)) {\\n tick := or(tick, 0x1)\\n factor_ := div(mul(factor_, _1E26), 100150000000000000000000000)\\n }\\n if iszero(cond) {\\n // if ratioX96 >= ZERO_TICK_SCALED_RATIO\\n perfectRatioX96 := div(mul(ratioX96, _1E26), factor_)\\n }\\n if cond {\\n // ratioX96 < ZERO_TICK_SCALED_RATIO\\n tick := not(tick)\\n perfectRatioX96 := div(mul(ratioX96, factor_), 100150000000000000000000000)\\n }\\n // perfect ratio should always be <= ratioX96\\n // not sure if it can ever be bigger but better to have extra checks\\n if gt(perfectRatioX96, ratioX96) {\\n revert(0, 0)\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xc5c13deaa16bb036a4370c0e38c33445712e8e7da1c792018dd3dc4a641ea0c0\",\"license\":\"BUSL-1.1\"},\"contracts/liquidity/adminModule/structs.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity 0.8.21;\\n\\nabstract contract Structs {\\n struct AddressBool {\\n address addr;\\n bool value;\\n }\\n\\n struct AddressUint256 {\\n address addr;\\n uint256 value;\\n }\\n\\n /// @notice struct to set borrow rate data for version 1\\n struct RateDataV1Params {\\n ///\\n /// @param token for rate data\\n address token;\\n ///\\n /// @param kink in borrow rate. in 1e2: 100% = 10_000; 1% = 100\\n /// utilization below kink usually means slow increase in rate, once utilization is above kink borrow rate increases fast\\n uint256 kink;\\n ///\\n /// @param rateAtUtilizationZero desired borrow rate when utilization is zero. in 1e2: 100% = 10_000; 1% = 100\\n /// i.e. constant minimum borrow rate\\n /// e.g. at utilization = 0.01% rate could still be at least 4% (rateAtUtilizationZero would be 400 then)\\n uint256 rateAtUtilizationZero;\\n ///\\n /// @param rateAtUtilizationKink borrow rate when utilization is at kink. in 1e2: 100% = 10_000; 1% = 100\\n /// e.g. when rate should be 7% at kink then rateAtUtilizationKink would be 700\\n uint256 rateAtUtilizationKink;\\n ///\\n /// @param rateAtUtilizationMax borrow rate when utilization is maximum at 100%. in 1e2: 100% = 10_000; 1% = 100\\n /// e.g. when rate should be 125% at 100% then rateAtUtilizationMax would be 12_500\\n uint256 rateAtUtilizationMax;\\n }\\n\\n /// @notice struct to set borrow rate data for version 2\\n struct RateDataV2Params {\\n ///\\n /// @param token for rate data\\n address token;\\n ///\\n /// @param kink1 first kink in borrow rate. in 1e2: 100% = 10_000; 1% = 100\\n /// utilization below kink 1 usually means slow increase in rate, once utilization is above kink 1 borrow rate increases faster\\n uint256 kink1;\\n ///\\n /// @param kink2 second kink in borrow rate. in 1e2: 100% = 10_000; 1% = 100\\n /// utilization below kink 2 usually means slow / medium increase in rate, once utilization is above kink 2 borrow rate increases fast\\n uint256 kink2;\\n ///\\n /// @param rateAtUtilizationZero desired borrow rate when utilization is zero. in 1e2: 100% = 10_000; 1% = 100\\n /// i.e. constant minimum borrow rate\\n /// e.g. at utilization = 0.01% rate could still be at least 4% (rateAtUtilizationZero would be 400 then)\\n uint256 rateAtUtilizationZero;\\n ///\\n /// @param rateAtUtilizationKink1 desired borrow rate when utilization is at first kink. in 1e2: 100% = 10_000; 1% = 100\\n /// e.g. when rate should be 7% at first kink then rateAtUtilizationKink would be 700\\n uint256 rateAtUtilizationKink1;\\n ///\\n /// @param rateAtUtilizationKink2 desired borrow rate when utilization is at second kink. in 1e2: 100% = 10_000; 1% = 100\\n /// e.g. when rate should be 7% at second kink then rateAtUtilizationKink would be 1_200\\n uint256 rateAtUtilizationKink2;\\n ///\\n /// @param rateAtUtilizationMax desired borrow rate when utilization is maximum at 100%. in 1e2: 100% = 10_000; 1% = 100\\n /// e.g. when rate should be 125% at 100% then rateAtUtilizationMax would be 12_500\\n uint256 rateAtUtilizationMax;\\n }\\n\\n /// @notice struct to set token config\\n struct TokenConfig {\\n ///\\n /// @param token address\\n address token;\\n ///\\n /// @param fee charges on borrower's interest. in 1e2: 100% = 10_000; 1% = 100\\n uint256 fee;\\n ///\\n /// @param threshold on when to update the storage slot. in 1e2: 100% = 10_000; 1% = 100\\n uint256 threshold;\\n ///\\n /// @param maxUtilization maximum allowed utilization. in 1e2: 100% = 10_000; 1% = 100\\n /// set to 100% to disable and have default limit of 100% (avoiding SLOAD).\\n uint256 maxUtilization;\\n }\\n\\n /// @notice struct to set user supply & withdrawal config\\n struct UserSupplyConfig {\\n ///\\n /// @param user address\\n address user;\\n ///\\n /// @param token address\\n address token;\\n ///\\n /// @param mode: 0 = without interest. 1 = with interest\\n uint8 mode;\\n ///\\n /// @param expandPercent withdrawal limit expand percent. in 1e2: 100% = 10_000; 1% = 100\\n /// Also used to calculate rate at which withdrawal limit should decrease (instant).\\n uint256 expandPercent;\\n ///\\n /// @param expandDuration withdrawal limit expand duration in seconds.\\n /// used to calculate rate together with expandPercent\\n uint256 expandDuration;\\n ///\\n /// @param baseWithdrawalLimit base limit, below this, user can withdraw the entire amount.\\n /// amount in raw (to be multiplied with exchange price) or normal depends on configured mode in user config for the token:\\n /// with interest -> raw, without interest -> normal\\n uint256 baseWithdrawalLimit;\\n }\\n\\n /// @notice struct to set user borrow & payback config\\n struct UserBorrowConfig {\\n ///\\n /// @param user address\\n address user;\\n ///\\n /// @param token address\\n address token;\\n ///\\n /// @param mode: 0 = without interest. 1 = with interest\\n uint8 mode;\\n ///\\n /// @param expandPercent debt limit expand percent. in 1e2: 100% = 10_000; 1% = 100\\n /// Also used to calculate rate at which debt limit should decrease (instant).\\n uint256 expandPercent;\\n ///\\n /// @param expandDuration debt limit expand duration in seconds.\\n /// used to calculate rate together with expandPercent\\n uint256 expandDuration;\\n ///\\n /// @param baseDebtCeiling base borrow limit. until here, borrow limit remains as baseDebtCeiling\\n /// (user can borrow until this point at once without stepped expansion). Above this, automated limit comes in place.\\n /// amount in raw (to be multiplied with exchange price) or normal depends on configured mode in user config for the token:\\n /// with interest -> raw, without interest -> normal\\n uint256 baseDebtCeiling;\\n ///\\n /// @param maxDebtCeiling max borrow ceiling, maximum amount the user can borrow.\\n /// amount in raw (to be multiplied with exchange price) or normal depends on configured mode in user config for the token:\\n /// with interest -> raw, without interest -> normal\\n uint256 maxDebtCeiling;\\n }\\n}\\n\",\"keccak256\":\"0x10353c70015f27b880125cefab806dbed24a4458f187da66964f3ef60488f757\",\"license\":\"BUSL-1.1\"},\"contracts/liquidity/interfaces/iLiquidity.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity 0.8.21;\\n\\nimport { IProxy } from \\\"../../infiniteProxy/interfaces/iProxy.sol\\\";\\nimport { Structs as AdminModuleStructs } from \\\"../adminModule/structs.sol\\\";\\n\\ninterface IFluidLiquidityAdmin {\\n /// @notice adds/removes auths. Auths generally could be contracts which can have restricted actions defined on contract.\\n /// auths can be helpful in reducing governance overhead where it's not needed.\\n /// @param authsStatus_ array of structs setting allowed status for an address.\\n /// status true => add auth, false => remove auth\\n function updateAuths(AdminModuleStructs.AddressBool[] calldata authsStatus_) external;\\n\\n /// @notice adds/removes guardians. Only callable by Governance.\\n /// @param guardiansStatus_ array of structs setting allowed status for an address.\\n /// status true => add guardian, false => remove guardian\\n function updateGuardians(AdminModuleStructs.AddressBool[] calldata guardiansStatus_) external;\\n\\n /// @notice changes the revenue collector address (contract that is sent revenue). Only callable by Governance.\\n /// @param revenueCollector_ new revenue collector address\\n function updateRevenueCollector(address revenueCollector_) external;\\n\\n /// @notice changes current status, e.g. for pausing or unpausing all user operations. Only callable by Auths.\\n /// @param newStatus_ new status\\n /// status = 2 -> pause, status = 1 -> resume.\\n function changeStatus(uint256 newStatus_) external;\\n\\n /// @notice update tokens rate data version 1. Only callable by Auths.\\n /// @param tokensRateData_ array of RateDataV1Params with rate data to set for each token\\n function updateRateDataV1s(AdminModuleStructs.RateDataV1Params[] calldata tokensRateData_) external;\\n\\n /// @notice update tokens rate data version 2. Only callable by Auths.\\n /// @param tokensRateData_ array of RateDataV2Params with rate data to set for each token\\n function updateRateDataV2s(AdminModuleStructs.RateDataV2Params[] calldata tokensRateData_) external;\\n\\n /// @notice updates token configs: fee charge on borrowers interest & storage update utilization threshold.\\n /// Only callable by Auths.\\n /// @param tokenConfigs_ contains token address, fee & utilization threshold\\n function updateTokenConfigs(AdminModuleStructs.TokenConfig[] calldata tokenConfigs_) external;\\n\\n /// @notice updates user classes: 0 is for new protocols, 1 is for established protocols.\\n /// Only callable by Auths.\\n /// @param userClasses_ struct array of uint256 value to assign for each user address\\n function updateUserClasses(AdminModuleStructs.AddressUint256[] calldata userClasses_) external;\\n\\n /// @notice sets user supply configs per token basis. Eg: with interest or interest-free and automated limits.\\n /// Only callable by Auths.\\n /// @param userSupplyConfigs_ struct array containing user supply config, see `UserSupplyConfig` struct for more info\\n function updateUserSupplyConfigs(AdminModuleStructs.UserSupplyConfig[] memory userSupplyConfigs_) external;\\n\\n /// @notice setting user borrow configs per token basis. Eg: with interest or interest-free and automated limits.\\n /// Only callable by Auths.\\n /// @param userBorrowConfigs_ struct array containing user borrow config, see `UserBorrowConfig` struct for more info\\n function updateUserBorrowConfigs(AdminModuleStructs.UserBorrowConfig[] memory userBorrowConfigs_) external;\\n\\n /// @notice pause operations for a particular user in class 0 (class 1 users can't be paused by guardians).\\n /// Only callable by Guardians.\\n /// @param user_ address of user to pause operations for\\n /// @param supplyTokens_ token addresses to pause withdrawals for\\n /// @param borrowTokens_ token addresses to pause borrowings for\\n function pauseUser(address user_, address[] calldata supplyTokens_, address[] calldata borrowTokens_) external;\\n\\n /// @notice unpause operations for a particular user in class 0 (class 1 users can't be paused by guardians).\\n /// Only callable by Guardians.\\n /// @param user_ address of user to unpause operations for\\n /// @param supplyTokens_ token addresses to unpause withdrawals for\\n /// @param borrowTokens_ token addresses to unpause borrowings for\\n function unpauseUser(address user_, address[] calldata supplyTokens_, address[] calldata borrowTokens_) external;\\n\\n /// @notice collects revenue for tokens to configured revenueCollector address.\\n /// @param tokens_ array of tokens to collect revenue for\\n /// @dev Note that this can revert if token balance is < revenueAmount (utilization > 100%)\\n function collectRevenue(address[] calldata tokens_) external;\\n\\n /// @notice gets the current updated exchange prices for n tokens and updates all prices, rates related data in storage.\\n /// @param tokens_ tokens to update exchange prices for\\n /// @return supplyExchangePrices_ new supply rates of overall system for each token\\n /// @return borrowExchangePrices_ new borrow rates of overall system for each token\\n function updateExchangePrices(\\n address[] calldata tokens_\\n ) external returns (uint256[] memory supplyExchangePrices_, uint256[] memory borrowExchangePrices_);\\n}\\n\\ninterface IFluidLiquidityLogic is IFluidLiquidityAdmin {\\n /// @notice Single function which handles supply, withdraw, borrow & payback\\n /// @param token_ address of token (0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE for native)\\n /// @param supplyAmount_ if +ve then supply, if -ve then withdraw, if 0 then nothing\\n /// @param borrowAmount_ if +ve then borrow, if -ve then payback, if 0 then nothing\\n /// @param withdrawTo_ if withdrawal then to which address\\n /// @param borrowTo_ if borrow then to which address\\n /// @param callbackData_ callback data passed to `liquidityCallback` method of protocol\\n /// @return memVar3_ updated supplyExchangePrice\\n /// @return memVar4_ updated borrowExchangePrice\\n /// @dev to trigger skipping in / out transfers when in&out amounts balance themselves out (gas optimization):\\n /// - supply(+) == borrow(+), withdraw(-) == payback(-).\\n /// - `withdrawTo_` / `borrowTo_` must be msg.sender (protocol)\\n /// - `callbackData_` MUST be encoded so that \\\"from\\\" address is at last 20 bytes (if this optimization is desired),\\n /// also for native token operations where liquidityCallback is not triggered!\\n /// from address must come at last position if there is more data. I.e. encode like:\\n /// abi.encode(otherVar1, otherVar2, FROM_ADDRESS). Note dynamic types used with abi.encode come at the end\\n /// so if dynamic types are needed, you must use abi.encodePacked to ensure the from address is at the end.\\n function operate(\\n address token_,\\n int256 supplyAmount_,\\n int256 borrowAmount_,\\n address withdrawTo_,\\n address borrowTo_,\\n bytes calldata callbackData_\\n ) external payable returns (uint256 memVar3_, uint256 memVar4_);\\n}\\n\\ninterface IFluidLiquidity is IProxy, IFluidLiquidityLogic {}\\n\",\"keccak256\":\"0xc81ac0cfc8183ec57ec4e488b07a4f6d1ecd79787e0aaf0dcfdd0b9b7ac0fc84\",\"license\":\"MIT\"},\"contracts/oracle/fluidOracle.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity 0.8.21;\\n\\nimport { IFluidOracle } from \\\"./interfaces/iFluidOracle.sol\\\";\\n\\n/// @title FluidOracle\\n/// @notice Base contract that any Fluid Oracle must implement\\nabstract contract FluidOracle is IFluidOracle {\\n /// @inheritdoc IFluidOracle\\n function getExchangeRate() external view virtual returns (uint256 exchangeRate_);\\n\\n /// @inheritdoc IFluidOracle\\n function getExchangeRateOperate() external view virtual returns (uint256 exchangeRate_);\\n\\n /// @inheritdoc IFluidOracle\\n function getExchangeRateLiquidate() external view virtual returns (uint256 exchangeRate_);\\n}\\n\",\"keccak256\":\"0xd275b5b0ada86c81a4dc6c79a24b1cb8bcfc374f4856e08917bf1bae83574b37\",\"license\":\"BUSL-1.1\"},\"contracts/oracle/interfaces/iFluidOracle.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.21;\\n\\ninterface IFluidOracle {\\n /// @dev Deprecated. Use `getExchangeRateOperate()` and `getExchangeRateLiquidate()` instead. Only implemented for\\n /// backwards compatibility.\\n function getExchangeRate() external view returns (uint256 exchangeRate_);\\n\\n /// @notice Get the `exchangeRate_` between the underlying asset and the peg asset in 1e27 for operates\\n function getExchangeRateOperate() external view returns (uint256 exchangeRate_);\\n\\n /// @notice Get the `exchangeRate_` between the underlying asset and the peg asset in 1e27 for liquidations\\n function getExchangeRateLiquidate() external view returns (uint256 exchangeRate_);\\n}\\n\",\"keccak256\":\"0x410b5f85b64414df35131bbf322261e2a11956d58af3800d8b71b5befb9907d4\",\"license\":\"MIT\"},\"contracts/protocols/vault/error.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity 0.8.21;\\n\\ncontract Error {\\n error FluidVaultError(uint256 errorId_);\\n\\n /// @notice used to simulate liquidation to find the maximum liquidatable amounts\\n error FluidLiquidateResult(uint256 colLiquidated, uint256 debtLiquidated);\\n}\\n\",\"keccak256\":\"0x84d885c40fdca6828cb4cdc206c852fc4ad7e52f7621e2a63b151742123196f5\",\"license\":\"BUSL-1.1\"},\"contracts/protocols/vault/errorTypes.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity 0.8.21;\\n\\nlibrary ErrorTypes {\\n /***********************************|\\n | Vault Factory | \\n |__________________________________*/\\n\\n uint256 internal constant VaultFactory__InvalidOperation = 30001;\\n uint256 internal constant VaultFactory__Unauthorized = 30002;\\n uint256 internal constant VaultFactory__SameTokenNotAllowed = 30003;\\n uint256 internal constant VaultFactory__InvalidParams = 30004;\\n uint256 internal constant VaultFactory__InvalidVault = 30005;\\n uint256 internal constant VaultFactory__InvalidVaultAddress = 30006;\\n uint256 internal constant VaultFactory__OnlyDelegateCallAllowed = 30007;\\n\\n /***********************************|\\n | VaultT1 | \\n |__________________________________*/\\n\\n /// @notice thrown at reentrancy\\n uint256 internal constant VaultT1__AlreadyEntered = 31001;\\n\\n /// @notice thrown when user sends deposit & borrow amount as 0\\n uint256 internal constant VaultT1__InvalidOperateAmount = 31002;\\n\\n /// @notice thrown when msg.value is not in sync with native token deposit or payback\\n uint256 internal constant VaultT1__InvalidMsgValueOperate = 31003;\\n\\n /// @notice thrown when msg.sender is not the owner of the vault\\n uint256 internal constant VaultT1__NotAnOwner = 31004;\\n\\n /// @notice thrown when user's position does not exist. Sending the wrong index from the frontend\\n uint256 internal constant VaultT1__TickIsEmpty = 31005;\\n\\n /// @notice thrown when the user's position is above CF and the user tries to make it more risky by trying to withdraw or borrow\\n uint256 internal constant VaultT1__PositionAboveCF = 31006;\\n\\n /// @notice thrown when the top tick is not initialized. Happens if the vault is totally new or all the user's left\\n uint256 internal constant VaultT1__TopTickDoesNotExist = 31007;\\n\\n /// @notice thrown when msg.value in liquidate is not in sync payback\\n uint256 internal constant VaultT1__InvalidMsgValueLiquidate = 31008;\\n\\n /// @notice thrown when slippage is more on liquidation than what the liquidator sent\\n uint256 internal constant VaultT1__ExcessSlippageLiquidation = 31009;\\n\\n /// @notice thrown when msg.sender is not the rebalancer/reserve contract\\n uint256 internal constant VaultT1__NotRebalancer = 31010;\\n\\n /// @notice thrown when NFT of one vault interacts with the NFT of other vault\\n uint256 internal constant VaultT1__NftNotOfThisVault = 31011;\\n\\n /// @notice thrown when the token is not initialized on the liquidity contract\\n uint256 internal constant VaultT1__TokenNotInitialized = 31012;\\n\\n /// @notice thrown when admin updates fallback if a non-auth calls vault\\n uint256 internal constant VaultT1__NotAnAuth = 31013;\\n\\n /// @notice thrown in operate when user tries to witdhraw more collateral than deposited\\n uint256 internal constant VaultT1__ExcessCollateralWithdrawal = 31014;\\n\\n /// @notice thrown in operate when user tries to payback more debt than borrowed\\n uint256 internal constant VaultT1__ExcessDebtPayback = 31015;\\n\\n /// @notice thrown when user try to withdrawal more than operate's withdrawal limit\\n uint256 internal constant VaultT1__WithdrawMoreThanOperateLimit = 31016;\\n\\n /// @notice thrown when caller of liquidityCallback is not Liquidity\\n uint256 internal constant VaultT1__InvalidLiquidityCallbackAddress = 31017;\\n\\n /// @notice thrown when reentrancy is not already on\\n uint256 internal constant VaultT1__NotEntered = 31018;\\n\\n /// @notice thrown when someone directly calls secondary implementation contract\\n uint256 internal constant VaultT1__OnlyDelegateCallAllowed = 31019;\\n\\n /// @notice thrown when the safeTransferFrom for a token amount failed\\n uint256 internal constant VaultT1__TransferFromFailed = 31020;\\n\\n /// @notice thrown when exchange price overflows while updating on storage\\n uint256 internal constant VaultT1__ExchangePriceOverFlow = 31021;\\n\\n /// @notice thrown when debt to liquidate amt is sent wrong\\n uint256 internal constant VaultT1__InvalidLiquidationAmt = 31022;\\n\\n /// @notice thrown when user debt or collateral goes above 2**128 or below -2**128\\n uint256 internal constant VaultT1__UserCollateralDebtExceed = 31023;\\n\\n /// @notice thrown if on liquidation branch debt becomes lower than 100\\n uint256 internal constant VaultT1__BranchDebtTooLow = 31024;\\n\\n /// @notice thrown when tick's debt is less than 10000\\n uint256 internal constant VaultT1__TickDebtTooLow = 31025;\\n\\n /// @notice thrown when the received new liquidity exchange price is of unexpected value (< than the old one)\\n uint256 internal constant VaultT1__LiquidityExchangePriceUnexpected = 31026;\\n\\n /// @notice thrown when user's debt is less than 10000\\n uint256 internal constant VaultT1__UserDebtTooLow = 31027;\\n\\n /// @notice thrown when on only payback and only deposit the ratio of position increases\\n uint256 internal constant VaultT1__InvalidPaybackOrDeposit = 31028;\\n\\n /// @notice thrown when liquidation just happens of a single partial or when there's nothing to liquidate\\n uint256 internal constant VaultT1__InvalidLiquidation = 31029;\\n\\n /// @notice thrown when msg.value is sent wrong in rebalance\\n uint256 internal constant VaultT1__InvalidMsgValueInRebalance = 31030;\\n\\n /// @notice thrown when nothing rebalanced\\n uint256 internal constant VaultT1__NothingToRebalance = 31031;\\n\\n /// @notice thrown on unforseen liquidation scenarios. Might never come in use.\\n uint256 internal constant VaultT1__LiquidationReverts = 31032;\\n\\n /// @notice thrown when oracle price is > 1e54\\n uint256 internal constant VaultT1__InvalidOraclePrice = 31033;\\n\\n /***********************************|\\n | ERC721 | \\n |__________________________________*/\\n\\n uint256 internal constant ERC721__InvalidParams = 32001;\\n uint256 internal constant ERC721__Unauthorized = 32002;\\n uint256 internal constant ERC721__InvalidOperation = 32003;\\n uint256 internal constant ERC721__UnsafeRecipient = 32004;\\n uint256 internal constant ERC721__OutOfBoundsIndex = 32005;\\n\\n /***********************************|\\n | Vault Admin | \\n |__________________________________*/\\n\\n /// @notice thrown when admin tries to setup invalid value which are crossing limits\\n uint256 internal constant VaultT1Admin__ValueAboveLimit = 33001;\\n\\n /// @notice when someone directly calls admin implementation contract\\n uint256 internal constant VaultT1Admin__OnlyDelegateCallAllowed = 33002;\\n\\n /// @notice thrown when auth sends NFT ID as 0 while collecting dust debt\\n uint256 internal constant VaultT1Admin__NftIdShouldBeNonZero = 33003;\\n\\n /// @notice thrown when trying to collect dust debt of NFT which is not of this vault\\n uint256 internal constant VaultT1Admin__NftNotOfThisVault = 33004;\\n\\n /// @notice thrown when dust debt of NFT is 0, meaning nothing to collect\\n uint256 internal constant VaultT1Admin__DustDebtIsZero = 33005;\\n\\n /// @notice thrown when final debt after liquidation is not 0, meaning position 100% liquidated\\n uint256 internal constant VaultT1Admin__FinalDebtShouldBeZero = 33006;\\n\\n /// @notice thrown when NFT is not liquidated state\\n uint256 internal constant VaultT1Admin__NftNotLiquidated = 33007;\\n\\n /// @notice thrown when total absorbed dust debt is 0\\n uint256 internal constant VaultT1Admin__AbsorbedDustDebtIsZero = 33008;\\n\\n /// @notice thrown when address is set as 0\\n uint256 internal constant VaultT1Admin__AddressZeroNotAllowed = 33009;\\n\\n /***********************************|\\n | Vault Rewards | \\n |__________________________________*/\\n\\n uint256 internal constant VaultRewards__Unauthorized = 34001;\\n uint256 internal constant VaultRewards__AddressZero = 34002;\\n uint256 internal constant VaultRewards__InvalidParams = 34003;\\n uint256 internal constant VaultRewards__NewMagnifierSameAsOldMagnifier = 34004;\\n uint256 internal constant VaultRewards__NotTheInitiator = 34005;\\n uint256 internal constant VaultRewards__AlreadyStarted = 34006;\\n uint256 internal constant VaultRewards__RewardsNotStartedOrEnded = 34007;\\n}\\n\",\"keccak256\":\"0x0c6701ce11de6044d26e97782569d06ccec4297abfd2dab39a928bbed246ece7\",\"license\":\"BUSL-1.1\"},\"contracts/protocols/vault/interfaces/iVaultT1.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity 0.8.21;\\n\\ninterface IFluidVaultT1 {\\n /// @notice returns the vault id\\n function VAULT_ID() external view returns (uint256);\\n\\n /// @notice reads uint256 data `result_` from storage at a bytes32 storage `slot_` key.\\n function readFromStorage(bytes32 slot_) external view returns (uint256 result_);\\n\\n struct ConstantViews {\\n address liquidity;\\n address factory;\\n address adminImplementation;\\n address secondaryImplementation;\\n address supplyToken;\\n address borrowToken;\\n uint8 supplyDecimals;\\n uint8 borrowDecimals;\\n uint vaultId;\\n bytes32 liquiditySupplyExchangePriceSlot;\\n bytes32 liquidityBorrowExchangePriceSlot;\\n bytes32 liquidityUserSupplySlot;\\n bytes32 liquidityUserBorrowSlot;\\n }\\n\\n /// @notice returns all Vault constants\\n function constantsView() external view returns (ConstantViews memory constantsView_);\\n\\n /// @notice fetches the latest user position after a liquidation\\n function fetchLatestPosition(\\n int256 positionTick_,\\n uint256 positionTickId_,\\n uint256 positionRawDebt_,\\n uint256 tickData_\\n )\\n external\\n view\\n returns (\\n int256, // tick\\n uint256, // raw debt\\n uint256, // raw collateral\\n uint256, // branchID_\\n uint256 // branchData_\\n );\\n\\n /// @notice calculates the updated vault exchange prices\\n function updateExchangePrices(\\n uint256 vaultVariables2_\\n )\\n external\\n view\\n returns (\\n uint256 liqSupplyExPrice_,\\n uint256 liqBorrowExPrice_,\\n uint256 vaultSupplyExPrice_,\\n uint256 vaultBorrowExPrice_\\n );\\n\\n /// @notice calculates the updated vault exchange prices and writes them to storage\\n function updateExchangePricesOnStorage()\\n external\\n returns (\\n uint256 liqSupplyExPrice_,\\n uint256 liqBorrowExPrice_,\\n uint256 vaultSupplyExPrice_,\\n uint256 vaultBorrowExPrice_\\n );\\n\\n /// @notice returns the liquidity contract address\\n function LIQUIDITY() external view returns (address);\\n\\n function operate(\\n uint256 nftId_, // if 0 then new position\\n int256 newCol_, // if negative then withdraw\\n int256 newDebt_, // if negative then payback\\n address to_ // address at which the borrow & withdraw amount should go to. If address(0) then it'll go to msg.sender\\n )\\n external\\n payable\\n returns (\\n uint256, // nftId_\\n int256, // final supply amount. if - then withdraw\\n int256 // final borrow amount. if - then payback\\n );\\n \\n function liquidate(\\n uint256 debtAmt_,\\n uint256 colPerUnitDebt_, // min collateral needed per unit of debt in 1e18\\n address to_,\\n bool absorb_\\n ) external payable returns (uint actualDebtAmt_, uint actualColAmt_);\\n\\n function absorb() external;\\n\\n function rebalance() external payable returns (int supplyAmt_, int borrowAmt_);\\n\\n error FluidLiquidateResult(uint256 colLiquidated, uint256 debtLiquidated);\\n}\\n\",\"keccak256\":\"0xe0ec40a4531ecbcd7b8db25b4cd8529e0c284bb20eb40b7cf909fb8af0e3ca8b\",\"license\":\"MIT\"},\"contracts/protocols/vault/vaultT1/common/variables.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity 0.8.21;\\n\\ncontract Variables {\\n /***********************************|\\n | Storage Variables |\\n |__________________________________*/\\n\\n /// note: in all variables. For tick >= 0 are represented with bit as 1, tick < 0 are represented with bit as 0\\n /// note: read all the variables through storageRead.sol\\n\\n /// note: vaultVariables contains vault variables which need regular updates through transactions\\n /// First 1 bit => 0 => re-entrancy. If 0 then allow transaction to go, else throw.\\n /// Next 1 bit => 1 => Is the current active branch liquidated? If true then check the branch's minima tick before creating a new position\\n /// If the new tick is greater than minima tick then initialize a new branch, make that as current branch & do proper linking\\n /// Next 1 bit => 2 => sign of topmost tick (0 -> negative; 1 -> positive)\\n /// Next 19 bits => 3-21 => absolute value of topmost tick\\n /// Next 30 bits => 22-51 => current branch ID\\n /// Next 30 bits => 52-81 => total branch ID\\n /// Next 64 bits => 82-145 => Total supply\\n /// Next 64 bits => 146-209 => Total borrow\\n /// Next 32 bits => 210-241 => Total positions\\n uint256 internal vaultVariables;\\n\\n /// note: vaultVariables2 contains variables which do not update on every transaction. So mainly admin/auth set amount\\n /// First 16 bits => 0-15 => supply rate magnifier; 10000 = 1x (Here 16 bits should be more than enough)\\n /// Next 16 bits => 16-31 => borrow rate magnifier; 10000 = 1x (Here 16 bits should be more than enough)\\n /// Next 10 bits => 32-41 => collateral factor. 800 = 0.8 = 80% (max precision of 0.1%)\\n /// Next 10 bits => 42-51 => liquidation Threshold. 900 = 0.9 = 90% (max precision of 0.1%)\\n /// Next 10 bits => 52-61 => liquidation Max Limit. 950 = 0.95 = 95% (max precision of 0.1%) (above this 100% liquidation can happen)\\n /// Next 10 bits => 62-71 => withdraw gap. 100 = 0.1 = 10%. (max precision of 0.1%) (max 7 bits can also suffice for the requirement here of 0.1% to 10%). Needed to save some limits on withdrawals so liquidate can work seamlessly.\\n /// Next 10 bits => 72-81 => liquidation penalty. 100 = 0.01 = 1%. (max precision of 0.01%) (max liquidation penantly can be 10.23%). Applies when tick is in between liquidation Threshold & liquidation Max Limit.\\n /// Next 10 bits => 82-91 => borrow fee. 100 = 0.01 = 1%. (max precision of 0.01%) (max borrow fee can be 10.23%). Fees on borrow.\\n /// Next 4 bits => 92-95 => empty\\n /// Next 160 bits => 96-255 => Oracle address\\n uint256 internal vaultVariables2;\\n\\n /// note: stores absorbed liquidity\\n /// First 128 bits raw debt amount\\n /// last 128 bits raw col amount\\n uint256 internal absorbedLiquidity;\\n\\n /// position index => position data uint\\n /// if the entire variable is 0 (meaning not initialized) at the start that means no position at all\\n /// First 1 bit => 0 => position type (0 => borrow position; 1 => supply position)\\n /// Next 1 bit => 1 => sign of user's tick (0 => negative; 1 => positive)\\n /// Next 19 bits => 2-20 => absolute value of user's tick\\n /// Next 24 bits => 21-44 => user's tick's id\\n /// Below we are storing user's collateral & not debt, because the position can also be only collateral with no tick but it can never be only debt\\n /// Next 64 bits => 45-108 => user's supply amount. Debt will be calculated through supply & ratio.\\n /// Next 64 bits => 109-172 => user's dust debt amount. User's net debt = total debt - dust amount. Total debt is calculated through supply & ratio\\n /// User won't pay any extra interest on dust debt & hence we will not show it as a debt on UI. For user's there's no dust.\\n mapping(uint256 => uint256) internal positionData;\\n\\n /// Tick has debt only keeps data of non liquidated positions. liquidated tick's data stays in branch itself\\n /// tick parent => uint (represents bool for 256 children)\\n /// parent of (i)th tick:-\\n /// if (i>=0) (i / 256);\\n /// else ((i + 1) / 256) - 1\\n /// first bit of the variable is the smallest tick & last bit is the biggest tick of that slot\\n mapping(int256 => uint256) internal tickHasDebt;\\n\\n /// mapping tickId => tickData\\n /// Tick related data. Total debt & other things\\n /// First bit => 0 => If 1 then liquidated else not liquidated\\n /// Next 24 bits => 1-24 => Total IDs. ID should start from 1.\\n /// If not liquidated:\\n /// Next 64 bits => 25-88 => raw debt\\n /// If liquidated\\n /// The below 3 things are of last ID. This is to be updated when user creates a new position\\n /// Next 1 bit => 25 => Is 100% liquidated? If this is 1 meaning it was above max tick when it got liquidated (100% liquidated)\\n /// Next 30 bits => 26-55 => branch ID where this tick got liquidated\\n /// Next 50 bits => 56-105 => debt factor 50 bits (35 bits coefficient | 15 bits expansion)\\n mapping(int256 => uint256) internal tickData;\\n\\n /// tick id => previous tick id liquidation data. ID starts from 1\\n /// One tick ID contains 3 IDs of 80 bits in it, holding liquidation data of previously active but liquidated ticks\\n /// 81 bits data below\\n /// #### First 85 bits ####\\n /// 1st bit => 0 => Is 100% liquidated? If this is 1 meaning it was above max tick when it got liquidated\\n /// Next 30 bits => 1-30 => branch ID where this tick got liquidated\\n /// Next 50 bits => 31-80 => debt factor 50 bits (35 bits coefficient | 15 bits expansion)\\n /// #### Second 85 bits ####\\n /// 85th bit => 85 => Is 100% liquidated? If this is 1 meaning it was above max tick when it got liquidated\\n /// Next 30 bits => 86-115 => branch ID where this tick got liquidated\\n /// Next 50 bits => 116-165 => debt factor 50 bits (35 bits coefficient | 15 bits expansion)\\n /// #### Third 85 bits ####\\n /// 170th bit => 170 => Is 100% liquidated? If this is 1 meaning it was above max tick when it got liquidated\\n /// Next 30 bits => 171-200 => branch ID where this tick got liquidated\\n /// Next 50 bits => 201-250 => debt factor 50 bits (35 bits coefficient | 15 bits expansion)\\n mapping(int256 => mapping(uint256 => uint256)) internal tickId;\\n\\n /// mapping branchId => branchData\\n /// First 2 bits => 0-1 => if 0 then not liquidated, if 1 then liquidated, if 2 then merged, if 3 then closed\\n /// merged means the branch is merged into it's base branch\\n /// closed means all the users are 100% liquidated\\n /// Next 1 bit => 2 => minima tick sign of this branch. Will only be there if any liquidation happened.\\n /// Next 19 bits => 3-21 => minima tick of this branch. Will only be there if any liquidation happened.\\n /// Next 30 bits => 22-51 => Partials of minima tick of branch this is connected to. 0 if master branch.\\n /// Next 64 bits => 52-115 Debt liquidity at this branch. Similar to last's top tick data. Remaining debt will move here from tickData after first liquidation\\n /// If not merged\\n /// Next 50 bits => 116-165 => Debt factor or of this branch. (35 bits coefficient | 15 bits expansion)\\n /// If merged\\n /// Next 50 bits => 116-165 => Connection/adjustment debt factor of this branch with the next branch.\\n /// If closed\\n /// Next 50 bits => 116-165 => Debt factor as 0. As all the user's positions are now fully gone\\n /// following values are present always again (merged / not merged / closed)\\n /// Next 30 bits => 166-195 => Branch's ID with which this branch is connected. If 0 then that means this is the master branch\\n /// Next 1 bit => 196 => sign of minima tick of branch this is connected to. 0 if master branch.\\n /// Next 19 bits => 197-215 => minima tick of branch this is connected to. 0 if master branch.\\n mapping(uint256 => uint256) internal branchData;\\n\\n /// Exchange prices are in 1e12\\n /// First 64 bits => 0-63 => Liquidity's collateral token supply exchange price\\n /// First 64 bits => 64-127 => Liquidity's debt token borrow exchange price\\n /// First 64 bits => 128-191 => Vault's collateral token supply exchange price\\n /// First 64 bits => 192-255 => Vault's debt token borrow exchange price\\n uint256 internal rates;\\n\\n /// address of rebalancer\\n address internal rebalancer;\\n\\n uint256 internal absorbedDustDebt;\\n}\\n\",\"keccak256\":\"0x446a2d8d47d53d1584a1a1dd9aed247320ba04582e8bbcd7be60c979f908c52e\",\"license\":\"BUSL-1.1\"},\"contracts/protocols/vault/vaultT1/coreModule/events.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity 0.8.21;\\n\\ncontract Events {\\n /// @notice emitted when an operate() method is executed that changes collateral (`colAmt_`) / debt (debtAmt_`)\\n /// amount for a `user_` position with `nftId_`. Receiver of any funds is the address `to_`.\\n event LogOperate(address user_, uint256 nftId_, int256 colAmt_, int256 debtAmt_, address to_);\\n\\n /// @notice emitted when the exchange prices are updated in storage.\\n event LogUpdateExchangePrice(uint256 supplyExPrice_, uint256 borrowExPrice_);\\n\\n /// @notice emitted when a liquidation has been executed.\\n event LogLiquidate(address liquidator_, uint256 colAmt_, uint256 debtAmt_, address to_);\\n\\n /// @notice emitted when `absorb()` was executed to absorb bad debt.\\n event LogAbsorb(uint colAbsorbedRaw_, uint debtAbsorbedRaw_);\\n\\n /// @notice emitted when a `rebalance()` has been executed, balancing out total supply / borrow between Vault\\n /// and Fluid Liquidity pools.\\n /// if `colAmt_` is positive then loss, meaning transfer from rebalancer address to vault and deposit.\\n /// if `colAmt_` is negative then profit, meaning withdrawn from vault and sent to rebalancer address.\\n /// if `debtAmt_` is positive then profit, meaning borrow from vault and sent to rebalancer address.\\n /// if `debtAmt_` is negative then loss, meaning transfer from rebalancer address to vault and payback.\\n event LogRebalance(int colAmt_, int debtAmt_);\\n}\\n\",\"keccak256\":\"0xf703ee56009b4a760e4d89d82d233c1cbf886393cb125de4e12ee16bfe2761f1\",\"license\":\"BUSL-1.1\"},\"contracts/protocols/vault/vaultT1/coreModule/main2.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity 0.8.21;\\n\\nimport { Variables } from \\\"../common/variables.sol\\\";\\nimport { IFluidOracle } from \\\"../../../../oracle/fluidOracle.sol\\\";\\nimport { TickMath } from \\\"../../../../libraries/tickMath.sol\\\";\\nimport { BigMathMinified } from \\\"../../../../libraries/bigMathMinified.sol\\\";\\nimport { Error } from \\\"../../error.sol\\\";\\nimport { ErrorTypes } from \\\"../../errorTypes.sol\\\";\\nimport { IFluidVaultT1 } from \\\"../../interfaces/iVaultT1.sol\\\";\\nimport { Structs } from \\\"./structs.sol\\\";\\nimport { Events } from \\\"./events.sol\\\";\\nimport { LiquiditySlotsLink } from \\\"../../../../libraries/liquiditySlotsLink.sol\\\";\\nimport { LiquidityCalcs } from \\\"../../../../libraries/liquidityCalcs.sol\\\";\\nimport { IFluidLiquidity } from \\\"../../../../liquidity/interfaces/iLiquidity.sol\\\";\\nimport { SafeTransfer } from \\\"../../../../libraries/safeTransfer.sol\\\";\\n\\n/// @notice Fluid Vault protocol secondary methods contract.\\n/// Implements `absorb()` and `rebalance()` methods, extracted from main contract due to contract size limits.\\n/// Methods are limited to be called via delegateCall only (as done by Vault CoreModule \\\"VaultT1\\\" contract).\\ncontract FluidVaultT1Secondary is Variables, Error, Structs, Events {\\n using BigMathMinified for uint;\\n\\n address internal constant NATIVE_TOKEN = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\\n\\n // 30 bits (used for partials mainly)\\n uint internal constant X8 = 0xff;\\n uint internal constant X10 = 0x3ff;\\n uint internal constant X16 = 0xffff;\\n uint internal constant X19 = 0x7ffff;\\n uint internal constant X20 = 0xfffff;\\n uint internal constant X24 = 0xffffff;\\n uint internal constant X25 = 0x1ffffff;\\n uint internal constant X30 = 0x3fffffff;\\n uint internal constant X35 = 0x7ffffffff;\\n uint internal constant X50 = 0x3ffffffffffff;\\n uint internal constant X64 = 0xffffffffffffffff;\\n uint internal constant X96 = 0xffffffffffffffffffffffff;\\n uint internal constant X128 = 0xffffffffffffffffffffffffffffffff;\\n\\n address private immutable addressThis;\\n\\n constructor() {\\n addressThis = address(this);\\n }\\n\\n modifier _verifyCaller() {\\n if (address(this) == addressThis) {\\n revert FluidVaultError(ErrorTypes.VaultT1__OnlyDelegateCallAllowed);\\n }\\n _;\\n }\\n\\n /// @dev absorb function absorbs the bad debt if the bad debt is above max limit. The main use of it is\\n /// if the bad debt didn't got liquidated in time maybe due to sudden price drop or bad debt was extremely small to liquidate\\n /// and the bad debt goes above 100% ratio then there's no incentive for anyone to liquidate now\\n /// hence absorb functions absorbs that bad debt to allow newer bad debt to liquidate seamlessly.\\n /// if absorbing were to happen after this it's on governance on how to deal with it\\n /// although it can still be removed through liquidate via liquidator if the price goes back up and liquidation becomes beneficial\\n /// upon absorbed user position gets 100% liquidated.\\n function absorb(uint vaultVariables_, int maxTick_) public _verifyCaller returns (uint) {\\n AbsorbMemoryVariables memory a_;\\n\\n // Temporary holder variables, used many times for different small few liner things\\n uint temp_;\\n uint temp2_;\\n\\n TickHasDebt memory tickHasDebt_;\\n\\n {\\n // liquidating ticks above max ratio\\n\\n // temp_ -> top tick\\n temp_ = ((vaultVariables_ >> 2) & X20);\\n // increasing startingTick_ by 1 so the current tick comes into looping equation\\n a_.startingTick = (temp_ & 1) == 1 ? (int(temp_ >> 1) + 1) : (-int(temp_ >> 1) + 1);\\n\\n tickHasDebt_.mapId = a_.startingTick < 0 ? ((a_.startingTick + 1) / 256) - 1 : a_.startingTick / 256;\\n\\n tickHasDebt_.tickHasDebt = tickHasDebt[tickHasDebt_.mapId];\\n\\n {\\n // For last user remaining in vault there could be a lot of while loop.\\n // Chances of this to happen is extremely low (like ~0%)\\n tickHasDebt_.nextTick = TickMath.MAX_TICK;\\n while (true) {\\n if (tickHasDebt_.tickHasDebt > 0) {\\n a_.mostSigBit = tickHasDebt_.tickHasDebt.mostSignificantBit();\\n tickHasDebt_.nextTick = tickHasDebt_.mapId * 256 + int(a_.mostSigBit) - 1;\\n\\n while (tickHasDebt_.nextTick > maxTick_) {\\n // storing tickData into temp_\\n temp_ = tickData[tickHasDebt_.nextTick];\\n // temp2_ -> tick's debt\\n temp2_ = (temp_ >> 25) & X64;\\n // converting big number into normal number\\n temp2_ = (temp2_ >> 8) << (temp2_ & X8);\\n // Absorbing tick's debt & collateral\\n a_.debtAbsorbed += temp2_;\\n // calculating collateral from debt & ratio and adding to a_.colAbsorbed\\n a_.colAbsorbed += ((temp2_ * TickMath.ZERO_TICK_SCALED_RATIO) /\\n TickMath.getRatioAtTick(int24(tickHasDebt_.nextTick)));\\n // Update tick data on storage. Making tick as 100% liquidated\\n tickData[tickHasDebt_.nextTick] = 1 | (temp_ & 0x1fffffe) | (1 << 25); // set as 100% liquidated\\n\\n // temp_ = bits to remove\\n temp_ = 257 - a_.mostSigBit;\\n tickHasDebt_.tickHasDebt = (tickHasDebt_.tickHasDebt << temp_) >> temp_;\\n if (tickHasDebt_.tickHasDebt == 0) break;\\n\\n a_.mostSigBit = tickHasDebt_.tickHasDebt.mostSignificantBit();\\n tickHasDebt_.nextTick = tickHasDebt_.mapId * 256 + int(a_.mostSigBit) - 1;\\n }\\n // updating tickHasDebt on storage\\n tickHasDebt[tickHasDebt_.mapId] = tickHasDebt_.tickHasDebt;\\n }\\n\\n // tickHasDebt_.tickHasDebt == 0 from here.\\n\\n if (tickHasDebt_.nextTick <= maxTick_) {\\n break;\\n }\\n\\n if (tickHasDebt_.mapId < -129) {\\n tickHasDebt_.nextTick = type(int).min;\\n break;\\n }\\n\\n // Fetching next tickHasDebt by decreasing tickHasDebt_.mapId first\\n tickHasDebt_.tickHasDebt = tickHasDebt[--tickHasDebt_.mapId];\\n }\\n }\\n }\\n\\n // After the above loop we will get nextTick stored in tickHasDebt_ which we will use to compare & set things in the end\\n\\n {\\n TickData memory tickInfo_;\\n BranchData memory branch_;\\n // if this remains 0 that means create a new branch over the end\\n uint newBranchId_;\\n\\n {\\n // Liquidate branches in a loop and store the end branch\\n branch_.id = (vaultVariables_ >> 22) & X30;\\n branch_.data = branchData[branch_.id];\\n // Checking if current branch is liquidated\\n if ((vaultVariables_ & 2) == 0) {\\n // current branch is not liquidated hence it can be used as a new branch if needed\\n newBranchId_ = branch_.id;\\n\\n // Checking the base branch minima tick. temp_ = base branch minima tick\\n temp_ = (branch_.data >> 196) & X20;\\n if (temp_ > 0) {\\n // Setting the base branch as current liquidatable branch\\n branch_.id = (branch_.data >> 166) & X30;\\n branch_.data = branchData[branch_.id];\\n branch_.minimaTick = (temp_ & 1) == 1 ? int(temp_ >> 1) : -int(temp_ >> 1);\\n } else {\\n // the current branch is base branch, hence need to setup a new base branch\\n branch_.id = 0;\\n branch_.data = 0;\\n branch_.minimaTick = type(int).min;\\n }\\n } else {\\n // current branch is liquidated\\n temp_ = (branch_.data >> 2) & X20;\\n branch_.minimaTick = (temp_ & 1) == 1 ? int(temp_ >> 1) : -int(temp_ >> 1);\\n }\\n while (branch_.minimaTick > maxTick_) {\\n // Check base branch, if exists then check if minima tick is above max tick then liquidate it.\\n tickInfo_.ratio = TickMath.getRatioAtTick(int24(branch_.minimaTick));\\n tickInfo_.ratioOneLess = (tickInfo_.ratio * 10000) / 10015;\\n tickInfo_.length = tickInfo_.ratio - tickInfo_.ratioOneLess;\\n\\n // partials\\n tickInfo_.partials = (branch_.data >> 22) & X30;\\n\\n tickInfo_.currentRatio = tickInfo_.ratioOneLess + ((tickInfo_.length * tickInfo_.partials) / X30);\\n\\n // debt in branch\\n temp2_ = (branch_.data >> 52) & X64;\\n // converting big number into normal number\\n temp2_ = (temp2_ >> 8) << (temp2_ & X8);\\n // Absorbing branch's debt & collateral\\n a_.debtAbsorbed += temp2_;\\n // calculating branch's collateral using debt & ratio and adding it to a_.colAbsorbed\\n a_.colAbsorbed += (temp2_ * TickMath.ZERO_TICK_SCALED_RATIO) / tickInfo_.currentRatio;\\n\\n // Closing branch\\n branchData[branch_.id] = branch_.data | 3;\\n\\n // Setting new branch\\n temp_ = (branch_.data >> 196) & X20; // temp_ -> minima tick of connected branch\\n if (temp_ > 0) {\\n // Setting the base branch as current liquidatable branch\\n branch_.id = (branch_.data >> 166) & X30;\\n branch_.data = branchData[branch_.id];\\n branch_.minimaTick = (temp_ & 1) == 1 ? int(temp_ >> 1) : -int(temp_ >> 1);\\n } else {\\n // the current branch is base branch, hence need to setup a new base branch\\n branch_.id = 0;\\n branch_.data = 0;\\n branch_.minimaTick = type(int).min;\\n }\\n }\\n }\\n\\n if (tickHasDebt_.nextTick >= branch_.minimaTick) {\\n // new top tick is not liquidated\\n // temp2_ = tick to insert\\n if (tickHasDebt_.nextTick > type(int).min) {\\n temp2_ = tickHasDebt_.nextTick < 0\\n ? (uint(-tickHasDebt_.nextTick) << 1)\\n : ((uint(tickHasDebt_.nextTick) << 1) | 1);\\n } else {\\n temp2_ = 0;\\n }\\n if (newBranchId_ == 0) {\\n // initializing a new branch\\n // newBranchId_ = total current branches + 1\\n unchecked {\\n newBranchId_ = ((vaultVariables_ >> 52) & X30) + 1;\\n }\\n vaultVariables_ =\\n ((vaultVariables_ >> 82) << 82) |\\n (temp2_ << 2) |\\n (newBranchId_ << 22) |\\n (newBranchId_ << 52);\\n } else {\\n // using already initialized non liquidated branch\\n vaultVariables_ = ((vaultVariables_ >> 22) << 22) | (temp2_ << 2);\\n }\\n\\n if (branch_.minimaTick > type(int).min) {\\n temp2_ = branch_.minimaTick < 0\\n ? (uint(-branch_.minimaTick) << 1)\\n : ((uint(branch_.minimaTick) << 1) | 1);\\n // set base branch id and minima tick\\n branchData[newBranchId_] = (branch_.id << 166) | (temp2_ << 196);\\n } else {\\n // new base branch does not have any connected branch\\n branchData[newBranchId_] = 0;\\n }\\n } else {\\n // new top tick is liquidated\\n temp2_ = branch_.minimaTick < 0\\n ? (uint(-branch_.minimaTick) << 1)\\n : ((uint(branch_.minimaTick) << 1) | 1);\\n if (newBranchId_ == 0) {\\n vaultVariables_ = ((vaultVariables_ >> 52) << 52) | 2 | (temp2_ << 2) | (branch_.id << 22);\\n } else {\\n // uninitializing the non liquidated branch\\n vaultVariables_ =\\n ((vaultVariables_ >> 82) << 82) |\\n 2 |\\n (temp2_ << 2) |\\n (branch_.id << 22) |\\n ((newBranchId_ - 1) << 52); // decreasing total branch by 1\\n branchData[newBranchId_] = 0;\\n }\\n }\\n }\\n\\n // updating absorbed liquidity on storage\\n absorbedLiquidity = absorbedLiquidity + a_.debtAbsorbed + (a_.colAbsorbed << 128);\\n\\n emit LogAbsorb(a_.colAbsorbed, a_.debtAbsorbed);\\n\\n // returning updated vault variables\\n return vaultVariables_;\\n }\\n\\n /// @dev Checks total supply of vault's in Liquidity Layer & Vault contract and rebalance it accordingly\\n /// if vault supply is more than Liquidity Layer then deposit difference through reserve/rebalance contract\\n /// if vault supply is less than Liquidity Layer then withdraw difference to reserve/rebalance contract\\n /// if vault borrow is more than Liquidity Layer then borrow difference to reserve/rebalance contract\\n /// if vault borrow is less than Liquidity Layer then payback difference through reserve/rebalance contract\\n function rebalance() external payable _verifyCaller returns (int supplyAmt_, int borrowAmt_) {\\n if (msg.sender != rebalancer) {\\n revert FluidVaultError(ErrorTypes.VaultT1__NotRebalancer);\\n }\\n\\n uint vaultVariables_ = vaultVariables;\\n // ############# turning re-entrancy bit on #############\\n if (vaultVariables_ & 1 == 0) {\\n // Updating on storage\\n vaultVariables = vaultVariables_ | 1;\\n } else {\\n revert FluidVaultError(ErrorTypes.VaultT1__AlreadyEntered);\\n }\\n\\n IFluidVaultT1.ConstantViews memory constants_ = IFluidVaultT1(address(this)).constantsView();\\n\\n if (msg.value > 0 && !(constants_.supplyToken == NATIVE_TOKEN || constants_.borrowToken == NATIVE_TOKEN)) {\\n revert FluidVaultError(ErrorTypes.VaultT1__InvalidMsgValueInRebalance);\\n }\\n\\n IFluidLiquidity liquidity_ = IFluidLiquidity(constants_.liquidity);\\n RebalanceMemoryVariables memory r_;\\n\\n (r_.liqSupplyExPrice, r_.liqBorrowExPrice, r_.vaultSupplyExPrice, r_.vaultBorrowExPrice) = IFluidVaultT1(\\n address(this)\\n ).updateExchangePrices(vaultVariables2);\\n\\n // extract vault supply at Liquidity -> 64 bits starting from bit 1 (first bit is interest mode)\\n uint totalSupplyLiquidity_ = (liquidity_.readFromStorage(constants_.liquidityUserSupplySlot) >>\\n LiquiditySlotsLink.BITS_USER_SUPPLY_AMOUNT) & X64;\\n totalSupplyLiquidity_ = (totalSupplyLiquidity_ >> 8) << (totalSupplyLiquidity_ & X8);\\n totalSupplyLiquidity_ =\\n (totalSupplyLiquidity_ * r_.liqSupplyExPrice) /\\n LiquidityCalcs.EXCHANGE_PRICES_PRECISION;\\n\\n // extract vault borrowings at Liquidity -> 64 bits starting from bit 1 (first bit is interest mode)\\n uint totalBorrowLiquidity_ = (liquidity_.readFromStorage(constants_.liquidityUserBorrowSlot) >>\\n LiquiditySlotsLink.BITS_USER_BORROW_AMOUNT) & X64;\\n totalBorrowLiquidity_ = (totalBorrowLiquidity_ >> 8) << (totalBorrowLiquidity_ & X8);\\n totalBorrowLiquidity_ =\\n (totalBorrowLiquidity_ * r_.liqBorrowExPrice) /\\n LiquidityCalcs.EXCHANGE_PRICES_PRECISION;\\n\\n uint totalSupplyVault_ = (vaultVariables_ >> 82) & X64;\\n totalSupplyVault_ = (totalSupplyVault_ >> 8) << (totalSupplyVault_ & X8);\\n totalSupplyVault_ = (totalSupplyVault_ * r_.vaultSupplyExPrice) / LiquidityCalcs.EXCHANGE_PRICES_PRECISION;\\n\\n uint totalBorrowVault_ = (vaultVariables_ >> 146) & X64;\\n totalBorrowVault_ = (totalBorrowVault_ >> 8) << (totalBorrowVault_ & X8);\\n totalBorrowVault_ = (totalBorrowVault_ * r_.vaultBorrowExPrice) / LiquidityCalcs.EXCHANGE_PRICES_PRECISION;\\n\\n uint value_;\\n\\n if (totalSupplyVault_ > totalSupplyLiquidity_) {\\n // Fetch tokens from revenue/rebalance contract and supply in liquidity contract\\n // This is the scenario when the supply rewards are going in vault, hence\\n // the vault total supply is increasing at a higher pace than Liquidity contract.\\n // We are not transferring rewards right when we set the rewards to keep things clean.\\n // Also, this can also happen in case when supply rate magnifier is greater than 1.\\n\\n supplyAmt_ = int(totalSupplyVault_) - int(totalSupplyLiquidity_);\\n\\n if (constants_.supplyToken == NATIVE_TOKEN) {\\n if (msg.value > uint(supplyAmt_)) {\\n value_ = uint(supplyAmt_);\\n SafeTransfer.safeTransferNative(msg.sender, msg.value - value_); // sending back excess ETH\\n } else {\\n value_ = msg.value; // setting amount as msg.value\\n }\\n supplyAmt_ = int(value_);\\n } else {\\n value_ = 0;\\n }\\n\\n try liquidity_.operate{ value: value_ }(\\n constants_.supplyToken,\\n supplyAmt_,\\n 0,\\n address(0),\\n address(0),\\n abi.encode(rebalancer)\\n ) {\\n // if success then do nothing\\n } catch {\\n supplyAmt_ = 0;\\n }\\n\\n \\n } else if (totalSupplyLiquidity_ > totalSupplyVault_) {\\n if (constants_.supplyToken == NATIVE_TOKEN && msg.value > 0) {\\n revert FluidVaultError(ErrorTypes.VaultT1__InvalidMsgValueInRebalance);\\n }\\n // Withdraw from Liquidity contract and send it to revenue contract.\\n // This is the scenario when the vault user's are getting less ETH APR than what's going on Liquidity contract.\\n // When supply rate magnifier is less than 1.\\n supplyAmt_ = int(totalSupplyVault_) - int(totalSupplyLiquidity_);\\n try liquidity_.operate(constants_.supplyToken, supplyAmt_, 0, rebalancer, address(0), new bytes(0)) {\\n // if success then do nothing\\n } catch {\\n supplyAmt_ = 0;\\n }\\n }\\n\\n if (totalBorrowVault_ > totalBorrowLiquidity_) {\\n if (constants_.borrowToken == NATIVE_TOKEN && msg.value > 0) {\\n revert FluidVaultError(ErrorTypes.VaultT1__InvalidMsgValueInRebalance);\\n }\\n // Borrow from Liquidity contract and send to revenue/rebalance contract\\n // This is the scenario when the vault is charging more borrow to user than the Liquidity contract.\\n // When borrow rate magnifier is greater than 1.\\n borrowAmt_ = int(totalBorrowVault_) - int(totalBorrowLiquidity_);\\n try liquidity_.operate(constants_.borrowToken, 0, borrowAmt_, address(0), rebalancer, new bytes(0)) {\\n // if success then do nothing\\n } catch {\\n borrowAmt_ = 0;\\n }\\n } else if (totalBorrowLiquidity_ > totalBorrowVault_) {\\n // Transfer from revenue/rebalance contract and payback on Liquidity contract\\n // This is the scenario when vault protocol is earning rewards so effective borrow rate for users is low.\\n // Or the case where borrow rate magnifier is less than 1\\n\\n borrowAmt_ = int(totalBorrowLiquidity_) - int(totalBorrowVault_);\\n\\n if (constants_.borrowToken == NATIVE_TOKEN) {\\n if (msg.value > uint(borrowAmt_)) {\\n value_ = uint(borrowAmt_);\\n SafeTransfer.safeTransferNative(msg.sender, msg.value - value_);\\n } else {\\n value_ = msg.value; // setting amount as msg.value\\n }\\n borrowAmt_ = int(value_);\\n } else {\\n value_ = 0;\\n }\\n\\n borrowAmt_ = -borrowAmt_;\\n\\n try liquidity_.operate{ value: value_ }(\\n constants_.borrowToken,\\n 0,\\n borrowAmt_,\\n address(0),\\n address(0),\\n abi.encode(rebalancer)\\n ) {\\n // if success then do nothing\\n } catch {\\n borrowAmt_ = 0;\\n }\\n }\\n\\n if (supplyAmt_ == 0 && borrowAmt_ == 0) {\\n revert FluidVaultError(ErrorTypes.VaultT1__NothingToRebalance);\\n }\\n\\n // Updating vault variable on storage to turn off the reentrancy bit\\n vaultVariables = vaultVariables_;\\n\\n emit LogRebalance(supplyAmt_, borrowAmt_);\\n }\\n}\\n\",\"keccak256\":\"0x5f3e253447acb54cffbe9c56e559b77457daa103e43568973ef2e55e325ebfcd\",\"license\":\"BUSL-1.1\"},\"contracts/protocols/vault/vaultT1/coreModule/structs.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity 0.8.21;\\n\\ncontract Structs {\\n // structs are used to mitigate Stack too deep errors\\n\\n struct OperateMemoryVars {\\n // ## User's position before update ##\\n uint oldColRaw;\\n uint oldNetDebtRaw; // total debt - dust debt\\n int oldTick;\\n // ## User's position after update ##\\n uint colRaw;\\n uint debtRaw;\\n uint dustDebtRaw;\\n int tick;\\n uint tickId;\\n // others\\n uint256 vaultVariables2;\\n uint256 branchId;\\n int256 topTick;\\n uint liquidityExPrice;\\n uint supplyExPrice;\\n uint borrowExPrice;\\n uint branchData;\\n // user's supply slot data in liquidity\\n uint userSupplyLiquidityData;\\n }\\n\\n struct BranchData {\\n uint id;\\n uint data;\\n uint ratio;\\n uint debtFactor;\\n int minimaTick;\\n uint baseBranchData;\\n }\\n\\n struct TickData {\\n int tick;\\n uint data;\\n uint ratio;\\n uint ratioOneLess;\\n uint length;\\n uint currentRatio; // current tick is ratio with partials.\\n uint partials;\\n }\\n\\n // note: All the below token amounts are in raw form.\\n struct CurrentLiquidity {\\n uint256 debtRemaining; // Debt remaining to liquidate\\n uint256 debt; // Current liquidatable debt before reaching next check point\\n uint256 col; // Calculate using debt & ratioCurrent\\n uint256 colPerDebt; // How much collateral to liquidate per unit of Debt\\n uint256 totalDebtLiq; // Total debt liquidated till now\\n uint256 totalColLiq; // Total collateral liquidated till now\\n int tick; // Current tick to liquidate\\n uint ratio; // Current ratio to liquidate\\n uint tickStatus; // if 1 then it's a perfect tick, if 2 that means it's a liquidated tick\\n int refTick; // ref tick to liquidate\\n uint refRatio; // ratio at ref tick\\n uint refTickStatus; // if 1 then it's a perfect tick, if 2 that means it's a liquidated tick, if 3 that means it's a liquidation threshold\\n }\\n\\n struct TickHasDebt {\\n int tick; // current tick\\n int nextTick; // next tick with liquidity\\n int mapId; // mapping ID of tickHasDebt\\n uint bitsToRemove; // liquidity to remove till tick_ so we can search for next tick\\n uint tickHasDebt; // getting tickHasDebt_ from tickHasDebt[mapId_]\\n uint mostSigBit; // most significant bit in tickHasDebt_ to get the next tick\\n }\\n\\n struct LiquidateMemoryVars {\\n uint256 vaultVariables2;\\n int liquidationTick;\\n int maxTick;\\n uint256 supplyExPrice;\\n uint256 borrowExPrice;\\n }\\n\\n struct AbsorbMemoryVariables {\\n uint256 debtAbsorbed;\\n uint256 colAbsorbed;\\n int256 startingTick;\\n uint256 mostSigBit;\\n }\\n\\n struct ConstantViews {\\n address liquidity;\\n address factory;\\n address adminImplementation;\\n address secondaryImplementation;\\n address supplyToken;\\n address borrowToken;\\n uint8 supplyDecimals;\\n uint8 borrowDecimals;\\n uint vaultId;\\n bytes32 liquiditySupplyExchangePriceSlot;\\n bytes32 liquidityBorrowExchangePriceSlot;\\n bytes32 liquidityUserSupplySlot;\\n bytes32 liquidityUserBorrowSlot;\\n }\\n\\n struct RebalanceMemoryVariables {\\n uint256 liqSupplyExPrice;\\n uint256 liqBorrowExPrice;\\n uint256 vaultSupplyExPrice;\\n uint256 vaultBorrowExPrice;\\n }\\n}\\n\",\"keccak256\":\"0xcd3160a62445eaf106ad9f598fe6f5ef06621a5cd3e7d80b0f59ac4a396a6c7a\",\"license\":\"BUSL-1.1\"}},\"version\":1}",
|
|
"bytecode": "0x60a060405234801561001057600080fd5b5030608052608051611e386100366000396000818160980152610c6d0152611e386000f3fe6080604052600436106100295760003560e01c80637d7c2a1c1461002e5780639e3e482114610050575b600080fd5b61003661007e565b604080519283526020830191909152015b60405180910390f35b34801561005c57600080fd5b5061007061006b366004611907565b610c54565b604051908152602001610047565b60008073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001630036100f9576040517f60121cca00000000000000000000000000000000000000000000000000000000815261792b60048201526024015b60405180910390fd5b60095473ffffffffffffffffffffffffffffffffffffffff16331461014e576040517f60121cca00000000000000000000000000000000000000000000000000000000815261792260048201526024016100f0565b6000805490600182169003610169576001811760005561019f565b6040517f60121cca00000000000000000000000000000000000000000000000000000000815261791960048201526024016100f0565b60003073ffffffffffffffffffffffffffffffffffffffff1663b7791bf26040518163ffffffff1660e01b81526004016101a060405180830381865afa1580156101ed573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061021191906119b4565b90506000341180156102895750608081015173ffffffffffffffffffffffffffffffffffffffff1673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1480610287575060a081015173ffffffffffffffffffffffffffffffffffffffff1673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee145b155b156102c4576040517f60121cca00000000000000000000000000000000000000000000000000000000815261793660048201526024016100f0565b805160408051608081018252600080825260208201819052818301819052606082015260015491517f09f0d8cb00000000000000000000000000000000000000000000000000000000815260048101929092529030906309f0d8cb90602401608060405180830381865afa158015610340573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103649190611a91565b6060850152604080850191909152602084019190915290825261016084015190517fb5c736e400000000000000000000000000000000000000000000000000000000815260009167ffffffffffffffff9160019173ffffffffffffffffffffffffffffffffffffffff87169163b5c736e4916103e69160040190815260200190565b602060405180830381865afa158015610403573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104279190611ac7565b8451911c91909116600881901c60ff9091161b915064e8d4a510009061044d9083611b0f565b6104579190611b55565b9050600067ffffffffffffffff60018573ffffffffffffffffffffffffffffffffffffffff1663b5c736e48861018001516040518263ffffffff1660e01b81526004016104a691815260200190565b602060405180830381865afa1580156104c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104e79190611ac7565b901c16905060ff8116600882901c901b905064e8d4a5100083602001518261050f9190611b0f565b6105199190611b55565b604084015190915066ffffffffffffff605a88901c1660ff605289901c161b9064e8d4a510009061054a9083611b0f565b6105549190611b55565b606085015190915066ffffffffffffff609a89901c1660ff60928a901c161b9064e8d4a51000906105859083611b0f565b61058f9190611b55565b9050600084831115610736576105a58584611b69565b9a5073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee73ffffffffffffffffffffffffffffffffffffffff16886080015173ffffffffffffffffffffffffffffffffffffffff160361061f578a34111561061457508961060f3361060a8334611b90565b6115a0565b610617565b50345b809a50610623565b5060005b8673ffffffffffffffffffffffffffffffffffffffff1663ad967e15828a608001518e6000806000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660405160200161069a919073ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b6040516020818303038152906040526040518863ffffffff1660e01b81526004016106ca96959493929190611c07565b604080518083038185885af193505050508015610722575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820190925261071f91810190611c60565b60015b61072f5760009a506108a7565b50506108a7565b828511156108a757608088015173ffffffffffffffffffffffffffffffffffffffff1673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14801561077b5750600034115b156107b6576040517f60121cca00000000000000000000000000000000000000000000000000000000815261793660048201526024016100f0565b6107c08584611b69565b6080890151600954919c5073ffffffffffffffffffffffffffffffffffffffff808a169263ad967e1592918f916000911681806040519080825280601f01601f19166020018201604052801561081d576020820181803683370190505b506040518763ffffffff1660e01b815260040161083f96959493929190611c07565b60408051808303816000875af1925050508015610897575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820190925261089491810190611c60565b60015b6108a45760009a506108a7565b50505b83821115610a1d5760a088015173ffffffffffffffffffffffffffffffffffffffff1673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1480156108ec5750600034115b15610927576040517f60121cca00000000000000000000000000000000000000000000000000000000815261793660048201526024016100f0565b6109318483611b69565b60a0890151600954919b5073ffffffffffffffffffffffffffffffffffffffff808a169263ad967e1592916000918f91839116816040519080825280601f01601f19166020018201604052801561098f576020820181803683370190505b506040518763ffffffff1660e01b81526004016109b196959493929190611c07565b60408051808303816000875af1925050508015610a09575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201909252610a0691810190611c60565b60015b610a165760009950610bc2565b5050610bc2565b81841115610bc257610a2f8285611b69565b995073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee73ffffffffffffffffffffffffffffffffffffffff168860a0015173ffffffffffffffffffffffffffffffffffffffff1603610aa45789341115610a99575088610a943361060a8334611b90565b610a9c565b50345b809950610aa8565b5060005b610ab18a611c84565b99508673ffffffffffffffffffffffffffffffffffffffff1663ad967e15828a60a0015160008e600080600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16604051602001610b2a919073ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b6040516020818303038152906040526040518863ffffffff1660e01b8152600401610b5a96959493929190611c07565b604080518083038185885af193505050508015610bb2575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201909252610baf91810190611c60565b60015b610bbf5760009950610bc2565b50505b8a158015610bce575089155b15610c09576040517f60121cca00000000000000000000000000000000000000000000000000000000815261793760048201526024016100f0565b6000899055604080518c8152602081018c90527f9a85dfb89c634cdc63db5d8cedaf8f9cfa4926df888bad563d70b7314a33a0ae910160405180910390a15050505050505050509091565b600073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000163003610cc9576040517f60121cca00000000000000000000000000000000000000000000000000000000815261792b60048201526024016100f0565b610cf46040518060800160405280600081526020016000815260200160008152602001600081525090565b600080610d306040518060c001604052806000815260200160008152602001600081526020016000815260200160008152602001600081525090565b620fffff600288901c16925082600116600114610d6457610d54600184901c611c84565b610d5f906001611cbc565b610d72565b610d72600184811c90611cbc565b60408501819052600013610d97576101008460400151610d929190611ce4565b610dc1565b600161010085604001516001610dad9190611cbc565b610db79190611ce4565b610dc19190611b69565b60408083018290526000918252600460209081529120546080830152617fff908201525b608081015115610f7257610dfc81608001516115ef565b60608501819052604082015160019190610e1890610100611d4c565b610e229190611cbc565b610e2c9190611b69565b60208201525b8581602001511315610f5a57602080820151600090815260059091526040902054845190935066ffffffffffffff602185901c1660ff601986901c161b925082908590610e80908390611d98565b9052506020810151610e949060020b6116a5565b610eab6c0100000000000000000000000084611b0f565b610eb59190611b55565b84602001818151610ec69190611d98565b905250602080820151600090815260059091526040902063020000016301fffffe85161790556060840151610efd90610101611b90565b608082018051821b821c9081905290935015610f5a57610f2081608001516115ef565b60608501819052604082015160019190610f3c90610100611d4c565b610f469190611cbc565b610f509190611b69565b6020820152610e32565b60808101516040808301516000908152600460205220555b8581602001511315611007577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f81604001511215610fd5577f80000000000000000000000000000000000000000000000000000000000000006020820152611007565b60046000826040018051610fe890611dab565b9081905281526020810191909152604001600020546080820152610de5565b6110476040518060e00160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6110806040518060c001604052806000815260200160008152602001600081526020016000815260200160008152602001600081525090565b601689901c633fffffff1680825260009081526007602090815260408220549083015260028a16810361114b57508051602082015160c41c620fffff1695508515611116576020808301805160a61c633fffffff1680855260009081526007909252604090912054905260018087161461110657611101600187901c611c84565b61110c565b600186901c5b6080830152611184565b600080835260208301527f80000000000000000000000000000000000000000000000000000000000000006080830152611184565b620fffff60028360200151901c1695508560011660011461117857611173600187901c611c84565b61117e565b600186901c5b60808301525b8882608001511315611301576111a0826080015160020b6116a5565b6040840181905261271f906111b790612710611b0f565b6111c19190611b55565b6060840181905260408401516111d79190611b90565b60808401819052602083015160161c633fffffff90811660c0860181905290916112019190611b0f565b61120b9190611b55565b836060015161121a9190611d98565b8360a001818152505067ffffffffffffffff60348360200151901c16945060ff8516600886901c901b945084876000018181516112579190611d98565b90525060a08301516112766c0100000000000000000000000087611b0f565b6112809190611b55565b876020018181516112919190611d98565b90525060208083018051845160009081526007909352604090922060039092179091555160c41c620fffff1695508515611116576020808301805160a61c633fffffff1680855260009081526007909252604090912054905260018087161461110657611101600187901c611c84565b8160800151846020015112611472577f8000000000000000000000000000000000000000000000000000000000000000846020015113156113735760008460200151126113595760018460200151901b60011761136c565b6001846020015161136990611c84565b901b5b9450611378565b600094505b806000036113b157633fffffff60348b901c166001019050603481901b601682901b600287901b6052808e901c901b17171799506113dd565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc00000909916600285901b17985b7f80000000000000000000000000000000000000000000000000000000000000008260800151131561145e5760008260800151126114265760018260800151901b600117611439565b6001826080015161143690611c84565b901b5b8251600083815260076020526040902060a69190911b60c483901b1790559450611529565b600081815260076020526040812055611529565b600082608001511261148f5760018260800151901b6001176114a2565b6001826080015161149f90611c84565b901b5b9450806000036114ce5760168260000151901b600286901b6034808d901c901b60021717179950611529565b60346114db600183611b90565b8351600084815260076020526040812055911b60169190911b600287811b7ffffffffffffffffffffffffffffffffffffffffffffc000000000000000000009d909d169c909c171717909917985b50505060808460200151901b84600001516002546115479190611d98565b6115519190611d98565b600255602084810151855160408051928352928201527f115609402b8e0707cb9654c5da38e5c0790ccad443a92f71160fe645aa342d04910160405180910390a1869450505050505b92915050565b600080600080600085875af19050806115ea576040517fdee51a8a0000000000000000000000000000000000000000000000000000000081526201155a60048201526024016100f0565b505050565b6000816fffffffffffffffffffffffffffffffff8311156116115760809150811c5b67ffffffffffffffff811115611629576040918201911c5b63ffffffff81111561163d576020918201911c5b61ffff81111561164f576010918201911c5b60ff811115611660576008918201911c5b600f811115611671576004918201911c5b6003811115611682576002918201911c5b6001811115611692576001820191505b801561169f576001820191505b50919050565b600060ff82901d80831803617fff8111156116bf57600080fd5b70010000000000000000000000000000000060018216156116ed57506fff9dd7de423466c20352b1246ce4856f5b600282161561170c576fff3bd55f4488ad277531fa1c725a66d00260801c5b600482161561172b576ffe78410fd6498b73cb96a6917f8532590260801c5b600882161561174a576ffcf2d9987c9be178ad5bfeffaa1232730260801c5b6010821615611769576ff9ef02c4529258b057769680fc6601b30260801c5b6020821615611788576ff402d288133a85a17784a411f7aba0820260801c5b60408216156117a7576fe895615b5beb6386553757b0352bda900260801c5b60808216156117c6576fd34f17a00ffa00a8309940a15930391a0260801c5b6101008216156117e6576fae6b7961714e20548d88ea5123f9a0ff0260801c5b610200821615611806576f76d6461f27082d74e0feed3b388c0ca10260801c5b610400821615611826576f372a3bfe0745d8b6b19d985d9a8b85bb0260801c5b610800821615611846576f0be32cbee48979763cf7247dd7bb539d0260801c5b611000821615611865576e8d4f70c9ff4924dac37612d1e2921e0260801c5b612000821615611883576d4e009ae5519380809a02ca7aec770260801c5b61400082161561189f576b17c45e641b6e95dee056ff100260801c5b600091507f800000000000000000000000000000000000000000000000000000000000000084166118fd577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0463ffffffff8116156118fd57600191505b60201c0192915050565b6000806040838503121561191a57600080fd5b50508035926020909101359150565b6040516101a0810167ffffffffffffffff81118282101715611974577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405290565b805173ffffffffffffffffffffffffffffffffffffffff8116811461199e57600080fd5b919050565b805160ff8116811461199e57600080fd5b60006101a082840312156119c757600080fd5b6119cf611929565b6119d88361197a565b81526119e66020840161197a565b60208201526119f76040840161197a565b6040820152611a086060840161197a565b6060820152611a196080840161197a565b6080820152611a2a60a0840161197a565b60a0820152611a3b60c084016119a3565b60c0820152611a4c60e084016119a3565b60e08201526101008381015190820152610120808401519082015261014080840151908201526101608084015190820152610180928301519281019290925250919050565b60008060008060808587031215611aa757600080fd5b505082516020840151604085015160609095015191969095509092509050565b600060208284031215611ad957600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b808202811582820484141761159a5761159a611ae0565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600082611b6457611b64611b26565b500490565b8181036000831280158383131683831282161715611b8957611b89611ae0565b5092915050565b8181038181111561159a5761159a611ae0565b6000815180845260005b81811015611bc957602081850181015186830182015201611bad565b5060006020828601015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010191505092915050565b600073ffffffffffffffffffffffffffffffffffffffff8089168352876020840152866040840152808616606084015280851660808401525060c060a0830152611c5460c0830184611ba3565b98975050505050505050565b60008060408385031215611c7357600080fd5b505080516020909101519092909150565b60007f80000000000000000000000000000000000000000000000000000000000000008203611cb557611cb5611ae0565b5060000390565b8082018281126000831280158216821582161715611cdc57611cdc611ae0565b505092915050565b600082611cf357611cf3611b26565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83147f800000000000000000000000000000000000000000000000000000000000000083141615611d4757611d47611ae0565b500590565b808202600082127f800000000000000000000000000000000000000000000000000000000000000084141615611d8457611d84611ae0565b818105831482151761159a5761159a611ae0565b8082018082111561159a5761159a611ae0565b60007f80000000000000000000000000000000000000000000000000000000000000008203611ddc57611ddc611ae0565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019056fea26469706673582212205bfa6f9e9c8e95098eb9a71545e1912e65d0f19cdfead469872641bc8940b13364736f6c63430008150033",
|
|
"deployedBytecode": "0x6080604052600436106100295760003560e01c80637d7c2a1c1461002e5780639e3e482114610050575b600080fd5b61003661007e565b604080519283526020830191909152015b60405180910390f35b34801561005c57600080fd5b5061007061006b366004611907565b610c54565b604051908152602001610047565b60008073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001630036100f9576040517f60121cca00000000000000000000000000000000000000000000000000000000815261792b60048201526024015b60405180910390fd5b60095473ffffffffffffffffffffffffffffffffffffffff16331461014e576040517f60121cca00000000000000000000000000000000000000000000000000000000815261792260048201526024016100f0565b6000805490600182169003610169576001811760005561019f565b6040517f60121cca00000000000000000000000000000000000000000000000000000000815261791960048201526024016100f0565b60003073ffffffffffffffffffffffffffffffffffffffff1663b7791bf26040518163ffffffff1660e01b81526004016101a060405180830381865afa1580156101ed573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061021191906119b4565b90506000341180156102895750608081015173ffffffffffffffffffffffffffffffffffffffff1673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1480610287575060a081015173ffffffffffffffffffffffffffffffffffffffff1673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee145b155b156102c4576040517f60121cca00000000000000000000000000000000000000000000000000000000815261793660048201526024016100f0565b805160408051608081018252600080825260208201819052818301819052606082015260015491517f09f0d8cb00000000000000000000000000000000000000000000000000000000815260048101929092529030906309f0d8cb90602401608060405180830381865afa158015610340573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103649190611a91565b6060850152604080850191909152602084019190915290825261016084015190517fb5c736e400000000000000000000000000000000000000000000000000000000815260009167ffffffffffffffff9160019173ffffffffffffffffffffffffffffffffffffffff87169163b5c736e4916103e69160040190815260200190565b602060405180830381865afa158015610403573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104279190611ac7565b8451911c91909116600881901c60ff9091161b915064e8d4a510009061044d9083611b0f565b6104579190611b55565b9050600067ffffffffffffffff60018573ffffffffffffffffffffffffffffffffffffffff1663b5c736e48861018001516040518263ffffffff1660e01b81526004016104a691815260200190565b602060405180830381865afa1580156104c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104e79190611ac7565b901c16905060ff8116600882901c901b905064e8d4a5100083602001518261050f9190611b0f565b6105199190611b55565b604084015190915066ffffffffffffff605a88901c1660ff605289901c161b9064e8d4a510009061054a9083611b0f565b6105549190611b55565b606085015190915066ffffffffffffff609a89901c1660ff60928a901c161b9064e8d4a51000906105859083611b0f565b61058f9190611b55565b9050600084831115610736576105a58584611b69565b9a5073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee73ffffffffffffffffffffffffffffffffffffffff16886080015173ffffffffffffffffffffffffffffffffffffffff160361061f578a34111561061457508961060f3361060a8334611b90565b6115a0565b610617565b50345b809a50610623565b5060005b8673ffffffffffffffffffffffffffffffffffffffff1663ad967e15828a608001518e6000806000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660405160200161069a919073ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b6040516020818303038152906040526040518863ffffffff1660e01b81526004016106ca96959493929190611c07565b604080518083038185885af193505050508015610722575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820190925261071f91810190611c60565b60015b61072f5760009a506108a7565b50506108a7565b828511156108a757608088015173ffffffffffffffffffffffffffffffffffffffff1673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14801561077b5750600034115b156107b6576040517f60121cca00000000000000000000000000000000000000000000000000000000815261793660048201526024016100f0565b6107c08584611b69565b6080890151600954919c5073ffffffffffffffffffffffffffffffffffffffff808a169263ad967e1592918f916000911681806040519080825280601f01601f19166020018201604052801561081d576020820181803683370190505b506040518763ffffffff1660e01b815260040161083f96959493929190611c07565b60408051808303816000875af1925050508015610897575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820190925261089491810190611c60565b60015b6108a45760009a506108a7565b50505b83821115610a1d5760a088015173ffffffffffffffffffffffffffffffffffffffff1673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1480156108ec5750600034115b15610927576040517f60121cca00000000000000000000000000000000000000000000000000000000815261793660048201526024016100f0565b6109318483611b69565b60a0890151600954919b5073ffffffffffffffffffffffffffffffffffffffff808a169263ad967e1592916000918f91839116816040519080825280601f01601f19166020018201604052801561098f576020820181803683370190505b506040518763ffffffff1660e01b81526004016109b196959493929190611c07565b60408051808303816000875af1925050508015610a09575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201909252610a0691810190611c60565b60015b610a165760009950610bc2565b5050610bc2565b81841115610bc257610a2f8285611b69565b995073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee73ffffffffffffffffffffffffffffffffffffffff168860a0015173ffffffffffffffffffffffffffffffffffffffff1603610aa45789341115610a99575088610a943361060a8334611b90565b610a9c565b50345b809950610aa8565b5060005b610ab18a611c84565b99508673ffffffffffffffffffffffffffffffffffffffff1663ad967e15828a60a0015160008e600080600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16604051602001610b2a919073ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b6040516020818303038152906040526040518863ffffffff1660e01b8152600401610b5a96959493929190611c07565b604080518083038185885af193505050508015610bb2575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201909252610baf91810190611c60565b60015b610bbf5760009950610bc2565b50505b8a158015610bce575089155b15610c09576040517f60121cca00000000000000000000000000000000000000000000000000000000815261793760048201526024016100f0565b6000899055604080518c8152602081018c90527f9a85dfb89c634cdc63db5d8cedaf8f9cfa4926df888bad563d70b7314a33a0ae910160405180910390a15050505050505050509091565b600073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000163003610cc9576040517f60121cca00000000000000000000000000000000000000000000000000000000815261792b60048201526024016100f0565b610cf46040518060800160405280600081526020016000815260200160008152602001600081525090565b600080610d306040518060c001604052806000815260200160008152602001600081526020016000815260200160008152602001600081525090565b620fffff600288901c16925082600116600114610d6457610d54600184901c611c84565b610d5f906001611cbc565b610d72565b610d72600184811c90611cbc565b60408501819052600013610d97576101008460400151610d929190611ce4565b610dc1565b600161010085604001516001610dad9190611cbc565b610db79190611ce4565b610dc19190611b69565b60408083018290526000918252600460209081529120546080830152617fff908201525b608081015115610f7257610dfc81608001516115ef565b60608501819052604082015160019190610e1890610100611d4c565b610e229190611cbc565b610e2c9190611b69565b60208201525b8581602001511315610f5a57602080820151600090815260059091526040902054845190935066ffffffffffffff602185901c1660ff601986901c161b925082908590610e80908390611d98565b9052506020810151610e949060020b6116a5565b610eab6c0100000000000000000000000084611b0f565b610eb59190611b55565b84602001818151610ec69190611d98565b905250602080820151600090815260059091526040902063020000016301fffffe85161790556060840151610efd90610101611b90565b608082018051821b821c9081905290935015610f5a57610f2081608001516115ef565b60608501819052604082015160019190610f3c90610100611d4c565b610f469190611cbc565b610f509190611b69565b6020820152610e32565b60808101516040808301516000908152600460205220555b8581602001511315611007577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f81604001511215610fd5577f80000000000000000000000000000000000000000000000000000000000000006020820152611007565b60046000826040018051610fe890611dab565b9081905281526020810191909152604001600020546080820152610de5565b6110476040518060e00160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6110806040518060c001604052806000815260200160008152602001600081526020016000815260200160008152602001600081525090565b601689901c633fffffff1680825260009081526007602090815260408220549083015260028a16810361114b57508051602082015160c41c620fffff1695508515611116576020808301805160a61c633fffffff1680855260009081526007909252604090912054905260018087161461110657611101600187901c611c84565b61110c565b600186901c5b6080830152611184565b600080835260208301527f80000000000000000000000000000000000000000000000000000000000000006080830152611184565b620fffff60028360200151901c1695508560011660011461117857611173600187901c611c84565b61117e565b600186901c5b60808301525b8882608001511315611301576111a0826080015160020b6116a5565b6040840181905261271f906111b790612710611b0f565b6111c19190611b55565b6060840181905260408401516111d79190611b90565b60808401819052602083015160161c633fffffff90811660c0860181905290916112019190611b0f565b61120b9190611b55565b836060015161121a9190611d98565b8360a001818152505067ffffffffffffffff60348360200151901c16945060ff8516600886901c901b945084876000018181516112579190611d98565b90525060a08301516112766c0100000000000000000000000087611b0f565b6112809190611b55565b876020018181516112919190611d98565b90525060208083018051845160009081526007909352604090922060039092179091555160c41c620fffff1695508515611116576020808301805160a61c633fffffff1680855260009081526007909252604090912054905260018087161461110657611101600187901c611c84565b8160800151846020015112611472577f8000000000000000000000000000000000000000000000000000000000000000846020015113156113735760008460200151126113595760018460200151901b60011761136c565b6001846020015161136990611c84565b901b5b9450611378565b600094505b806000036113b157633fffffff60348b901c166001019050603481901b601682901b600287901b6052808e901c901b17171799506113dd565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc00000909916600285901b17985b7f80000000000000000000000000000000000000000000000000000000000000008260800151131561145e5760008260800151126114265760018260800151901b600117611439565b6001826080015161143690611c84565b901b5b8251600083815260076020526040902060a69190911b60c483901b1790559450611529565b600081815260076020526040812055611529565b600082608001511261148f5760018260800151901b6001176114a2565b6001826080015161149f90611c84565b901b5b9450806000036114ce5760168260000151901b600286901b6034808d901c901b60021717179950611529565b60346114db600183611b90565b8351600084815260076020526040812055911b60169190911b600287811b7ffffffffffffffffffffffffffffffffffffffffffffc000000000000000000009d909d169c909c171717909917985b50505060808460200151901b84600001516002546115479190611d98565b6115519190611d98565b600255602084810151855160408051928352928201527f115609402b8e0707cb9654c5da38e5c0790ccad443a92f71160fe645aa342d04910160405180910390a1869450505050505b92915050565b600080600080600085875af19050806115ea576040517fdee51a8a0000000000000000000000000000000000000000000000000000000081526201155a60048201526024016100f0565b505050565b6000816fffffffffffffffffffffffffffffffff8311156116115760809150811c5b67ffffffffffffffff811115611629576040918201911c5b63ffffffff81111561163d576020918201911c5b61ffff81111561164f576010918201911c5b60ff811115611660576008918201911c5b600f811115611671576004918201911c5b6003811115611682576002918201911c5b6001811115611692576001820191505b801561169f576001820191505b50919050565b600060ff82901d80831803617fff8111156116bf57600080fd5b70010000000000000000000000000000000060018216156116ed57506fff9dd7de423466c20352b1246ce4856f5b600282161561170c576fff3bd55f4488ad277531fa1c725a66d00260801c5b600482161561172b576ffe78410fd6498b73cb96a6917f8532590260801c5b600882161561174a576ffcf2d9987c9be178ad5bfeffaa1232730260801c5b6010821615611769576ff9ef02c4529258b057769680fc6601b30260801c5b6020821615611788576ff402d288133a85a17784a411f7aba0820260801c5b60408216156117a7576fe895615b5beb6386553757b0352bda900260801c5b60808216156117c6576fd34f17a00ffa00a8309940a15930391a0260801c5b6101008216156117e6576fae6b7961714e20548d88ea5123f9a0ff0260801c5b610200821615611806576f76d6461f27082d74e0feed3b388c0ca10260801c5b610400821615611826576f372a3bfe0745d8b6b19d985d9a8b85bb0260801c5b610800821615611846576f0be32cbee48979763cf7247dd7bb539d0260801c5b611000821615611865576e8d4f70c9ff4924dac37612d1e2921e0260801c5b612000821615611883576d4e009ae5519380809a02ca7aec770260801c5b61400082161561189f576b17c45e641b6e95dee056ff100260801c5b600091507f800000000000000000000000000000000000000000000000000000000000000084166118fd577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0463ffffffff8116156118fd57600191505b60201c0192915050565b6000806040838503121561191a57600080fd5b50508035926020909101359150565b6040516101a0810167ffffffffffffffff81118282101715611974577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405290565b805173ffffffffffffffffffffffffffffffffffffffff8116811461199e57600080fd5b919050565b805160ff8116811461199e57600080fd5b60006101a082840312156119c757600080fd5b6119cf611929565b6119d88361197a565b81526119e66020840161197a565b60208201526119f76040840161197a565b6040820152611a086060840161197a565b6060820152611a196080840161197a565b6080820152611a2a60a0840161197a565b60a0820152611a3b60c084016119a3565b60c0820152611a4c60e084016119a3565b60e08201526101008381015190820152610120808401519082015261014080840151908201526101608084015190820152610180928301519281019290925250919050565b60008060008060808587031215611aa757600080fd5b505082516020840151604085015160609095015191969095509092509050565b600060208284031215611ad957600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b808202811582820484141761159a5761159a611ae0565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600082611b6457611b64611b26565b500490565b8181036000831280158383131683831282161715611b8957611b89611ae0565b5092915050565b8181038181111561159a5761159a611ae0565b6000815180845260005b81811015611bc957602081850181015186830182015201611bad565b5060006020828601015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010191505092915050565b600073ffffffffffffffffffffffffffffffffffffffff8089168352876020840152866040840152808616606084015280851660808401525060c060a0830152611c5460c0830184611ba3565b98975050505050505050565b60008060408385031215611c7357600080fd5b505080516020909101519092909150565b60007f80000000000000000000000000000000000000000000000000000000000000008203611cb557611cb5611ae0565b5060000390565b8082018281126000831280158216821582161715611cdc57611cdc611ae0565b505092915050565b600082611cf357611cf3611b26565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83147f800000000000000000000000000000000000000000000000000000000000000083141615611d4757611d47611ae0565b500590565b808202600082127f800000000000000000000000000000000000000000000000000000000000000084141615611d8457611d84611ae0565b818105831482151761159a5761159a611ae0565b8082018082111561159a5761159a611ae0565b60007f80000000000000000000000000000000000000000000000000000000000000008203611ddc57611ddc611ae0565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019056fea26469706673582212205bfa6f9e9c8e95098eb9a71545e1912e65d0f19cdfead469872641bc8940b13364736f6c63430008150033",
|
|
"devdoc": {
|
|
"kind": "dev",
|
|
"methods": {
|
|
"absorb(uint256,int256)": {
|
|
"details": "absorb function absorbs the bad debt if the bad debt is above max limit. The main use of it is if the bad debt didn't got liquidated in time maybe due to sudden price drop or bad debt was extremely small to liquidate and the bad debt goes above 100% ratio then there's no incentive for anyone to liquidate now hence absorb functions absorbs that bad debt to allow newer bad debt to liquidate seamlessly. if absorbing were to happen after this it's on governance on how to deal with it although it can still be removed through liquidate via liquidator if the price goes back up and liquidation becomes beneficial upon absorbed user position gets 100% liquidated."
|
|
},
|
|
"rebalance()": {
|
|
"details": "Checks total supply of vault's in Liquidity Layer & Vault contract and rebalance it accordingly if vault supply is more than Liquidity Layer then deposit difference through reserve/rebalance contract if vault supply is less than Liquidity Layer then withdraw difference to reserve/rebalance contract if vault borrow is more than Liquidity Layer then borrow difference to reserve/rebalance contract if vault borrow is less than Liquidity Layer then payback difference through reserve/rebalance contract"
|
|
}
|
|
},
|
|
"version": 1
|
|
},
|
|
"userdoc": {
|
|
"errors": {
|
|
"FluidLiquidateResult(uint256,uint256)": [
|
|
{
|
|
"notice": "used to simulate liquidation to find the maximum liquidatable amounts"
|
|
}
|
|
]
|
|
},
|
|
"events": {
|
|
"LogAbsorb(uint256,uint256)": {
|
|
"notice": "emitted when `absorb()` was executed to absorb bad debt."
|
|
},
|
|
"LogLiquidate(address,uint256,uint256,address)": {
|
|
"notice": "emitted when a liquidation has been executed."
|
|
},
|
|
"LogOperate(address,uint256,int256,int256,address)": {
|
|
"notice": "emitted when an operate() method is executed that changes collateral (`colAmt_`) / debt (debtAmt_`) amount for a `user_` position with `nftId_`. Receiver of any funds is the address `to_`."
|
|
},
|
|
"LogRebalance(int256,int256)": {
|
|
"notice": "emitted when a `rebalance()` has been executed, balancing out total supply / borrow between Vault and Fluid Liquidity pools. if `colAmt_` is positive then loss, meaning transfer from rebalancer address to vault and deposit. if `colAmt_` is negative then profit, meaning withdrawn from vault and sent to rebalancer address. if `debtAmt_` is positive then profit, meaning borrow from vault and sent to rebalancer address. if `debtAmt_` is negative then loss, meaning transfer from rebalancer address to vault and payback."
|
|
},
|
|
"LogUpdateExchangePrice(uint256,uint256)": {
|
|
"notice": "emitted when the exchange prices are updated in storage."
|
|
}
|
|
},
|
|
"kind": "user",
|
|
"methods": {},
|
|
"notice": "Fluid Vault protocol secondary methods contract. Implements `absorb()` and `rebalance()` methods, extracted from main contract due to contract size limits. Methods are limited to be called via delegateCall only (as done by Vault CoreModule \"VaultT1\" contract).",
|
|
"version": 1
|
|
},
|
|
"storageLayout": {
|
|
"storage": [
|
|
{
|
|
"astId": 48984,
|
|
"contract": "contracts/protocols/vault/vaultT1/coreModule/main2.sol:FluidVaultT1Secondary",
|
|
"label": "vaultVariables",
|
|
"offset": 0,
|
|
"slot": "0",
|
|
"type": "t_uint256"
|
|
},
|
|
{
|
|
"astId": 48987,
|
|
"contract": "contracts/protocols/vault/vaultT1/coreModule/main2.sol:FluidVaultT1Secondary",
|
|
"label": "vaultVariables2",
|
|
"offset": 0,
|
|
"slot": "1",
|
|
"type": "t_uint256"
|
|
},
|
|
{
|
|
"astId": 48990,
|
|
"contract": "contracts/protocols/vault/vaultT1/coreModule/main2.sol:FluidVaultT1Secondary",
|
|
"label": "absorbedLiquidity",
|
|
"offset": 0,
|
|
"slot": "2",
|
|
"type": "t_uint256"
|
|
},
|
|
{
|
|
"astId": 48995,
|
|
"contract": "contracts/protocols/vault/vaultT1/coreModule/main2.sol:FluidVaultT1Secondary",
|
|
"label": "positionData",
|
|
"offset": 0,
|
|
"slot": "3",
|
|
"type": "t_mapping(t_uint256,t_uint256)"
|
|
},
|
|
{
|
|
"astId": 49000,
|
|
"contract": "contracts/protocols/vault/vaultT1/coreModule/main2.sol:FluidVaultT1Secondary",
|
|
"label": "tickHasDebt",
|
|
"offset": 0,
|
|
"slot": "4",
|
|
"type": "t_mapping(t_int256,t_uint256)"
|
|
},
|
|
{
|
|
"astId": 49005,
|
|
"contract": "contracts/protocols/vault/vaultT1/coreModule/main2.sol:FluidVaultT1Secondary",
|
|
"label": "tickData",
|
|
"offset": 0,
|
|
"slot": "5",
|
|
"type": "t_mapping(t_int256,t_uint256)"
|
|
},
|
|
{
|
|
"astId": 49012,
|
|
"contract": "contracts/protocols/vault/vaultT1/coreModule/main2.sol:FluidVaultT1Secondary",
|
|
"label": "tickId",
|
|
"offset": 0,
|
|
"slot": "6",
|
|
"type": "t_mapping(t_int256,t_mapping(t_uint256,t_uint256))"
|
|
},
|
|
{
|
|
"astId": 49017,
|
|
"contract": "contracts/protocols/vault/vaultT1/coreModule/main2.sol:FluidVaultT1Secondary",
|
|
"label": "branchData",
|
|
"offset": 0,
|
|
"slot": "7",
|
|
"type": "t_mapping(t_uint256,t_uint256)"
|
|
},
|
|
{
|
|
"astId": 49020,
|
|
"contract": "contracts/protocols/vault/vaultT1/coreModule/main2.sol:FluidVaultT1Secondary",
|
|
"label": "rates",
|
|
"offset": 0,
|
|
"slot": "8",
|
|
"type": "t_uint256"
|
|
},
|
|
{
|
|
"astId": 49023,
|
|
"contract": "contracts/protocols/vault/vaultT1/coreModule/main2.sol:FluidVaultT1Secondary",
|
|
"label": "rebalancer",
|
|
"offset": 0,
|
|
"slot": "9",
|
|
"type": "t_address"
|
|
},
|
|
{
|
|
"astId": 49025,
|
|
"contract": "contracts/protocols/vault/vaultT1/coreModule/main2.sol:FluidVaultT1Secondary",
|
|
"label": "absorbedDustDebt",
|
|
"offset": 0,
|
|
"slot": "10",
|
|
"type": "t_uint256"
|
|
}
|
|
],
|
|
"types": {
|
|
"t_address": {
|
|
"encoding": "inplace",
|
|
"label": "address",
|
|
"numberOfBytes": "20"
|
|
},
|
|
"t_int256": {
|
|
"encoding": "inplace",
|
|
"label": "int256",
|
|
"numberOfBytes": "32"
|
|
},
|
|
"t_mapping(t_int256,t_mapping(t_uint256,t_uint256))": {
|
|
"encoding": "mapping",
|
|
"key": "t_int256",
|
|
"label": "mapping(int256 => mapping(uint256 => uint256))",
|
|
"numberOfBytes": "32",
|
|
"value": "t_mapping(t_uint256,t_uint256)"
|
|
},
|
|
"t_mapping(t_int256,t_uint256)": {
|
|
"encoding": "mapping",
|
|
"key": "t_int256",
|
|
"label": "mapping(int256 => uint256)",
|
|
"numberOfBytes": "32",
|
|
"value": "t_uint256"
|
|
},
|
|
"t_mapping(t_uint256,t_uint256)": {
|
|
"encoding": "mapping",
|
|
"key": "t_uint256",
|
|
"label": "mapping(uint256 => uint256)",
|
|
"numberOfBytes": "32",
|
|
"value": "t_uint256"
|
|
},
|
|
"t_uint256": {
|
|
"encoding": "inplace",
|
|
"label": "uint256",
|
|
"numberOfBytes": "32"
|
|
}
|
|
}
|
|
}
|
|
} |