diff --git a/packages/chains/src/base/assets.ts b/packages/chains/src/base/assets.ts index 617d6398d..b0f7c658c 100644 --- a/packages/chains/src/base/assets.ts +++ b/packages/chains/src/base/assets.ts @@ -2,6 +2,7 @@ import { assetSymbols, ChainlinkFeedBaseCurrency, ChainlinkSpecificParams, + DiaSpecificParams, OracleTypes, PythSpecificParams, SupportedAsset, @@ -38,6 +39,7 @@ export const uSOL = "0x9B8Df6E244526ab5F6e6400d331DB28C8fdDdb55"; export const uSUI = "0xb0505e5a99abd03d94a1169e638B78EDfEd26ea4"; export const sUSDz = "0xe31eE12bDFDD0573D634124611e85338e2cBF0cF"; export const fBOMB = "0x74ccbe53F77b08632ce0CB91D3A545bF6B8E0979"; +export const KLIMA = "0xDCEFd8C8fCc492630B943ABcaB3429F12Ea9Fea2"; export const assets: SupportedAsset[] = [ { @@ -378,9 +380,24 @@ export const assets: SupportedAsset[] = [ feedBaseCurrency: ChainlinkFeedBaseCurrency.USD }, extraDocs: defaultDocs("https://basescan.org", fBOMB), - initialCf: "0.30", + initialCf: "0.50", initialSupplyCap: parseEther(String(20_000_000)).toString(), initialBorrowCap: parseEther(String(15_000_000)).toString() + }, + { + symbol: assetSymbols.KLIMA, + underlying: KLIMA, + name: "Klima DAO", + decimals: 9, + oracle: OracleTypes.DiaPriceOracle, + oracleSpecificParams: { + feed: "0x12df07B05E9DABE78bD04B90206E31F6f64D75bB", + key: "KLIMA/USD" + } as DiaSpecificParams, + extraDocs: defaultDocs("https://basescan.org", KLIMA), + initialSupplyCap: parseUnits(String(1_500_000), 9).toString(), + initialBorrowCap: parseUnits(String(1_200_000), 9).toString(), + initialCf: "0.55" } // DO NOT ADD TO MARKET UNLESS PROPER ORACLE IS DEPLOYED // { diff --git a/packages/chains/src/base/oracles.ts b/packages/chains/src/base/oracles.ts index c120a0e1c..2fefb7eeb 100644 --- a/packages/chains/src/base/oracles.ts +++ b/packages/chains/src/base/oracles.ts @@ -4,7 +4,8 @@ const baseOracles = [ OracleTypes.FixedNativePriceOracle, OracleTypes.MasterPriceOracle, OracleTypes.SimplePriceOracle, - OracleTypes.PythPriceOracle + OracleTypes.PythPriceOracle, + OracleTypes.DiaPriceOracle ]; const oracles: OracleTypes[] = [...baseOracles, OracleTypes.ChainlinkPriceOracleV2]; diff --git a/packages/contracts/chainDeploy/helpers/oracles/dia.ts b/packages/contracts/chainDeploy/helpers/oracles/dia.ts new file mode 100644 index 000000000..6b156551c --- /dev/null +++ b/packages/contracts/chainDeploy/helpers/oracles/dia.ts @@ -0,0 +1,93 @@ +import { Address, GetContractReturnType, WalletClient } from "viem"; + +import { prepareAndLogTransaction } from "../logging"; + +import { addUnderlyingsToMpo } from "./utils"; +import { DiaAsset, DiaDeployFnParams } from "../../types"; +import { diaPriceOracleAbi } from "../../../../sdk/src/generated"; +import { assetSymbols, underlying } from "@ionicprotocol/types"; +import { base } from "@ionicprotocol/chains"; + +export const deployDiaPriceOracle = async ({ + viem, + getNamedAccounts, + deployments, + diaAssets, + diaNativeFeed +}: DiaDeployFnParams): Promise<{ diaOracle: GetContractReturnType }> => { + const { deployer } = await getNamedAccounts(); + const publicClient = await viem.getPublicClient(); + + const mpo = await viem.getContractAt( + "MasterPriceOracle", + (await deployments.get("MasterPriceOracle")).address as Address + ); + + //// Dia Oracle + const dia = await deployments.deploy("DiaPriceOracle", { + from: deployer, + args: [ + deployer, + true, + "0x4200000000000000000000000000000000000006", + diaNativeFeed?.feed ?? "0x0000000000000000000000000000000000000000", + diaNativeFeed?.key ?? "", + (await deployments.get("MasterPriceOracle")).address, + underlying(base.assets, assetSymbols.USDC) + ], + log: true, + waitConfirmations: 1 + }); + + if (dia.transactionHash) publicClient.waitForTransactionReceipt({ hash: dia.transactionHash as Address }); + console.log("DiaPriceOracle: ", dia.address); + + const diaOracle = await viem.getContractAt( + "DiaPriceOracle", + (await deployments.get("DiaPriceOracle")).address as Address + ); + + const diaAssetsToChange: DiaAsset[] = []; + console.log("🚀 ~ diaAssets:", diaAssets); + for (const diaAsset of diaAssets) { + const currentPriceFeed = await diaOracle.read.priceFeeds([diaAsset.underlying]); + console.log("🚀 ~ currentPriceFeed:", currentPriceFeed); + if (currentPriceFeed[0] !== diaAsset.feed || currentPriceFeed[1] !== diaAsset.key) { + diaAssetsToChange.push(diaAsset); + } + } + console.log("🚀 ~ diaAssetsToChange:", diaAssetsToChange); + if (diaAssetsToChange.length > 0) { + if (((await diaOracle.read.admin()) as Address).toLowerCase() === deployer.toLowerCase()) { + const tx = await diaOracle.write.setPriceFeeds([ + diaAssetsToChange.map((f) => f.underlying), + diaAssetsToChange.map((f) => f.feed), + diaAssetsToChange.map((f) => f.key) + ]); + await publicClient.waitForTransactionReceipt({ hash: tx }); + console.log(`Set ${diaAssetsToChange.length} price feeds for DiaPriceOracle at ${tx}`); + } else { + await prepareAndLogTransaction({ + contractInstance: diaOracle, + args: [ + diaAssetsToChange.map((f) => f.underlying), + diaAssetsToChange.map((f) => f.feed), + diaAssetsToChange.map((f) => f.key) + ], + description: `Set ${diaAssetsToChange.length} price feeds for DiaPriceOracle`, + functionName: "setPriceFeeds", + inputs: [ + { internalType: "address[]", name: "underlyings", type: "address[]" }, + { internalType: "bytes32[]", name: "feeds", type: "bytes32[]" }, + { internalType: "string[]", name: "keys", type: "string[]" } + ] + }); + console.log(`Logged Transaction to set ${diaAssetsToChange.length} price feeds for DiaPriceOracle `); + } + } + + const underlyings = diaAssets.map((f) => f.underlying); + await addUnderlyingsToMpo(mpo as any, underlyings, diaOracle.address, deployer, publicClient); + + return { diaOracle: diaOracle as any }; +}; diff --git a/packages/contracts/chainDeploy/mainnets/base.ts b/packages/contracts/chainDeploy/mainnets/base.ts index a8cc00113..5a924f4d5 100644 --- a/packages/contracts/chainDeploy/mainnets/base.ts +++ b/packages/contracts/chainDeploy/mainnets/base.ts @@ -5,6 +5,8 @@ import { HardhatRuntimeEnvironment } from "hardhat/types"; import { Address, zeroAddress } from "viem"; import { ChainlinkSpecificParams, OracleTypes, PythSpecificParams } from "../types"; import { configureAddress } from "../helpers/liquidators/ionicLiquidator"; +import { deployDiaPriceOracle } from "../helpers/oracles/dia"; +import { DiaSpecificParams } from "@ionicprotocol/types"; const assets = base.assets; @@ -61,7 +63,7 @@ export const deploy = async ({ usdToken: base.chainAddresses.STABLE_TOKEN as Address }); - //// ERC4626 Oracle + // //// ERC4626 Oracle await deployErc4626PriceOracle({ run, viem, @@ -104,6 +106,23 @@ export const deploy = async ({ chainlinkAssets }); + const diaAssets = base.assets + .filter((asset) => asset.oracle === OracleTypes.DiaPriceOracle) + .map((asset) => ({ + feed: (asset.oracleSpecificParams as DiaSpecificParams).feed, + underlying: asset.underlying, + key: (asset.oracleSpecificParams as DiaSpecificParams).key, + symbol: asset.symbol + })); + await deployDiaPriceOracle({ + run, + viem, + getNamedAccounts, + deployments, + deployConfig, + diaAssets + }); + const ap = await viem.getContractAt( "AddressesProvider", (await deployments.get("AddressesProvider")).address as Address diff --git a/packages/contracts/chainDeploy/types.ts b/packages/contracts/chainDeploy/types.ts index 9def62420..794557468 100644 --- a/packages/contracts/chainDeploy/types.ts +++ b/packages/contracts/chainDeploy/types.ts @@ -78,8 +78,8 @@ export type ChainlinkAsset = { export type DiaAsset = { symbol: string; - underlying: string; - feed: string; + underlying: Address; + feed: Address; key: string; }; @@ -308,7 +308,8 @@ export enum OracleTypes { RedstoneAdapterPriceOracle = "RedstoneAdapterPriceOracle", RedstoneAdapterWrsETHPriceOracle = "RedstoneAdapterWrsETHPriceOracle", VelodromePriceOracle = "VelodromePriceOracle", - AerodromePriceOracle = "AerodromePriceOracle" + AerodromePriceOracle = "AerodromePriceOracle", + DiaPriceOracle = "DiaPriceOracle" } export type ChainAddresses = { diff --git a/packages/contracts/deployments/base/DiaPriceOracle.json b/packages/contracts/deployments/base/DiaPriceOracle.json new file mode 100644 index 000000000..16144aa78 --- /dev/null +++ b/packages/contracts/deployments/base/DiaPriceOracle.json @@ -0,0 +1,426 @@ +{ + "address": "0xa66bff05c0410883951F2Da2Fa6b135D4856aF84", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_admin", + "type": "address" + }, + { + "internalType": "bool", + "name": "canAdminOverwrite", + "type": "bool" + }, + { + "internalType": "address", + "name": "wtoken", + "type": "address" + }, + { + "internalType": "contract DIAOracleV2", + "name": "nativeTokenUsd", + "type": "address" + }, + { + "internalType": "string", + "name": "nativeTokenUsdKey", + "type": "string" + }, + { + "internalType": "contract MasterPriceOracle", + "name": "masterPriceOracle", + "type": "address" + }, + { + "internalType": "address", + "name": "usdToken", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "NewAdmin", + "type": "event" + }, + { + "inputs": [], + "name": "CAN_ADMIN_OVERWRITE", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MASTER_PRICE_ORACLE", + "outputs": [ + { + "internalType": "contract MasterPriceOracle", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "NATIVE_TOKEN_USD_KEY", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "NATIVE_TOKEN_USD_PRICE_FEED", + "outputs": [ + { + "internalType": "contract DIAOracleV2", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "USD_TOKEN", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "WTOKEN", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract ICErc20", + "name": "cToken", + "type": "address" + } + ], + "name": "getUnderlyingPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "underlying", + "type": "address" + } + ], + "name": "price", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "priceFeeds", + "outputs": [ + { + "internalType": "contract DIAOracleV2", + "name": "feed", + "type": "address" + }, + { + "internalType": "string", + "name": "key", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "underlyings", + "type": "address[]" + }, + { + "internalType": "contract DIAOracleV2[]", + "name": "feeds", + "type": "address[]" + }, + { + "internalType": "string[]", + "name": "keys", + "type": "string[]" + } + ], + "name": "setPriceFeeds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x71095017eebf6ed8bab95fd72ac7b51f180c7b009db1cf258db236dbc77b25eb", + "receipt": { + "to": null, + "from": "0x1155b614971f16758C92c4890eD338C9e3ede6b7", + "contractAddress": "0xa66bff05c0410883951F2Da2Fa6b135D4856aF84", + "transactionIndex": 214, + "gasUsed": "1211296", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x94fc2316e09cf25ff61cf462bfd2f0ef297f659130698491b2bf4e2225f3c2fd", + "transactionHash": "0x71095017eebf6ed8bab95fd72ac7b51f180c7b009db1cf258db236dbc77b25eb", + "logs": [], + "blockNumber": 22700178, + "cumulativeGasUsed": "29372550", + "status": 1, + "byzantium": true + }, + "args": [ + "0x1155b614971f16758C92c4890eD338C9e3ede6b7", + true, + "0x4200000000000000000000000000000000000006", + "0x0000000000000000000000000000000000000000", + "", + "0x1D89E5ba287E67AC0046D2218Be5fE1382cE47b4", + "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913" + ], + "numDeployments": 1, + "solcInputHash": "0f216c69ca7d69b5e67c1cffac004e22", + "metadata": "{\"compiler\":{\"version\":\"0.8.22+commit.4fc1097e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_admin\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"canAdminOverwrite\",\"type\":\"bool\"},{\"internalType\":\"address\",\"name\":\"wtoken\",\"type\":\"address\"},{\"internalType\":\"contract DIAOracleV2\",\"name\":\"nativeTokenUsd\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"nativeTokenUsdKey\",\"type\":\"string\"},{\"internalType\":\"contract MasterPriceOracle\",\"name\":\"masterPriceOracle\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"usdToken\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"oldAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"NewAdmin\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"CAN_ADMIN_OVERWRITE\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MASTER_PRICE_ORACLE\",\"outputs\":[{\"internalType\":\"contract MasterPriceOracle\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"NATIVE_TOKEN_USD_KEY\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"NATIVE_TOKEN_USD_PRICE_FEED\",\"outputs\":[{\"internalType\":\"contract DIAOracleV2\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"USD_TOKEN\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"WTOKEN\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract ICErc20\",\"name\":\"cToken\",\"type\":\"address\"}],\"name\":\"getUnderlyingPrice\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"underlying\",\"type\":\"address\"}],\"name\":\"price\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"priceFeeds\",\"outputs\":[{\"internalType\":\"contract DIAOracleV2\",\"name\":\"feed\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"key\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"underlyings\",\"type\":\"address[]\"},{\"internalType\":\"contract DIAOracleV2[]\",\"name\":\"feeds\",\"type\":\"address[]\"},{\"internalType\":\"string[]\",\"name\":\"keys\",\"type\":\"string[]\"}],\"name\":\"setPriceFeeds\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Rahul Sethuram (https://github.com/rhlsthrm)\",\"details\":\"Implements `PriceOracle`.\",\"events\":{\"NewAdmin(address,address)\":{\"details\":\"Event emitted when `admin` is changed.\"}},\"kind\":\"dev\",\"methods\":{\"changeAdmin(address)\":{\"details\":\"Changes the admin and emits an event.\"},\"constructor\":{\"details\":\"Constructor to set admin and canAdminOverwrite, wtoken address and native token USD price feed address\"},\"getUnderlyingPrice(address)\":{\"details\":\"Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\",\"returns\":{\"_0\":\"Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\"}},\"price(address)\":{\"details\":\"Returns the price in ETH of `underlying` (implements `BasePriceOracle`).\"},\"setPriceFeeds(address[],address[],string[])\":{\"details\":\"Admin-only function to set price feeds.\",\"params\":{\"feeds\":\"The DIA price feed contract addresses for each of `underlyings`.\",\"keys\":\"The keys for each of `underlyings`, in the format \\\"ETH/USD\\\" for example\",\"underlyings\":\"Underlying token addresses for which to set price feeds.\"}}},\"stateVariables\":{\"CAN_ADMIN_OVERWRITE\":{\"details\":\"Controls if `admin` can overwrite existing assignments of oracles to underlying tokens.\"},\"WTOKEN\":{\"details\":\"The Wrapped native asset address.\"},\"admin\":{\"details\":\"The administrator of this `MasterPriceOracle`.\"}},\"title\":\"DiaPriceOracle\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"MASTER_PRICE_ORACLE()\":{\"notice\":\"MasterPriceOracle for backup for USD price.\"},\"NATIVE_TOKEN_USD_PRICE_FEED()\":{\"notice\":\"DIA NATIVE/USD price feed contracts.\"},\"getUnderlyingPrice(address)\":{\"notice\":\"Returns the price in ETH of the token underlying `cToken`.\"},\"priceFeeds(address)\":{\"notice\":\"Maps ERC20 token addresses to ETH-based Chainlink price feed contracts.\"}},\"notice\":\"Returns prices from DIA.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/oracles/default/DiaPriceOracle.sol\":\"DiaPriceOracle\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x1d4afe6cb24200cc4545eed814ecf5847277dfe5d613a1707aad5fceecebcfff\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0xa2b22da3032e50b55f95ec1d13336102d675f341167aa76db571ef7f8bb7975d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(\\n Address.isContract(IBeacon(newBeacon).implementation()),\\n \\\"ERC1967: beacon implementation is not a contract\\\"\\n );\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xabf3f59bc0e5423eae45e459dbe92e7052c6983628d39008590edc852a62f94a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overridden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xc130fe33f1b2132158531a87734153293f6d07bc263ff4ac90e85da9c82c0e27\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0xa6a787e7a901af6511e19aa53e1a00352db215a011d2c7a438d0582dd5da76f9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xb94eac067c85cd79a4195c0a1f4a878e9827329045c12475a0199f1ae17b9700\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol)\\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for managing\\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\\n * types.\\n *\\n * Sets have the following properties:\\n *\\n * - Elements are added, removed, and checked for existence in constant time\\n * (O(1)).\\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\\n *\\n * ```\\n * contract Example {\\n * // Add the library methods\\n * using EnumerableSet for EnumerableSet.AddressSet;\\n *\\n * // Declare a set state variable\\n * EnumerableSet.AddressSet private mySet;\\n * }\\n * ```\\n *\\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\\n * and `uint256` (`UintSet`) are supported.\\n *\\n * [WARNING]\\n * ====\\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\\n * unusable.\\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\\n *\\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\\n * array of EnumerableSet.\\n * ====\\n */\\nlibrary EnumerableSet {\\n // To implement this library for multiple types with as little code\\n // repetition as possible, we write it in terms of a generic Set type with\\n // bytes32 values.\\n // The Set implementation uses private functions, and user-facing\\n // implementations (such as AddressSet) are just wrappers around the\\n // underlying Set.\\n // This means that we can only create new EnumerableSets for types that fit\\n // in bytes32.\\n\\n struct Set {\\n // Storage of set values\\n bytes32[] _values;\\n // Position of the value in the `values` array, plus 1 because index 0\\n // means a value is not in the set.\\n mapping(bytes32 => uint256) _indexes;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function _add(Set storage set, bytes32 value) private returns (bool) {\\n if (!_contains(set, value)) {\\n set._values.push(value);\\n // The value is stored at length-1, but we add 1 to all indexes\\n // and use 0 as a sentinel value\\n set._indexes[value] = set._values.length;\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function _remove(Set storage set, bytes32 value) private returns (bool) {\\n // We read and store the value's index to prevent multiple reads from the same storage slot\\n uint256 valueIndex = set._indexes[value];\\n\\n if (valueIndex != 0) {\\n // Equivalent to contains(set, value)\\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\\n // the array, and then remove the last element (sometimes called as 'swap and pop').\\n // This modifies the order of the array, as noted in {at}.\\n\\n uint256 toDeleteIndex = valueIndex - 1;\\n uint256 lastIndex = set._values.length - 1;\\n\\n if (lastIndex != toDeleteIndex) {\\n bytes32 lastValue = set._values[lastIndex];\\n\\n // Move the last value to the index where the value to delete is\\n set._values[toDeleteIndex] = lastValue;\\n // Update the index for the moved value\\n set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\\n }\\n\\n // Delete the slot where the moved value was stored\\n set._values.pop();\\n\\n // Delete the index for the deleted slot\\n delete set._indexes[value];\\n\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\\n return set._indexes[value] != 0;\\n }\\n\\n /**\\n * @dev Returns the number of values on the set. O(1).\\n */\\n function _length(Set storage set) private view returns (uint256) {\\n return set._values.length;\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\\n return set._values[index];\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function _values(Set storage set) private view returns (bytes32[] memory) {\\n return set._values;\\n }\\n\\n // Bytes32Set\\n\\n struct Bytes32Set {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\n return _add(set._inner, value);\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\n return _remove(set._inner, value);\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\\n return _contains(set._inner, value);\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(Bytes32Set storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\\n return _at(set._inner, index);\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n bytes32[] memory result;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n\\n // AddressSet\\n\\n struct AddressSet {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(AddressSet storage set, address value) internal returns (bool) {\\n return _add(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(AddressSet storage set, address value) internal returns (bool) {\\n return _remove(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(AddressSet storage set, address value) internal view returns (bool) {\\n return _contains(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(AddressSet storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\\n return address(uint160(uint256(_at(set._inner, index))));\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(AddressSet storage set) internal view returns (address[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n address[] memory result;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n\\n // UintSet\\n\\n struct UintSet {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(UintSet storage set, uint256 value) internal returns (bool) {\\n return _add(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\\n return _remove(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\\n return _contains(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(UintSet storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\\n return uint256(_at(set._inner, index));\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(UintSet storage set) internal view returns (uint256[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n uint256[] memory result;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n}\\n\",\"keccak256\":\"0x636eab608b4563c01e88042aba9330e6fe69af2c567fe1adf4d85731974ac81d\",\"license\":\"MIT\"},\"adrastia-periphery/rates/IHistoricalRates.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.5.0 <0.9.0;\\n\\nimport \\\"./RateLibrary.sol\\\";\\n\\n/**\\n * @title IHistoricalRates\\n * @notice An interface that defines a contract that stores historical rates.\\n */\\ninterface IHistoricalRates {\\n /// @notice Gets an rate for a token at a specific index.\\n /// @param token The address of the token to get the rates for.\\n /// @param index The index of the rate to get, where index 0 contains the latest rate, and the last\\n /// index contains the oldest rate (uses reverse chronological ordering).\\n /// @return rate The rate for the token at the specified index.\\n function getRateAt(address token, uint256 index) external view returns (RateLibrary.Rate memory);\\n\\n /// @notice Gets the latest rates for a token.\\n /// @param token The address of the token to get the rates for.\\n /// @param amount The number of rates to get.\\n /// @return rates The latest rates for the token, in reverse chronological order, from newest to oldest.\\n function getRates(address token, uint256 amount) external view returns (RateLibrary.Rate[] memory);\\n\\n /// @notice Gets the latest rates for a token.\\n /// @param token The address of the token to get the rates for.\\n /// @param amount The number of rates to get.\\n /// @param offset The index of the first rate to get (default: 0).\\n /// @param increment The increment between rates to get (default: 1).\\n /// @return rates The latest rates for the token, in reverse chronological order, from newest to oldest.\\n function getRates(\\n address token,\\n uint256 amount,\\n uint256 offset,\\n uint256 increment\\n ) external view returns (RateLibrary.Rate[] memory);\\n\\n /// @notice Gets the number of rates for a token.\\n /// @param token The address of the token to get the number of rates for.\\n /// @return count The number of rates for the token.\\n function getRatesCount(address token) external view returns (uint256);\\n\\n /// @notice Gets the capacity of rates for a token.\\n /// @param token The address of the token to get the capacity of rates for.\\n /// @return capacity The capacity of rates for the token.\\n function getRatesCapacity(address token) external view returns (uint256);\\n\\n /// @notice Sets the capacity of rates for a token.\\n /// @param token The address of the token to set the capacity of rates for.\\n /// @param amount The new capacity of rates for the token.\\n function setRatesCapacity(address token, uint256 amount) external;\\n}\\n\",\"keccak256\":\"0x2754968c368df628f1ed00c2016b1a73f0f9b44f29e48d405887ad108723b3af\",\"license\":\"MIT\"},\"adrastia-periphery/rates/RateLibrary.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity >=0.5.0 <0.9.0;\\n\\npragma experimental ABIEncoderV2;\\n\\nlibrary RateLibrary {\\n struct Rate {\\n uint64 target;\\n uint64 current;\\n uint32 timestamp;\\n }\\n}\\n\",\"keccak256\":\"0x397b79cf9f183afa76db3c8d10cffb408e31ba154900f671a7e93c071bacbff4\",\"license\":\"MIT\"},\"contracts/adrastia/PrudentiaLib.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nlibrary PrudentiaLib {\\n struct PrudentiaConfig {\\n address controller; // Adrastia Prudentia controller address\\n uint8 offset; // Offset for delayed rate activation\\n int8 decimalShift; // Positive values scale the rate up (in powers of 10), negative values scale the rate down\\n }\\n}\\n\",\"keccak256\":\"0x8cc50f1a5dab30e0c205b0bba5f58c18eda9ebf01c661895c8f40678b86bf31f\",\"license\":\"UNLICENSED\"},\"contracts/compound/CTokenInterfaces.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport { IonicComptroller } from \\\"./ComptrollerInterface.sol\\\";\\nimport { InterestRateModel } from \\\"./InterestRateModel.sol\\\";\\nimport { ComptrollerV3Storage } from \\\"./ComptrollerStorage.sol\\\";\\nimport { AddressesProvider } from \\\"../ionic/AddressesProvider.sol\\\";\\n\\nabstract contract CTokenAdminStorage {\\n /*\\n * Administrator for Ionic\\n */\\n address payable public ionicAdmin;\\n}\\n\\nabstract contract CErc20Storage is CTokenAdminStorage {\\n /**\\n * @dev Guard variable for re-entrancy checks\\n */\\n bool internal _notEntered;\\n\\n /**\\n * @notice EIP-20 token name for this token\\n */\\n string public name;\\n\\n /**\\n * @notice EIP-20 token symbol for this token\\n */\\n string public symbol;\\n\\n /**\\n * @notice EIP-20 token decimals for this token\\n */\\n uint8 public decimals;\\n\\n /*\\n * Maximum borrow rate that can ever be applied (.0005% / block)\\n */\\n uint256 internal constant borrowRateMaxMantissa = 0.0005e16;\\n\\n /*\\n * Maximum fraction of interest that can be set aside for reserves + fees\\n */\\n uint256 internal constant reserveFactorPlusFeesMaxMantissa = 1e18;\\n\\n /**\\n * @notice Contract which oversees inter-cToken operations\\n */\\n IonicComptroller public comptroller;\\n\\n /**\\n * @notice Model which tells what the current interest rate should be\\n */\\n InterestRateModel public interestRateModel;\\n\\n /*\\n * Initial exchange rate used when minting the first CTokens (used when totalSupply = 0)\\n */\\n uint256 internal initialExchangeRateMantissa;\\n\\n /**\\n * @notice Fraction of interest currently set aside for admin fees\\n */\\n uint256 public adminFeeMantissa;\\n\\n /**\\n * @notice Fraction of interest currently set aside for Ionic fees\\n */\\n uint256 public ionicFeeMantissa;\\n\\n /**\\n * @notice Fraction of interest currently set aside for reserves\\n */\\n uint256 public reserveFactorMantissa;\\n\\n /**\\n * @notice Block number that interest was last accrued at\\n */\\n uint256 public accrualBlockNumber;\\n\\n /**\\n * @notice Accumulator of the total earned interest rate since the opening of the market\\n */\\n uint256 public borrowIndex;\\n\\n /**\\n * @notice Total amount of outstanding borrows of the underlying in this market\\n */\\n uint256 public totalBorrows;\\n\\n /**\\n * @notice Total amount of reserves of the underlying held in this market\\n */\\n uint256 public totalReserves;\\n\\n /**\\n * @notice Total amount of admin fees of the underlying held in this market\\n */\\n uint256 public totalAdminFees;\\n\\n /**\\n * @notice Total amount of Ionic fees of the underlying held in this market\\n */\\n uint256 public totalIonicFees;\\n\\n /**\\n * @notice Total number of tokens in circulation\\n */\\n uint256 public totalSupply;\\n\\n /*\\n * Official record of token balances for each account\\n */\\n mapping(address => uint256) internal accountTokens;\\n\\n /*\\n * Approved token transfer amounts on behalf of others\\n */\\n mapping(address => mapping(address => uint256)) internal transferAllowances;\\n\\n /**\\n * @notice Container for borrow balance information\\n * @member principal Total balance (with accrued interest), after applying the most recent balance-changing action\\n * @member interestIndex Global borrowIndex as of the most recent balance-changing action\\n */\\n struct BorrowSnapshot {\\n uint256 principal;\\n uint256 interestIndex;\\n }\\n\\n /*\\n * Mapping of account addresses to outstanding borrow balances\\n */\\n mapping(address => BorrowSnapshot) internal accountBorrows;\\n\\n /*\\n * Share of seized collateral that is added to reserves\\n */\\n uint256 public constant protocolSeizeShareMantissa = 2.8e16; //2.8%\\n\\n /*\\n * Share of seized collateral taken as fees\\n */\\n uint256 public constant feeSeizeShareMantissa = 1e17; //10%\\n\\n /**\\n * @notice Underlying asset for this CToken\\n */\\n address public underlying;\\n\\n /**\\n * @notice Addresses Provider\\n */\\n AddressesProvider public ap;\\n}\\n\\nabstract contract CTokenBaseEvents {\\n /* ERC20 */\\n\\n /**\\n * @notice EIP20 Transfer event\\n */\\n event Transfer(address indexed from, address indexed to, uint256 amount);\\n\\n /*** Admin Events ***/\\n\\n /**\\n * @notice Event emitted when interestRateModel is changed\\n */\\n event NewMarketInterestRateModel(InterestRateModel oldInterestRateModel, InterestRateModel newInterestRateModel);\\n\\n /**\\n * @notice Event emitted when the reserve factor is changed\\n */\\n event NewReserveFactor(uint256 oldReserveFactorMantissa, uint256 newReserveFactorMantissa);\\n\\n /**\\n * @notice Event emitted when the admin fee is changed\\n */\\n event NewAdminFee(uint256 oldAdminFeeMantissa, uint256 newAdminFeeMantissa);\\n\\n /**\\n * @notice Event emitted when the Ionic fee is changed\\n */\\n event NewIonicFee(uint256 oldIonicFeeMantissa, uint256 newIonicFeeMantissa);\\n\\n /**\\n * @notice EIP20 Approval event\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 amount);\\n\\n /**\\n * @notice Event emitted when interest is accrued\\n */\\n event AccrueInterest(uint256 cashPrior, uint256 interestAccumulated, uint256 borrowIndex, uint256 totalBorrows);\\n}\\n\\nabstract contract CTokenFirstExtensionEvents is CTokenBaseEvents {\\n event Flash(address receiver, uint256 amount);\\n}\\n\\nabstract contract CTokenSecondExtensionEvents is CTokenBaseEvents {\\n /*** Market Events ***/\\n\\n /**\\n * @notice Event emitted when tokens are minted\\n */\\n event Mint(address minter, uint256 mintAmount, uint256 mintTokens);\\n\\n /**\\n * @notice Event emitted when tokens are redeemed\\n */\\n event Redeem(address redeemer, uint256 redeemAmount, uint256 redeemTokens);\\n\\n /**\\n * @notice Event emitted when underlying is borrowed\\n */\\n event Borrow(address borrower, uint256 borrowAmount, uint256 accountBorrows, uint256 totalBorrows);\\n\\n /**\\n * @notice Event emitted when a borrow is repaid\\n */\\n event RepayBorrow(address payer, address borrower, uint256 repayAmount, uint256 accountBorrows, uint256 totalBorrows);\\n\\n /**\\n * @notice Event emitted when a borrow is liquidated\\n */\\n event LiquidateBorrow(\\n address liquidator,\\n address borrower,\\n uint256 repayAmount,\\n address cTokenCollateral,\\n uint256 seizeTokens\\n );\\n\\n /**\\n * @notice Event emitted when the reserves are added\\n */\\n event ReservesAdded(address benefactor, uint256 addAmount, uint256 newTotalReserves);\\n\\n /**\\n * @notice Event emitted when the reserves are reduced\\n */\\n event ReservesReduced(address admin, uint256 reduceAmount, uint256 newTotalReserves);\\n}\\n\\ninterface CTokenFirstExtensionInterface {\\n /*** User Interface ***/\\n\\n function transfer(address dst, uint256 amount) external returns (bool);\\n\\n function transferFrom(\\n address src,\\n address dst,\\n uint256 amount\\n ) external returns (bool);\\n\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n function balanceOf(address owner) external view returns (uint256);\\n\\n /*** Admin Functions ***/\\n\\n function _setReserveFactor(uint256 newReserveFactorMantissa) external returns (uint256);\\n\\n function _setAdminFee(uint256 newAdminFeeMantissa) external returns (uint256);\\n\\n function _setInterestRateModel(InterestRateModel newInterestRateModel) external returns (uint256);\\n\\n function getAccountSnapshot(address account)\\n external\\n view\\n returns (\\n uint256,\\n uint256,\\n uint256,\\n uint256\\n );\\n\\n function borrowRatePerBlock() external view returns (uint256);\\n\\n function supplyRatePerBlock() external view returns (uint256);\\n\\n function exchangeRateCurrent() external view returns (uint256);\\n\\n function accrueInterest() external returns (uint256);\\n\\n function totalBorrowsCurrent() external view returns (uint256);\\n\\n function borrowBalanceCurrent(address account) external view returns (uint256);\\n\\n function getTotalUnderlyingSupplied() external view returns (uint256);\\n\\n function balanceOfUnderlying(address owner) external view returns (uint256);\\n\\n function multicall(bytes[] calldata data) external payable returns (bytes[] memory results);\\n\\n function flash(uint256 amount, bytes calldata data) external;\\n\\n function supplyRatePerBlockAfterDeposit(uint256 mintAmount) external view returns (uint256);\\n\\n function supplyRatePerBlockAfterWithdraw(uint256 withdrawAmount) external view returns (uint256);\\n\\n function borrowRatePerBlockAfterBorrow(uint256 borrowAmount) external view returns (uint256);\\n\\n function registerInSFS() external returns (uint256);\\n}\\n\\ninterface CTokenSecondExtensionInterface {\\n function mint(uint256 mintAmount) external returns (uint256);\\n\\n function redeem(uint256 redeemTokens) external returns (uint256);\\n\\n function redeemUnderlying(uint256 redeemAmount) external returns (uint256);\\n\\n function borrow(uint256 borrowAmount) external returns (uint256);\\n\\n function repayBorrow(uint256 repayAmount) external returns (uint256);\\n\\n function repayBorrowBehalf(address borrower, uint256 repayAmount) external returns (uint256);\\n\\n function liquidateBorrow(\\n address borrower,\\n uint256 repayAmount,\\n address cTokenCollateral\\n ) external returns (uint256);\\n\\n function getCash() external view returns (uint256);\\n\\n function seize(\\n address liquidator,\\n address borrower,\\n uint256 seizeTokens\\n ) external returns (uint256);\\n\\n /*** Admin Functions ***/\\n\\n function _withdrawAdminFees(uint256 withdrawAmount) external returns (uint256);\\n\\n function _withdrawIonicFees(uint256 withdrawAmount) external returns (uint256);\\n\\n function selfTransferOut(address to, uint256 amount) external;\\n\\n function selfTransferIn(address from, uint256 amount) external returns (uint256);\\n}\\n\\ninterface CDelegatorInterface {\\n function implementation() external view returns (address);\\n\\n /**\\n * @notice Called by the admin to update the implementation of the delegator\\n * @param implementation_ The address of the new implementation for delegation\\n * @param becomeImplementationData The encoded bytes data to be passed to _becomeImplementation\\n */\\n function _setImplementationSafe(address implementation_, bytes calldata becomeImplementationData) external;\\n\\n /**\\n * @dev upgrades the implementation if necessary\\n */\\n function _upgrade() external;\\n}\\n\\ninterface CDelegateInterface {\\n /**\\n * @notice Called by the delegator on a delegate to initialize it for duty\\n * @dev Should revert if any issues arise which make it unfit for delegation\\n * @param data The encoded bytes data for any initialization\\n */\\n function _becomeImplementation(bytes calldata data) external;\\n\\n function delegateType() external pure returns (uint8);\\n\\n function contractType() external pure returns (string memory);\\n}\\n\\nabstract contract CErc20AdminBase is CErc20Storage {\\n /**\\n * @notice Returns a boolean indicating if the sender has admin rights\\n */\\n function hasAdminRights() internal view returns (bool) {\\n ComptrollerV3Storage comptrollerStorage = ComptrollerV3Storage(address(comptroller));\\n return\\n (msg.sender == comptrollerStorage.admin() && comptrollerStorage.adminHasRights()) ||\\n (msg.sender == address(ionicAdmin) && comptrollerStorage.ionicAdminHasRights());\\n }\\n}\\n\\nabstract contract CErc20FirstExtensionBase is\\n CErc20AdminBase,\\n CTokenFirstExtensionEvents,\\n CTokenFirstExtensionInterface\\n{}\\n\\nabstract contract CTokenSecondExtensionBase is\\n CErc20AdminBase,\\n CTokenSecondExtensionEvents,\\n CTokenSecondExtensionInterface,\\n CDelegateInterface\\n{}\\n\\nabstract contract CErc20DelegatorBase is CErc20AdminBase, CTokenSecondExtensionEvents, CDelegatorInterface {}\\n\\ninterface CErc20StorageInterface {\\n function admin() external view returns (address);\\n\\n function adminHasRights() external view returns (bool);\\n\\n function ionicAdmin() external view returns (address);\\n\\n function ionicAdminHasRights() external view returns (bool);\\n\\n function comptroller() external view returns (IonicComptroller);\\n\\n function name() external view returns (string memory);\\n\\n function symbol() external view returns (string memory);\\n\\n function decimals() external view returns (uint8);\\n\\n function totalSupply() external view returns (uint256);\\n\\n function adminFeeMantissa() external view returns (uint256);\\n\\n function ionicFeeMantissa() external view returns (uint256);\\n\\n function reserveFactorMantissa() external view returns (uint256);\\n\\n function protocolSeizeShareMantissa() external view returns (uint256);\\n\\n function feeSeizeShareMantissa() external view returns (uint256);\\n\\n function totalReserves() external view returns (uint256);\\n\\n function totalAdminFees() external view returns (uint256);\\n\\n function totalIonicFees() external view returns (uint256);\\n\\n function totalBorrows() external view returns (uint256);\\n\\n function accrualBlockNumber() external view returns (uint256);\\n\\n function underlying() external view returns (address);\\n\\n function borrowIndex() external view returns (uint256);\\n\\n function interestRateModel() external view returns (address);\\n}\\n\\ninterface CErc20PluginStorageInterface is CErc20StorageInterface {\\n function plugin() external view returns (address);\\n}\\n\\ninterface CErc20PluginRewardsInterface is CErc20PluginStorageInterface {\\n function approve(address, address) external;\\n}\\n\\ninterface ICErc20 is\\n CErc20StorageInterface,\\n CTokenSecondExtensionInterface,\\n CTokenFirstExtensionInterface,\\n CDelegatorInterface,\\n CDelegateInterface\\n{}\\n\\ninterface ICErc20Plugin is CErc20PluginStorageInterface, ICErc20 {\\n function _updatePlugin(address _plugin) external;\\n}\\n\\ninterface ICErc20PluginRewards is CErc20PluginRewardsInterface, ICErc20 {}\\n\",\"keccak256\":\"0x7cc75051a5fa860b9ee93d0ba1ac0608921f02308aeff786ce8bbd8d8a70489a\",\"license\":\"UNLICENSED\"},\"contracts/compound/ComptrollerInterface.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport { BasePriceOracle } from \\\"../oracles/BasePriceOracle.sol\\\";\\nimport { ICErc20 } from \\\"./CTokenInterfaces.sol\\\";\\nimport { DiamondExtension } from \\\"../ionic/DiamondExtension.sol\\\";\\nimport { ComptrollerV4Storage } from \\\"../compound/ComptrollerStorage.sol\\\";\\nimport { PrudentiaLib } from \\\"../adrastia/PrudentiaLib.sol\\\";\\nimport { IHistoricalRates } from \\\"adrastia-periphery/rates/IHistoricalRates.sol\\\";\\n\\ninterface ComptrollerInterface {\\n function isDeprecated(ICErc20 cToken) external view returns (bool);\\n\\n function _becomeImplementation() external;\\n\\n function _deployMarket(\\n uint8 delegateType,\\n bytes memory constructorData,\\n bytes calldata becomeImplData,\\n uint256 collateralFactorMantissa\\n ) external returns (uint256);\\n\\n function getAssetsIn(address account) external view returns (ICErc20[] memory);\\n\\n function checkMembership(address account, ICErc20 cToken) external view returns (bool);\\n\\n function _setPriceOracle(BasePriceOracle newOracle) external returns (uint256);\\n\\n function _setCloseFactor(uint256 newCloseFactorMantissa) external returns (uint256);\\n\\n function _setCollateralFactor(ICErc20 market, uint256 newCollateralFactorMantissa) external returns (uint256);\\n\\n function _setLiquidationIncentive(uint256 newLiquidationIncentiveMantissa) external returns (uint256);\\n\\n function _setWhitelistEnforcement(bool enforce) external returns (uint256);\\n\\n function _setWhitelistStatuses(address[] calldata _suppliers, bool[] calldata statuses) external returns (uint256);\\n\\n function _addRewardsDistributor(address distributor) external returns (uint256);\\n\\n function getHypotheticalAccountLiquidity(\\n address account,\\n address cTokenModify,\\n uint256 redeemTokens,\\n uint256 borrowAmount,\\n uint256 repayAmount\\n ) external view returns (uint256, uint256, uint256, uint256);\\n\\n function getMaxRedeemOrBorrow(address account, ICErc20 cToken, bool isBorrow) external view returns (uint256);\\n\\n /*** Assets You Are In ***/\\n\\n function enterMarkets(address[] calldata cTokens) external returns (uint256[] memory);\\n\\n function exitMarket(address cToken) external returns (uint256);\\n\\n /*** Policy Hooks ***/\\n\\n function mintAllowed(address cToken, address minter, uint256 mintAmount) external returns (uint256);\\n\\n function redeemAllowed(address cToken, address redeemer, uint256 redeemTokens) external returns (uint256);\\n\\n function redeemVerify(address cToken, address redeemer, uint256 redeemAmount, uint256 redeemTokens) external;\\n\\n function borrowAllowed(address cToken, address borrower, uint256 borrowAmount) external returns (uint256);\\n\\n function borrowWithinLimits(address cToken, uint256 accountBorrowsNew) external view returns (uint256);\\n\\n function repayBorrowAllowed(\\n address cToken,\\n address payer,\\n address borrower,\\n uint256 repayAmount\\n ) external returns (uint256);\\n\\n function liquidateBorrowAllowed(\\n address cTokenBorrowed,\\n address cTokenCollateral,\\n address liquidator,\\n address borrower,\\n uint256 repayAmount\\n ) external returns (uint256);\\n\\n function seizeAllowed(\\n address cTokenCollateral,\\n address cTokenBorrowed,\\n address liquidator,\\n address borrower,\\n uint256 seizeTokens\\n ) external returns (uint256);\\n\\n function transferAllowed(address cToken, address src, address dst, uint256 transferTokens) external returns (uint256);\\n\\n function mintVerify(address cToken, address minter, uint256 actualMintAmount, uint256 mintTokens) external;\\n\\n /*** Liquidity/Liquidation Calculations ***/\\n\\n function getAccountLiquidity(\\n address account\\n ) external view returns (uint256 error, uint256 collateralValue, uint256 liquidity, uint256 shortfall);\\n\\n function liquidateCalculateSeizeTokens(\\n address cTokenBorrowed,\\n address cTokenCollateral,\\n uint256 repayAmount\\n ) external view returns (uint256, uint256);\\n\\n /*** Pool-Wide/Cross-Asset Reentrancy Prevention ***/\\n\\n function _beforeNonReentrant() external;\\n\\n function _afterNonReentrant() external;\\n\\n /*** New supply and borrow cap view functions ***/\\n\\n /**\\n * @notice Gets the supply cap of a cToken in the units of the underlying asset.\\n * @param cToken The address of the cToken.\\n */\\n function effectiveSupplyCaps(address cToken) external view returns (uint256 supplyCap);\\n\\n /**\\n * @notice Gets the borrow cap of a cToken in the units of the underlying asset.\\n * @param cToken The address of the cToken.\\n */\\n function effectiveBorrowCaps(address cToken) external view returns (uint256 borrowCap);\\n}\\n\\ninterface ComptrollerStorageInterface {\\n function admin() external view returns (address);\\n\\n function adminHasRights() external view returns (bool);\\n\\n function ionicAdmin() external view returns (address);\\n\\n function ionicAdminHasRights() external view returns (bool);\\n\\n function pendingAdmin() external view returns (address);\\n\\n function oracle() external view returns (BasePriceOracle);\\n\\n function pauseGuardian() external view returns (address);\\n\\n function closeFactorMantissa() external view returns (uint256);\\n\\n function liquidationIncentiveMantissa() external view returns (uint256);\\n\\n function isUserOfPool(address user) external view returns (bool);\\n\\n function whitelist(address account) external view returns (bool);\\n\\n function enforceWhitelist() external view returns (bool);\\n\\n function borrowCapForCollateral(address borrowed, address collateral) external view returns (uint256);\\n\\n function borrowingAgainstCollateralBlacklist(address borrowed, address collateral) external view returns (bool);\\n\\n function suppliers(address account) external view returns (bool);\\n\\n function cTokensByUnderlying(address) external view returns (address);\\n\\n /**\\n * Gets the supply cap of a cToken in the units of the underlying asset.\\n * @dev WARNING: This function is misleading if Adrastia Prudentia is being used for the supply cap. Instead, use\\n * `effectiveSupplyCaps` to get the correct supply cap.\\n * @param cToken The address of the cToken.\\n * @return The supply cap in the units of the underlying asset.\\n */\\n function supplyCaps(address cToken) external view returns (uint256);\\n\\n /**\\n * Gets the borrow cap of a cToken in the units of the underlying asset.\\n * @dev WARNING: This function is misleading if Adrastia Prudentia is being used for the borrow cap. Instead, use\\n * `effectiveBorrowCaps` to get the correct borrow cap.\\n * @param cToken The address of the cToken.\\n * @return The borrow cap in the units of the underlying asset.\\n */\\n function borrowCaps(address cToken) external view returns (uint256);\\n\\n function markets(address cToken) external view returns (bool, uint256);\\n\\n function accountAssets(address, uint256) external view returns (address);\\n\\n function borrowGuardianPaused(address cToken) external view returns (bool);\\n\\n function mintGuardianPaused(address cToken) external view returns (bool);\\n\\n function rewardsDistributors(uint256) external view returns (address);\\n}\\n\\ninterface SFSRegister {\\n function register(address _recipient) external returns (uint256 tokenId);\\n}\\n\\ninterface ComptrollerExtensionInterface {\\n function getWhitelistedSuppliersSupply(address cToken) external view returns (uint256 supplied);\\n\\n function getWhitelistedBorrowersBorrows(address cToken) external view returns (uint256 borrowed);\\n\\n function getAllMarkets() external view returns (ICErc20[] memory);\\n\\n function getAllBorrowers() external view returns (address[] memory);\\n\\n function getAllBorrowersCount() external view returns (uint256);\\n\\n function getPaginatedBorrowers(\\n uint256 page,\\n uint256 pageSize\\n ) external view returns (uint256 _totalPages, address[] memory _pageOfBorrowers);\\n\\n function getRewardsDistributors() external view returns (address[] memory);\\n\\n function getAccruingFlywheels() external view returns (address[] memory);\\n\\n function _supplyCapWhitelist(address cToken, address account, bool whitelisted) external;\\n\\n function _setBorrowCapForCollateral(address cTokenBorrow, address cTokenCollateral, uint256 borrowCap) external;\\n\\n function _setBorrowCapForCollateralWhitelist(\\n address cTokenBorrow,\\n address cTokenCollateral,\\n address account,\\n bool whitelisted\\n ) external;\\n\\n function isBorrowCapForCollateralWhitelisted(\\n address cTokenBorrow,\\n address cTokenCollateral,\\n address account\\n ) external view returns (bool);\\n\\n function _blacklistBorrowingAgainstCollateral(\\n address cTokenBorrow,\\n address cTokenCollateral,\\n bool blacklisted\\n ) external;\\n\\n function _blacklistBorrowingAgainstCollateralWhitelist(\\n address cTokenBorrow,\\n address cTokenCollateral,\\n address account,\\n bool whitelisted\\n ) external;\\n\\n function isBlacklistBorrowingAgainstCollateralWhitelisted(\\n address cTokenBorrow,\\n address cTokenCollateral,\\n address account\\n ) external view returns (bool);\\n\\n function isSupplyCapWhitelisted(address cToken, address account) external view returns (bool);\\n\\n function _borrowCapWhitelist(address cToken, address account, bool whitelisted) external;\\n\\n function isBorrowCapWhitelisted(address cToken, address account) external view returns (bool);\\n\\n function _removeFlywheel(address flywheelAddress) external returns (bool);\\n\\n function getWhitelist() external view returns (address[] memory);\\n\\n function addNonAccruingFlywheel(address flywheelAddress) external returns (bool);\\n\\n function _setMarketSupplyCaps(ICErc20[] calldata cTokens, uint256[] calldata newSupplyCaps) external;\\n\\n function _setMarketBorrowCaps(ICErc20[] calldata cTokens, uint256[] calldata newBorrowCaps) external;\\n\\n function _setBorrowCapGuardian(address newBorrowCapGuardian) external;\\n\\n function _setPauseGuardian(address newPauseGuardian) external returns (uint256);\\n\\n function _setMintPaused(ICErc20 cToken, bool state) external returns (bool);\\n\\n function _setBorrowPaused(ICErc20 cToken, bool state) external returns (bool);\\n\\n function _setTransferPaused(bool state) external returns (bool);\\n\\n function _setSeizePaused(bool state) external returns (bool);\\n\\n function _unsupportMarket(ICErc20 cToken) external returns (uint256);\\n\\n function getAssetAsCollateralValueCap(\\n ICErc20 collateral,\\n ICErc20 cTokenModify,\\n bool redeeming,\\n address account\\n ) external view returns (uint256);\\n\\n function registerInSFS() external returns (uint256);\\n}\\n\\ninterface ComptrollerPrudentiaCapsExtInterface {\\n /**\\n * @notice Retrieves Adrastia Prudentia borrow cap config from storage.\\n * @return The config.\\n */\\n function getBorrowCapConfig() external view returns (PrudentiaLib.PrudentiaConfig memory);\\n\\n /**\\n * @notice Retrieves Adrastia Prudentia supply cap config from storage.\\n * @return The config.\\n */\\n function getSupplyCapConfig() external view returns (PrudentiaLib.PrudentiaConfig memory);\\n\\n /**\\n * @notice Sets the Adrastia Prudentia supply cap config.\\n * @dev Specifying a zero address for the `controller` parameter will make the Comptroller use the native supply caps.\\n * @param newConfig The new config.\\n */\\n function _setSupplyCapConfig(PrudentiaLib.PrudentiaConfig calldata newConfig) external;\\n\\n /**\\n * @notice Sets the Adrastia Prudentia supply cap config.\\n * @dev Specifying a zero address for the `controller` parameter will make the Comptroller use the native borrow caps.\\n * @param newConfig The new config.\\n */\\n function _setBorrowCapConfig(PrudentiaLib.PrudentiaConfig calldata newConfig) external;\\n}\\n\\ninterface UnitrollerInterface {\\n function comptrollerImplementation() external view returns (address);\\n\\n function _upgrade() external;\\n\\n function _acceptAdmin() external returns (uint256);\\n\\n function _setPendingAdmin(address newPendingAdmin) external returns (uint256);\\n\\n function _toggleAdminRights(bool hasRights) external returns (uint256);\\n}\\n\\ninterface IComptrollerExtension is ComptrollerExtensionInterface, ComptrollerStorageInterface {}\\n\\n//interface IComptrollerBase is ComptrollerInterface, ComptrollerStorageInterface {}\\n\\ninterface IonicComptroller is\\n ComptrollerInterface,\\n ComptrollerExtensionInterface,\\n UnitrollerInterface,\\n ComptrollerStorageInterface\\n{\\n\\n}\\n\\nabstract contract ComptrollerBase is ComptrollerV4Storage {\\n /// @notice Indicator that this is a Comptroller contract (for inspection)\\n bool public constant isComptroller = true;\\n\\n /**\\n * @notice Gets the supply cap of a cToken in the units of the underlying asset.\\n * @param cToken The address of the cToken.\\n */\\n function effectiveSupplyCaps(address cToken) public view virtual returns (uint256 supplyCap) {\\n PrudentiaLib.PrudentiaConfig memory capConfig = supplyCapConfig;\\n\\n // Check if we're using Adrastia Prudentia for the supply cap\\n if (capConfig.controller != address(0)) {\\n // We have a controller, so we're using Adrastia Prudentia\\n\\n address underlyingToken = ICErc20(cToken).underlying();\\n\\n // Get the supply cap from Adrastia Prudentia\\n supplyCap = IHistoricalRates(capConfig.controller).getRateAt(underlyingToken, capConfig.offset).current;\\n\\n // Prudentia trims decimal points from amounts while our code requires the mantissa amount, so we\\n // must scale the supply cap to get the correct amount\\n\\n int256 scaleByDecimals = 18;\\n // Not all ERC20s implement decimals(), so we use a staticcall and check the return data\\n (bool success, bytes memory data) = underlyingToken.staticcall(abi.encodeWithSignature(\\\"decimals()\\\"));\\n if (success && data.length == 32) {\\n scaleByDecimals = int256(uint256(abi.decode(data, (uint8))));\\n }\\n\\n scaleByDecimals += capConfig.decimalShift;\\n\\n if (scaleByDecimals >= 0) {\\n // We're scaling up, so we need to multiply\\n supplyCap *= 10 ** uint256(scaleByDecimals);\\n } else {\\n // We're scaling down, so we need to divide\\n supplyCap /= 10 ** uint256(-scaleByDecimals);\\n }\\n } else {\\n // We don't have a controller, so we're using the local supply cap\\n\\n // Get the supply cap from the local supply cap\\n supplyCap = supplyCaps[cToken];\\n }\\n }\\n\\n /**\\n * @notice Gets the borrow cap of a cToken in the units of the underlying asset.\\n * @param cToken The address of the cToken.\\n */\\n function effectiveBorrowCaps(address cToken) public view virtual returns (uint256 borrowCap) {\\n PrudentiaLib.PrudentiaConfig memory capConfig = borrowCapConfig;\\n\\n // Check if we're using Adrastia Prudentia for the borrow cap\\n if (capConfig.controller != address(0)) {\\n // We have a controller, so we're using Adrastia Prudentia\\n\\n address underlyingToken = ICErc20(cToken).underlying();\\n\\n // Get the borrow cap from Adrastia Prudentia\\n borrowCap = IHistoricalRates(capConfig.controller).getRateAt(underlyingToken, capConfig.offset).current;\\n\\n // Prudentia trims decimal points from amounts while our code requires the mantissa amount, so we\\n // must scale the supply cap to get the correct amount\\n\\n int256 scaleByDecimals = 18;\\n // Not all ERC20s implement decimals(), so we use a staticcall and check the return data\\n (bool success, bytes memory data) = underlyingToken.staticcall(abi.encodeWithSignature(\\\"decimals()\\\"));\\n if (success && data.length == 32) {\\n scaleByDecimals = int256(uint256(abi.decode(data, (uint8))));\\n }\\n\\n scaleByDecimals += capConfig.decimalShift;\\n\\n if (scaleByDecimals >= 0) {\\n // We're scaling up, so we need to multiply\\n borrowCap *= 10 ** uint256(scaleByDecimals);\\n } else {\\n // We're scaling down, so we need to divide\\n borrowCap /= 10 ** uint256(-scaleByDecimals);\\n }\\n } else {\\n // We don't have a controller, so we're using the local borrow cap\\n borrowCap = borrowCaps[cToken];\\n }\\n }\\n}\\n\",\"keccak256\":\"0x7632af3b32bc1fccd14255b6885e74c4d5ac8de5f00fb8ed67186810d286424f\",\"license\":\"UNLICENSED\"},\"contracts/compound/ComptrollerStorage.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport \\\"./IFeeDistributor.sol\\\";\\nimport \\\"../oracles/BasePriceOracle.sol\\\";\\nimport { ICErc20 } from \\\"./CTokenInterfaces.sol\\\";\\nimport { PrudentiaLib } from \\\"../adrastia/PrudentiaLib.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\\\";\\n\\ncontract UnitrollerAdminStorage {\\n /*\\n * Administrator for Ionic\\n */\\n address payable public ionicAdmin;\\n\\n /**\\n * @notice Administrator for this contract\\n */\\n address public admin;\\n\\n /**\\n * @notice Pending administrator for this contract\\n */\\n address public pendingAdmin;\\n\\n /**\\n * @notice Whether or not the Ionic admin has admin rights\\n */\\n bool public ionicAdminHasRights = true;\\n\\n /**\\n * @notice Whether or not the admin has admin rights\\n */\\n bool public adminHasRights = true;\\n\\n /**\\n * @notice Returns a boolean indicating if the sender has admin rights\\n */\\n function hasAdminRights() internal view returns (bool) {\\n return (msg.sender == admin && adminHasRights) || (msg.sender == address(ionicAdmin) && ionicAdminHasRights);\\n }\\n}\\n\\ncontract ComptrollerV1Storage is UnitrollerAdminStorage {\\n /**\\n * @notice Oracle which gives the price of any given asset\\n */\\n BasePriceOracle public oracle;\\n\\n /**\\n * @notice Multiplier used to calculate the maximum repayAmount when liquidating a borrow\\n */\\n uint256 public closeFactorMantissa;\\n\\n /**\\n * @notice Multiplier representing the discount on collateral that a liquidator receives\\n */\\n uint256 public liquidationIncentiveMantissa;\\n\\n /*\\n * UNUSED AFTER UPGRADE: Max number of assets a single account can participate in (borrow or use as collateral)\\n */\\n uint256 internal maxAssets;\\n\\n /**\\n * @notice Per-account mapping of \\\"assets you are in\\\", capped by maxAssets\\n */\\n mapping(address => ICErc20[]) public accountAssets;\\n}\\n\\ncontract ComptrollerV2Storage is ComptrollerV1Storage {\\n struct Market {\\n // Whether or not this market is listed\\n bool isListed;\\n // Multiplier representing the most one can borrow against their collateral in this market.\\n // For instance, 0.9 to allow borrowing 90% of collateral value.\\n // Must be between 0 and 1, and stored as a mantissa.\\n uint256 collateralFactorMantissa;\\n // Per-market mapping of \\\"accounts in this asset\\\"\\n mapping(address => bool) accountMembership;\\n }\\n\\n /**\\n * @notice Official mapping of cTokens -> Market metadata\\n * @dev Used e.g. to determine if a market is supported\\n */\\n mapping(address => Market) public markets;\\n\\n /// @notice A list of all markets\\n ICErc20[] public allMarkets;\\n\\n /**\\n * @dev Maps borrowers to booleans indicating if they have entered any markets\\n */\\n mapping(address => bool) internal borrowers;\\n\\n /// @notice A list of all borrowers who have entered markets\\n address[] public allBorrowers;\\n\\n // Indexes of borrower account addresses in the `allBorrowers` array\\n mapping(address => uint256) internal borrowerIndexes;\\n\\n /**\\n * @dev Maps suppliers to booleans indicating if they have ever supplied to any markets\\n */\\n mapping(address => bool) public suppliers;\\n\\n /// @notice All cTokens addresses mapped by their underlying token addresses\\n mapping(address => ICErc20) public cTokensByUnderlying;\\n\\n /// @notice Whether or not the supplier whitelist is enforced\\n bool public enforceWhitelist;\\n\\n /// @notice Maps addresses to booleans indicating if they are allowed to supply assets (i.e., mint cTokens)\\n mapping(address => bool) public whitelist;\\n\\n /// @notice An array of all whitelisted accounts\\n address[] public whitelistArray;\\n\\n // Indexes of account addresses in the `whitelistArray` array\\n mapping(address => uint256) internal whitelistIndexes;\\n\\n /**\\n * @notice The Pause Guardian can pause certain actions as a safety mechanism.\\n * Actions which allow users to remove their own assets cannot be paused.\\n * Liquidation / seizing / transfer can only be paused globally, not by market.\\n */\\n address public pauseGuardian;\\n bool public _mintGuardianPaused;\\n bool public _borrowGuardianPaused;\\n bool public transferGuardianPaused;\\n bool public seizeGuardianPaused;\\n mapping(address => bool) public mintGuardianPaused;\\n mapping(address => bool) public borrowGuardianPaused;\\n}\\n\\ncontract ComptrollerV3Storage is ComptrollerV2Storage {\\n /// @notice The borrowCapGuardian can set borrowCaps to any number for any market. Lowering the borrow cap could disable borrowing on the given market.\\n /// @dev If Adrastia Prudentia is enabled, the values the borrow cap guardian sets are ignored.\\n address public borrowCapGuardian;\\n\\n /// @notice Borrow caps enforced by borrowAllowed for each cToken address. Defaults to zero which corresponds to unlimited borrowing.\\n /// @dev If Adrastia Prudentia is enabled, this value is ignored. Use `effectiveBorrowCaps` instead.\\n mapping(address => uint256) public borrowCaps;\\n\\n /// @notice Supply caps enforced by mintAllowed for each cToken address. Defaults to zero which corresponds to unlimited supplying.\\n /// @dev If Adrastia Prudentia is enabled, this value is ignored. Use `effectiveSupplyCaps` instead.\\n mapping(address => uint256) public supplyCaps;\\n\\n /// @notice RewardsDistributor contracts to notify of flywheel changes.\\n address[] public rewardsDistributors;\\n\\n /// @dev Guard variable for pool-wide/cross-asset re-entrancy checks\\n bool internal _notEntered;\\n\\n /// @dev Whether or not _notEntered has been initialized\\n bool internal _notEnteredInitialized;\\n\\n /// @notice RewardsDistributor to list for claiming, but not to notify of flywheel changes.\\n address[] public nonAccruingRewardsDistributors;\\n\\n /// @dev cap for each user's borrows against specific assets - denominated in the borrowed asset\\n mapping(address => mapping(address => uint256)) public borrowCapForCollateral;\\n\\n /// @dev blacklist to disallow the borrowing of an asset against specific collateral\\n mapping(address => mapping(address => bool)) public borrowingAgainstCollateralBlacklist;\\n\\n /// @dev set of whitelisted accounts that are allowed to bypass the borrowing against specific collateral cap\\n mapping(address => mapping(address => EnumerableSet.AddressSet)) internal borrowCapForCollateralWhitelist;\\n\\n /// @dev set of whitelisted accounts that are allowed to bypass the borrow cap\\n mapping(address => mapping(address => EnumerableSet.AddressSet))\\n internal borrowingAgainstCollateralBlacklistWhitelist;\\n\\n /// @dev set of whitelisted accounts that are allowed to bypass the supply cap\\n mapping(address => EnumerableSet.AddressSet) internal supplyCapWhitelist;\\n\\n /// @dev set of whitelisted accounts that are allowed to bypass the borrow cap\\n mapping(address => EnumerableSet.AddressSet) internal borrowCapWhitelist;\\n}\\n\\ncontract ComptrollerV4Storage is ComptrollerV3Storage {\\n /// @dev Adrastia Prudentia config for controlling borrow caps.\\n PrudentiaLib.PrudentiaConfig internal borrowCapConfig;\\n\\n /// @dev Adrastia Prudentia config for controlling supply caps.\\n PrudentiaLib.PrudentiaConfig internal supplyCapConfig;\\n}\\n\",\"keccak256\":\"0xa4a8110e666a93c1228c914f1414131e0f3b93385826bb72f6f93d429e514286\",\"license\":\"UNLICENSED\"},\"contracts/compound/IFeeDistributor.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport \\\"../ionic/AuthoritiesRegistry.sol\\\";\\n\\ninterface IFeeDistributor {\\n function minBorrowEth() external view returns (uint256);\\n\\n function maxUtilizationRate() external view returns (uint256);\\n\\n function interestFeeRate() external view returns (uint256);\\n\\n function latestComptrollerImplementation(address oldImplementation) external view returns (address);\\n\\n function latestCErc20Delegate(uint8 delegateType)\\n external\\n view\\n returns (address cErc20Delegate, bytes memory becomeImplementationData);\\n\\n function latestPluginImplementation(address oldImplementation) external view returns (address);\\n\\n function getComptrollerExtensions(address comptroller) external view returns (address[] memory);\\n\\n function getCErc20DelegateExtensions(address cErc20Delegate) external view returns (address[] memory);\\n\\n function deployCErc20(\\n uint8 delegateType,\\n bytes calldata constructorData,\\n bytes calldata becomeImplData\\n ) external returns (address);\\n\\n function canCall(\\n address pool,\\n address user,\\n address target,\\n bytes4 functionSig\\n ) external view returns (bool);\\n\\n function authoritiesRegistry() external view returns (AuthoritiesRegistry);\\n\\n fallback() external payable;\\n\\n receive() external payable;\\n}\\n\",\"keccak256\":\"0xa822e2942e6a88851968d5f3bda48709713c84d556031a1dd3db5dfd06121d3e\",\"license\":\"UNLICENSED\"},\"contracts/compound/InterestRateModel.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\n/**\\n * @title Compound's InterestRateModel Interface\\n * @author Compound\\n */\\nabstract contract InterestRateModel {\\n /// @notice Indicator that this is an InterestRateModel contract (for inspection)\\n bool public constant isInterestRateModel = true;\\n\\n /**\\n * @notice Calculates the current borrow interest rate per block\\n * @param cash The total amount of cash the market has\\n * @param borrows The total amount of borrows the market has outstanding\\n * @param reserves The total amount of reserves the market has\\n * @return The borrow rate per block (as a percentage, and scaled by 1e18)\\n */\\n function getBorrowRate(\\n uint256 cash,\\n uint256 borrows,\\n uint256 reserves\\n ) public view virtual returns (uint256);\\n\\n /**\\n * @notice Calculates the current supply interest rate per block\\n * @param cash The total amount of cash the market has\\n * @param borrows The total amount of borrows the market has outstanding\\n * @param reserves The total amount of reserves the market has\\n * @param reserveFactorMantissa The current reserve factor the market has\\n * @return The supply rate per block (as a percentage, and scaled by 1e18)\\n */\\n function getSupplyRate(\\n uint256 cash,\\n uint256 borrows,\\n uint256 reserves,\\n uint256 reserveFactorMantissa\\n ) public view virtual returns (uint256);\\n}\\n\",\"keccak256\":\"0x587a54b49d48df2cd91583eac93ddde4e2849f79d0441f179bf835e9dffe24e9\",\"license\":\"UNLICENSED\"},\"contracts/external/compound/ICToken.sol\":{\"content\":\"// SPDX-License-Identifier: BSD-3-Clause\\npragma solidity >=0.8.0;\\n\\n/**\\n * @title Compound's CToken Contract\\n * @notice Abstract base for CTokens\\n * @author Compound\\n */\\ninterface ICToken {\\n function admin() external view returns (address);\\n\\n function adminHasRights() external view returns (bool);\\n\\n function ionicAdminHasRights() external view returns (bool);\\n\\n function symbol() external view returns (string memory);\\n\\n function comptroller() external view returns (address);\\n\\n function adminFeeMantissa() external view returns (uint256);\\n\\n function ionicFeeMantissa() external view returns (uint256);\\n\\n function reserveFactorMantissa() external view returns (uint256);\\n\\n function totalReserves() external view returns (uint256);\\n\\n function totalAdminFees() external view returns (uint256);\\n\\n function totalIonicFees() external view returns (uint256);\\n\\n function isCToken() external view returns (bool);\\n\\n function isCEther() external view returns (bool);\\n\\n function balanceOf(address owner) external view returns (uint256);\\n\\n function balanceOfUnderlying(address owner) external returns (uint256);\\n\\n function borrowRatePerBlock() external view returns (uint256);\\n\\n function supplyRatePerBlock() external view returns (uint256);\\n\\n function totalBorrowsCurrent() external returns (uint256);\\n\\n function totalBorrows() external view returns (uint256);\\n\\n function totalSupply() external view returns (uint256);\\n\\n function borrowBalanceStored(address account) external view returns (uint256);\\n\\n function borrowBalanceCurrent(address account) external returns (uint256);\\n\\n function exchangeRateCurrent() external returns (uint256);\\n\\n function exchangeRateStored() external view returns (uint256);\\n\\n function accrueInterest() external returns (uint256);\\n\\n function getCash() external view returns (uint256);\\n\\n function mint(uint256 mintAmount) external returns (uint256);\\n\\n function redeem(uint256 redeemTokens) external returns (uint256);\\n\\n function redeemUnderlying(uint256 redeemAmount) external returns (uint256);\\n\\n function borrow(uint256 borrowAmount) external returns (uint256);\\n\\n function repayBorrow(uint256 repayAmount) external returns (uint256);\\n\\n function protocolSeizeShareMantissa() external view returns (uint256);\\n\\n function feeSeizeShareMantissa() external view returns (uint256);\\n\\n function _setReserveFactor(uint256 newReserveFactorMantissa) external returns (uint256);\\n\\n function _setAdminFee(uint256 newAdminFeeMantissa) external returns (uint256);\\n}\\n\",\"keccak256\":\"0xd90b56c414ed688746f99b939cd2550cd1a646996ed7ee020f95877068324c48\",\"license\":\"BSD-3-Clause\"},\"contracts/external/compound/IPriceOracle.sol\":{\"content\":\"// SPDX-License-Identifier: BSD-3-Clause\\npragma solidity >=0.8.0;\\n\\nimport \\\"./ICToken.sol\\\";\\n\\ninterface IPriceOracle {\\n /**\\n * @notice Get the underlying price of a cToken asset\\n * @param cToken The cToken to get the underlying price of\\n * @return The underlying asset price mantissa (scaled by 1e18).\\n * Zero means the price is unavailable.\\n */\\n function getUnderlyingPrice(ICToken cToken) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x501ba6588dc3bbcbcd7629eb294b2249dce97cb78e1c78feb1815d220b488368\",\"license\":\"BSD-3-Clause\"},\"contracts/ionic/AddressesProvider.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity >=0.8.0;\\n\\nimport { SafeOwnableUpgradeable } from \\\"../ionic/SafeOwnableUpgradeable.sol\\\";\\n\\n/**\\n * @title AddressesProvider\\n * @notice The Addresses Provider serves as a central storage of system internal and external\\n * contract addresses that change between deploys and across chains\\n * @author Veliko Minkov \\n */\\ncontract AddressesProvider is SafeOwnableUpgradeable {\\n mapping(string => address) private _addresses;\\n mapping(address => Contract) public plugins;\\n mapping(address => Contract) public flywheelRewards;\\n mapping(address => RedemptionStrategy) public redemptionStrategiesConfig;\\n mapping(address => FundingStrategy) public fundingStrategiesConfig;\\n JarvisPool[] public jarvisPoolsConfig;\\n CurveSwapPool[] public curveSwapPoolsConfig;\\n mapping(address => mapping(address => address)) public balancerPoolForTokens;\\n\\n /// @dev Initializer to set the admin that can set and change contracts addresses\\n function initialize(address owner) public initializer {\\n __SafeOwnable_init(owner);\\n }\\n\\n /**\\n * @dev The contract address and a string that uniquely identifies the contract's interface\\n */\\n struct Contract {\\n address addr;\\n string contractInterface;\\n }\\n\\n struct RedemptionStrategy {\\n address addr;\\n string contractInterface;\\n address outputToken;\\n }\\n\\n struct FundingStrategy {\\n address addr;\\n string contractInterface;\\n address inputToken;\\n }\\n\\n struct JarvisPool {\\n address syntheticToken;\\n address collateralToken;\\n address liquidityPool;\\n uint256 expirationTime;\\n }\\n\\n struct CurveSwapPool {\\n address poolAddress;\\n address[] coins;\\n }\\n\\n /**\\n * @dev sets the address and contract interface ID of the flywheel for the reward token\\n * @param rewardToken the reward token address\\n * @param flywheelRewardsModule the flywheel rewards module address\\n * @param contractInterface a string that uniquely identifies the contract's interface\\n */\\n function setFlywheelRewards(\\n address rewardToken,\\n address flywheelRewardsModule,\\n string calldata contractInterface\\n ) public onlyOwner {\\n flywheelRewards[rewardToken] = Contract(flywheelRewardsModule, contractInterface);\\n }\\n\\n /**\\n * @dev sets the address and contract interface ID of the ERC4626 plugin for the asset\\n * @param asset the asset address\\n * @param plugin the ERC4626 plugin address\\n * @param contractInterface a string that uniquely identifies the contract's interface\\n */\\n function setPlugin(\\n address asset,\\n address plugin,\\n string calldata contractInterface\\n ) public onlyOwner {\\n plugins[asset] = Contract(plugin, contractInterface);\\n }\\n\\n /**\\n * @dev sets the address and contract interface ID of the redemption strategy for the asset\\n * @param asset the asset address\\n * @param strategy redemption strategy address\\n * @param contractInterface a string that uniquely identifies the contract's interface\\n */\\n function setRedemptionStrategy(\\n address asset,\\n address strategy,\\n string calldata contractInterface,\\n address outputToken\\n ) public onlyOwner {\\n redemptionStrategiesConfig[asset] = RedemptionStrategy(strategy, contractInterface, outputToken);\\n }\\n\\n function getRedemptionStrategy(address asset) public view returns (RedemptionStrategy memory) {\\n return redemptionStrategiesConfig[asset];\\n }\\n\\n /**\\n * @dev sets the address and contract interface ID of the funding strategy for the asset\\n * @param asset the asset address\\n * @param strategy funding strategy address\\n * @param contractInterface a string that uniquely identifies the contract's interface\\n */\\n function setFundingStrategy(\\n address asset,\\n address strategy,\\n string calldata contractInterface,\\n address inputToken\\n ) public onlyOwner {\\n fundingStrategiesConfig[asset] = FundingStrategy(strategy, contractInterface, inputToken);\\n }\\n\\n function getFundingStrategy(address asset) public view returns (FundingStrategy memory) {\\n return fundingStrategiesConfig[asset];\\n }\\n\\n /**\\n * @dev configures the Jarvis pool of a Jarvis synthetic token\\n * @param syntheticToken the synthetic token address\\n * @param collateralToken the collateral token address\\n * @param liquidityPool the liquidity pool address\\n * @param expirationTime the operation expiration time\\n */\\n function setJarvisPool(\\n address syntheticToken,\\n address collateralToken,\\n address liquidityPool,\\n uint256 expirationTime\\n ) public onlyOwner {\\n jarvisPoolsConfig.push(JarvisPool(syntheticToken, collateralToken, liquidityPool, expirationTime));\\n }\\n\\n function setCurveSwapPool(address poolAddress, address[] calldata coins) public onlyOwner {\\n curveSwapPoolsConfig.push(CurveSwapPool(poolAddress, coins));\\n }\\n\\n /**\\n * @dev Sets an address for an id replacing the address saved in the addresses map\\n * @param id The id\\n * @param newAddress The address to set\\n */\\n function setAddress(string calldata id, address newAddress) external onlyOwner {\\n _addresses[id] = newAddress;\\n }\\n\\n /**\\n * @dev Returns an address by id\\n * @return The address\\n */\\n function getAddress(string calldata id) public view returns (address) {\\n return _addresses[id];\\n }\\n\\n function getCurveSwapPools() public view returns (CurveSwapPool[] memory) {\\n return curveSwapPoolsConfig;\\n }\\n\\n function getJarvisPools() public view returns (JarvisPool[] memory) {\\n return jarvisPoolsConfig;\\n }\\n\\n function setBalancerPoolForTokens(\\n address inputToken,\\n address outputToken,\\n address pool\\n ) external onlyOwner {\\n balancerPoolForTokens[inputToken][outputToken] = pool;\\n }\\n\\n function getBalancerPoolForTokens(address inputToken, address outputToken) external view returns (address) {\\n return balancerPoolForTokens[inputToken][outputToken];\\n }\\n}\\n\",\"keccak256\":\"0xf48e9e8b2150408c1c6b68dd957226c342ba47396da792fdaa0922f539a7e163\",\"license\":\"AGPL-3.0-only\"},\"contracts/ionic/AuthoritiesRegistry.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport { PoolRolesAuthority } from \\\"../ionic/PoolRolesAuthority.sol\\\";\\nimport { SafeOwnableUpgradeable } from \\\"../ionic/SafeOwnableUpgradeable.sol\\\";\\nimport { IonicComptroller } from \\\"../compound/ComptrollerInterface.sol\\\";\\n\\nimport { TransparentUpgradeableProxy } from \\\"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\\\";\\n\\ncontract AuthoritiesRegistry is SafeOwnableUpgradeable {\\n mapping(address => PoolRolesAuthority) public poolsAuthorities;\\n PoolRolesAuthority public poolAuthLogic;\\n address public leveredPositionsFactory;\\n bool public noAuthRequired;\\n\\n function initialize(address _leveredPositionsFactory) public initializer {\\n __SafeOwnable_init(msg.sender);\\n leveredPositionsFactory = _leveredPositionsFactory;\\n poolAuthLogic = new PoolRolesAuthority();\\n }\\n\\n function reinitialize(address _leveredPositionsFactory) public onlyOwnerOrAdmin {\\n leveredPositionsFactory = _leveredPositionsFactory;\\n poolAuthLogic = new PoolRolesAuthority();\\n // for Neon the auth is not required\\n noAuthRequired = block.chainid == 245022934;\\n }\\n\\n function createPoolAuthority(address pool) public onlyOwner returns (PoolRolesAuthority auth) {\\n require(address(poolsAuthorities[pool]) == address(0), \\\"already created\\\");\\n\\n TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(address(poolAuthLogic), _getProxyAdmin(), \\\"\\\");\\n auth = PoolRolesAuthority(address(proxy));\\n auth.initialize(address(this));\\n poolsAuthorities[pool] = auth;\\n\\n auth.openPoolSupplierCapabilities(IonicComptroller(pool));\\n auth.setUserRole(address(this), auth.REGISTRY_ROLE(), true);\\n // sets the registry owner as the auth owner\\n reconfigureAuthority(pool);\\n }\\n\\n function reconfigureAuthority(address poolAddress) public {\\n IonicComptroller pool = IonicComptroller(poolAddress);\\n PoolRolesAuthority auth = poolsAuthorities[address(pool)];\\n\\n if (msg.sender != poolAddress || address(auth) != address(0)) {\\n require(address(auth) != address(0), \\\"no such authority\\\");\\n require(msg.sender == owner() || msg.sender == poolAddress, \\\"not owner or pool\\\");\\n\\n auth.configureRegistryCapabilities();\\n auth.configurePoolSupplierCapabilities(pool);\\n auth.configurePoolBorrowerCapabilities(pool);\\n // everyone can be a liquidator\\n auth.configureOpenPoolLiquidatorCapabilities(pool);\\n auth.configureLeveredPositionCapabilities(pool);\\n\\n if (auth.owner() != owner()) {\\n auth.setOwner(owner());\\n }\\n }\\n }\\n\\n function canCall(\\n address pool,\\n address user,\\n address target,\\n bytes4 functionSig\\n ) external view returns (bool) {\\n PoolRolesAuthority authorityForPool = poolsAuthorities[pool];\\n if (address(authorityForPool) == address(0)) {\\n return noAuthRequired;\\n } else {\\n // allow only if an auth exists and it allows the action\\n return authorityForPool.canCall(user, target, functionSig);\\n }\\n }\\n\\n function setUserRole(\\n address pool,\\n address user,\\n uint8 role,\\n bool enabled\\n ) external {\\n PoolRolesAuthority poolAuth = poolsAuthorities[pool];\\n\\n require(address(poolAuth) != address(0), \\\"auth does not exist\\\");\\n require(msg.sender == owner() || msg.sender == leveredPositionsFactory, \\\"not owner or factory\\\");\\n require(msg.sender != leveredPositionsFactory || role == poolAuth.LEVERED_POSITION_ROLE(), \\\"only lev pos role\\\");\\n\\n poolAuth.setUserRole(user, role, enabled);\\n }\\n}\\n\",\"keccak256\":\"0x98fc1f8a735b5759fc7524e3065ae322703d2771e7ec429e1cc9b60a4b1028dd\",\"license\":\"UNLICENSED\"},\"contracts/ionic/DiamondExtension.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\n/**\\n * @notice a base contract for logic extensions that use the diamond pattern storage\\n * to map the functions when looking up the extension contract to delegate to.\\n */\\nabstract contract DiamondExtension {\\n /**\\n * @return a list of all the function selectors that this logic extension exposes\\n */\\n function _getExtensionFunctions() external pure virtual returns (bytes4[] memory);\\n}\\n\\n// When no function exists for function called\\nerror FunctionNotFound(bytes4 _functionSelector);\\n\\n// When no extension exists for function called\\nerror ExtensionNotFound(bytes4 _functionSelector);\\n\\n// When the function is already added\\nerror FunctionAlreadyAdded(bytes4 _functionSelector, address _currentImpl);\\n\\nabstract contract DiamondBase {\\n /**\\n * @dev register a logic extension\\n * @param extensionToAdd the extension whose functions are to be added\\n * @param extensionToReplace the extension whose functions are to be removed/replaced\\n */\\n function _registerExtension(DiamondExtension extensionToAdd, DiamondExtension extensionToReplace) external virtual;\\n\\n function _listExtensions() public view returns (address[] memory) {\\n return LibDiamond.listExtensions();\\n }\\n\\n fallback() external {\\n address extension = LibDiamond.getExtensionForFunction(msg.sig);\\n if (extension == address(0)) revert FunctionNotFound(msg.sig);\\n // Execute external function from extension using delegatecall and return any value.\\n assembly {\\n // copy function selector and any arguments\\n calldatacopy(0, 0, calldatasize())\\n // execute function call using the extension\\n let result := delegatecall(gas(), extension, 0, calldatasize(), 0, 0)\\n // get any return value\\n returndatacopy(0, 0, returndatasize())\\n // return any return value or error back to the caller\\n switch result\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n}\\n\\n/**\\n * @notice a library to use in a contract, whose logic is extended with diamond extension\\n */\\nlibrary LibDiamond {\\n bytes32 constant DIAMOND_STORAGE_POSITION = keccak256(\\\"diamond.extensions.diamond.storage\\\");\\n\\n struct Function {\\n address extension;\\n bytes4 selector;\\n }\\n\\n struct LogicStorage {\\n Function[] functions;\\n address[] extensions;\\n }\\n\\n function getExtensionForFunction(bytes4 msgSig) internal view returns (address) {\\n return getExtensionForSelector(msgSig, diamondStorage());\\n }\\n\\n function diamondStorage() internal pure returns (LogicStorage storage ds) {\\n bytes32 position = DIAMOND_STORAGE_POSITION;\\n assembly {\\n ds.slot := position\\n }\\n }\\n\\n function listExtensions() internal view returns (address[] memory) {\\n return diamondStorage().extensions;\\n }\\n\\n function registerExtension(DiamondExtension extensionToAdd, DiamondExtension extensionToReplace) internal {\\n if (address(extensionToReplace) != address(0)) {\\n removeExtension(extensionToReplace);\\n }\\n addExtension(extensionToAdd);\\n }\\n\\n function removeExtension(DiamondExtension extension) internal {\\n LogicStorage storage ds = diamondStorage();\\n // remove all functions of the extension to replace\\n removeExtensionFunctions(extension);\\n for (uint8 i = 0; i < ds.extensions.length; i++) {\\n if (ds.extensions[i] == address(extension)) {\\n ds.extensions[i] = ds.extensions[ds.extensions.length - 1];\\n ds.extensions.pop();\\n }\\n }\\n }\\n\\n function addExtension(DiamondExtension extension) internal {\\n LogicStorage storage ds = diamondStorage();\\n for (uint8 i = 0; i < ds.extensions.length; i++) {\\n require(ds.extensions[i] != address(extension), \\\"extension already added\\\");\\n }\\n addExtensionFunctions(extension);\\n ds.extensions.push(address(extension));\\n }\\n\\n function removeExtensionFunctions(DiamondExtension extension) internal {\\n bytes4[] memory fnsToRemove = extension._getExtensionFunctions();\\n LogicStorage storage ds = diamondStorage();\\n for (uint16 i = 0; i < fnsToRemove.length; i++) {\\n bytes4 selectorToRemove = fnsToRemove[i];\\n // must never fail\\n assert(address(extension) == getExtensionForSelector(selectorToRemove, ds));\\n // swap with the last element in the selectorAtIndex array and remove the last element\\n uint16 indexToKeep = getIndexForSelector(selectorToRemove, ds);\\n ds.functions[indexToKeep] = ds.functions[ds.functions.length - 1];\\n ds.functions.pop();\\n }\\n }\\n\\n function addExtensionFunctions(DiamondExtension extension) internal {\\n bytes4[] memory fnsToAdd = extension._getExtensionFunctions();\\n LogicStorage storage ds = diamondStorage();\\n uint16 functionsCount = uint16(ds.functions.length);\\n for (uint256 functionsIndex = 0; functionsIndex < fnsToAdd.length; functionsIndex++) {\\n bytes4 selector = fnsToAdd[functionsIndex];\\n address oldImplementation = getExtensionForSelector(selector, ds);\\n if (oldImplementation != address(0)) revert FunctionAlreadyAdded(selector, oldImplementation);\\n ds.functions.push(Function(address(extension), selector));\\n functionsCount++;\\n }\\n }\\n\\n function getExtensionForSelector(bytes4 selector, LogicStorage storage ds) internal view returns (address) {\\n uint256 fnsLen = ds.functions.length;\\n for (uint256 i = 0; i < fnsLen; i++) {\\n if (ds.functions[i].selector == selector) return ds.functions[i].extension;\\n }\\n\\n return address(0);\\n }\\n\\n function getIndexForSelector(bytes4 selector, LogicStorage storage ds) internal view returns (uint16) {\\n uint16 fnsLen = uint16(ds.functions.length);\\n for (uint16 i = 0; i < fnsLen; i++) {\\n if (ds.functions[i].selector == selector) return i;\\n }\\n\\n return type(uint16).max;\\n }\\n}\\n\",\"keccak256\":\"0x6d33291928e3c255f0276fa465dcc5ea88d74a6562241a39ad2e52ae8abaf7bc\",\"license\":\"UNLICENSED\"},\"contracts/ionic/PoolRolesAuthority.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport { IonicComptroller, ComptrollerInterface } from \\\"../compound/ComptrollerInterface.sol\\\";\\nimport { ICErc20, CTokenSecondExtensionInterface, CTokenFirstExtensionInterface } from \\\"../compound/CTokenInterfaces.sol\\\";\\n\\nimport { RolesAuthority, Authority } from \\\"solmate/auth/authorities/RolesAuthority.sol\\\";\\n\\nimport \\\"openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\\\";\\n\\ncontract PoolRolesAuthority is RolesAuthority, Initializable {\\n constructor() RolesAuthority(address(0), Authority(address(0))) {\\n _disableInitializers();\\n }\\n\\n function initialize(address _owner) public initializer {\\n owner = _owner;\\n authority = this;\\n }\\n\\n // up to 256 roles\\n uint8 public constant REGISTRY_ROLE = 0;\\n uint8 public constant SUPPLIER_ROLE = 1;\\n uint8 public constant BORROWER_ROLE = 2;\\n uint8 public constant LIQUIDATOR_ROLE = 3;\\n uint8 public constant LEVERED_POSITION_ROLE = 4;\\n\\n function configureRegistryCapabilities() external requiresAuth {\\n setRoleCapability(REGISTRY_ROLE, address(this), PoolRolesAuthority.configureRegistryCapabilities.selector, true);\\n setRoleCapability(\\n REGISTRY_ROLE,\\n address(this),\\n PoolRolesAuthority.configurePoolSupplierCapabilities.selector,\\n true\\n );\\n setRoleCapability(\\n REGISTRY_ROLE,\\n address(this),\\n PoolRolesAuthority.configurePoolBorrowerCapabilities.selector,\\n true\\n );\\n setRoleCapability(\\n REGISTRY_ROLE,\\n address(this),\\n PoolRolesAuthority.configureClosedPoolLiquidatorCapabilities.selector,\\n true\\n );\\n setRoleCapability(\\n REGISTRY_ROLE,\\n address(this),\\n PoolRolesAuthority.configureOpenPoolLiquidatorCapabilities.selector,\\n true\\n );\\n setRoleCapability(\\n REGISTRY_ROLE,\\n address(this),\\n PoolRolesAuthority.configureLeveredPositionCapabilities.selector,\\n true\\n );\\n setRoleCapability(REGISTRY_ROLE, address(this), RolesAuthority.setUserRole.selector, true);\\n }\\n\\n function openPoolSupplierCapabilities(IonicComptroller pool) external requiresAuth {\\n _setPublicPoolSupplierCapabilities(pool, true);\\n }\\n\\n function closePoolSupplierCapabilities(IonicComptroller pool) external requiresAuth {\\n _setPublicPoolSupplierCapabilities(pool, false);\\n }\\n\\n function _setPublicPoolSupplierCapabilities(IonicComptroller pool, bool setPublic) internal {\\n setPublicCapability(address(pool), pool.enterMarkets.selector, setPublic);\\n setPublicCapability(address(pool), pool.exitMarket.selector, setPublic);\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n bytes4[] memory selectors = getSupplierMarketSelectors();\\n for (uint256 j = 0; j < selectors.length; j++) {\\n setPublicCapability(address(allMarkets[i]), selectors[j], setPublic);\\n }\\n }\\n }\\n\\n function configurePoolSupplierCapabilities(IonicComptroller pool) external requiresAuth {\\n _configurePoolSupplierCapabilities(pool, SUPPLIER_ROLE);\\n }\\n\\n function getSupplierMarketSelectors() internal pure returns (bytes4[] memory selectors) {\\n uint8 fnsCount = 6;\\n selectors = new bytes4[](fnsCount);\\n selectors[--fnsCount] = CTokenSecondExtensionInterface.mint.selector;\\n selectors[--fnsCount] = CTokenSecondExtensionInterface.redeem.selector;\\n selectors[--fnsCount] = CTokenSecondExtensionInterface.redeemUnderlying.selector;\\n selectors[--fnsCount] = CTokenFirstExtensionInterface.transfer.selector;\\n selectors[--fnsCount] = CTokenFirstExtensionInterface.transferFrom.selector;\\n selectors[--fnsCount] = CTokenFirstExtensionInterface.approve.selector;\\n\\n require(fnsCount == 0, \\\"use the correct array length\\\");\\n return selectors;\\n }\\n\\n function _configurePoolSupplierCapabilities(IonicComptroller pool, uint8 role) internal {\\n setRoleCapability(role, address(pool), pool.enterMarkets.selector, true);\\n setRoleCapability(role, address(pool), pool.exitMarket.selector, true);\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n bytes4[] memory selectors = getSupplierMarketSelectors();\\n for (uint256 j = 0; j < selectors.length; j++) {\\n setRoleCapability(role, address(allMarkets[i]), selectors[j], true);\\n }\\n }\\n }\\n\\n function openPoolBorrowerCapabilities(IonicComptroller pool) external requiresAuth {\\n _setPublicPoolBorrowerCapabilities(pool, true);\\n }\\n\\n function closePoolBorrowerCapabilities(IonicComptroller pool) external requiresAuth {\\n _setPublicPoolBorrowerCapabilities(pool, false);\\n }\\n\\n function _setPublicPoolBorrowerCapabilities(IonicComptroller pool, bool setPublic) internal {\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].borrow.selector, setPublic);\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].repayBorrow.selector, setPublic);\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].repayBorrowBehalf.selector, setPublic);\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].flash.selector, setPublic);\\n }\\n }\\n\\n function configurePoolBorrowerCapabilities(IonicComptroller pool) external requiresAuth {\\n // borrowers have the SUPPLIER_ROLE capabilities by default\\n _configurePoolSupplierCapabilities(pool, BORROWER_ROLE);\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].borrow.selector, true);\\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].repayBorrow.selector, true);\\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].repayBorrowBehalf.selector, true);\\n setRoleCapability(BORROWER_ROLE, address(allMarkets[i]), allMarkets[i].flash.selector, true);\\n }\\n }\\n\\n function configureClosedPoolLiquidatorCapabilities(IonicComptroller pool) external requiresAuth {\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].liquidateBorrow.selector, false);\\n setRoleCapability(LIQUIDATOR_ROLE, address(allMarkets[i]), allMarkets[i].liquidateBorrow.selector, true);\\n setRoleCapability(LIQUIDATOR_ROLE, address(allMarkets[i]), allMarkets[i].redeem.selector, true);\\n }\\n }\\n\\n function configureOpenPoolLiquidatorCapabilities(IonicComptroller pool) external requiresAuth {\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].liquidateBorrow.selector, true);\\n // TODO this leaves redeeming open for everyone\\n setPublicCapability(address(allMarkets[i]), allMarkets[i].redeem.selector, true);\\n }\\n }\\n\\n function configureLeveredPositionCapabilities(IonicComptroller pool) external requiresAuth {\\n setRoleCapability(LEVERED_POSITION_ROLE, address(pool), pool.enterMarkets.selector, true);\\n setRoleCapability(LEVERED_POSITION_ROLE, address(pool), pool.exitMarket.selector, true);\\n ICErc20[] memory allMarkets = pool.getAllMarkets();\\n for (uint256 i = 0; i < allMarkets.length; i++) {\\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].mint.selector, true);\\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].redeem.selector, true);\\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].redeemUnderlying.selector, true);\\n\\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].borrow.selector, true);\\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].repayBorrow.selector, true);\\n setRoleCapability(LEVERED_POSITION_ROLE, address(allMarkets[i]), allMarkets[i].flash.selector, true);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x1ec824166a7b4b1e67384a25d231d3acab89ef90ff43ff380cbf1715410d9851\",\"license\":\"UNLICENSED\"},\"contracts/ionic/SafeOwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport \\\"openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\\\";\\n\\n/**\\n * @dev Ownable extension that requires a two-step process of setting the pending owner and the owner accepting it.\\n * @notice Existing OwnableUpgradeable contracts cannot be upgraded due to the extra storage variable\\n * that will shift the other.\\n */\\nabstract contract SafeOwnableUpgradeable is OwnableUpgradeable {\\n /**\\n * @notice Pending owner of this contract\\n */\\n address public pendingOwner;\\n\\n function __SafeOwnable_init(address owner_) internal onlyInitializing {\\n __Ownable_init();\\n _transferOwnership(owner_);\\n }\\n\\n struct AddressSlot {\\n address value;\\n }\\n\\n modifier onlyOwnerOrAdmin() {\\n bool isOwner = owner() == _msgSender();\\n if (!isOwner) {\\n address admin = _getProxyAdmin();\\n bool isAdmin = admin == _msgSender();\\n require(isAdmin, \\\"Ownable: caller is neither the owner nor the admin\\\");\\n }\\n _;\\n }\\n\\n /**\\n * @notice Emitted when pendingOwner is changed\\n */\\n event NewPendingOwner(address oldPendingOwner, address newPendingOwner);\\n\\n /**\\n * @notice Emitted when pendingOwner is accepted, which means owner is updated\\n */\\n event NewOwner(address oldOwner, address newOwner);\\n\\n /**\\n * @notice Begins transfer of owner rights. The newPendingOwner must call `_acceptOwner` to finalize the transfer.\\n * @dev Owner function to begin change of owner. The newPendingOwner must call `_acceptOwner` to finalize the transfer.\\n * @param newPendingOwner New pending owner.\\n */\\n function _setPendingOwner(address newPendingOwner) public onlyOwner {\\n // Save current value, if any, for inclusion in log\\n address oldPendingOwner = pendingOwner;\\n\\n // Store pendingOwner with value newPendingOwner\\n pendingOwner = newPendingOwner;\\n\\n // Emit NewPendingOwner(oldPendingOwner, newPendingOwner)\\n emit NewPendingOwner(oldPendingOwner, newPendingOwner);\\n }\\n\\n /**\\n * @notice Accepts transfer of owner rights. msg.sender must be pendingOwner\\n * @dev Owner function for pending owner to accept role and update owner\\n */\\n function _acceptOwner() public {\\n // Check caller is pendingOwner and pendingOwner \\u2260 address(0)\\n require(msg.sender == pendingOwner, \\\"not the pending owner\\\");\\n\\n // Save current values for inclusion in log\\n address oldOwner = owner();\\n address oldPendingOwner = pendingOwner;\\n\\n // Store owner with value pendingOwner\\n _transferOwnership(pendingOwner);\\n\\n // Clear the pending value\\n pendingOwner = address(0);\\n\\n emit NewOwner(oldOwner, pendingOwner);\\n emit NewPendingOwner(oldPendingOwner, pendingOwner);\\n }\\n\\n function renounceOwnership() public override onlyOwner {\\n // do not remove this overriding fn\\n revert(\\\"not used anymore\\\");\\n }\\n\\n function transferOwnership(address newOwner) public override onlyOwner {\\n emit NewPendingOwner(pendingOwner, newOwner);\\n pendingOwner = newOwner;\\n }\\n\\n function _getProxyAdmin() internal view returns (address admin) {\\n bytes32 _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n AddressSlot storage adminSlot;\\n assembly {\\n adminSlot.slot := _ADMIN_SLOT\\n }\\n admin = adminSlot.value;\\n }\\n}\\n\",\"keccak256\":\"0x73f50a022ee86874b63ebd7e418b5948ef2913e32cb80024fe3cd4f17be7f2a5\",\"license\":\"UNLICENSED\"},\"contracts/oracles/BasePriceOracle.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport \\\"../compound/CTokenInterfaces.sol\\\";\\n\\n/**\\n * @title BasePriceOracle\\n * @notice Returns prices of underlying tokens directly without the caller having to specify a cToken address.\\n * @dev Implements the `PriceOracle` interface.\\n * @author David Lucid (https://github.com/davidlucid)\\n */\\ninterface BasePriceOracle {\\n /**\\n * @notice Get the price of an underlying asset.\\n * @param underlying The underlying asset to get the price of.\\n * @return The underlying asset price in ETH as a mantissa (scaled by 1e18).\\n * Zero means the price is unavailable.\\n */\\n function price(address underlying) external view returns (uint256);\\n\\n /**\\n * @notice Get the underlying price of a cToken asset\\n * @param cToken The cToken to get the underlying price of\\n * @return The underlying asset price mantissa (scaled by 1e18).\\n * Zero means the price is unavailable.\\n */\\n function getUnderlyingPrice(ICErc20 cToken) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0xed2a27a8dc71a4280c0ef19d3165ff237d8066ae782e750b071bb39d12e73404\",\"license\":\"UNLICENSED\"},\"contracts/oracles/MasterPriceOracle.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport \\\"openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\\\";\\n\\nimport { ICErc20 } from \\\"../compound/CTokenInterfaces.sol\\\";\\n\\nimport { BasePriceOracle } from \\\"./BasePriceOracle.sol\\\";\\n\\n/**\\n * @title MasterPriceOracle\\n * @notice Use a combination of price oracles.\\n * @dev Implements `PriceOracle`.\\n * @author David Lucid (https://github.com/davidlucid)\\n */\\ncontract MasterPriceOracle is Initializable, BasePriceOracle {\\n /**\\n * @dev Maps underlying token addresses to `PriceOracle` contracts (can be `BasePriceOracle` contracts too).\\n */\\n mapping(address => BasePriceOracle) public oracles;\\n\\n /**\\n * @dev Default/fallback `PriceOracle`.\\n */\\n BasePriceOracle public defaultOracle;\\n\\n /**\\n * @dev The administrator of this `MasterPriceOracle`.\\n */\\n address public admin;\\n\\n /**\\n * @dev Controls if `admin` can overwrite existing assignments of oracles to underlying tokens.\\n */\\n bool internal noAdminOverwrite;\\n\\n /**\\n * @dev The Wrapped native asset address.\\n */\\n address public wtoken;\\n\\n /**\\n * @dev Maps underlying token addresses to `PriceOracle` contracts (can be `BasePriceOracle` contracts too).\\n */\\n mapping(address => BasePriceOracle) public fallbackOracles;\\n\\n /**\\n * @dev Returns a boolean indicating if `admin` can overwrite existing assignments of oracles to underlying tokens.\\n */\\n function canAdminOverwrite() external view returns (bool) {\\n return !noAdminOverwrite;\\n }\\n\\n /**\\n * @dev Event emitted when `admin` is changed.\\n */\\n event NewAdmin(address oldAdmin, address newAdmin);\\n\\n /**\\n * @dev Event emitted when the default oracle is changed.\\n */\\n event NewDefaultOracle(address oldOracle, address newOracle);\\n\\n /**\\n * @dev Event emitted when an underlying token's oracle is changed.\\n */\\n event NewOracle(address underlying, address oldOracle, address newOracle);\\n\\n /**\\n * @dev Initialize state variables.\\n * @param underlyings The underlying ERC20 token addresses to link to `_oracles`.\\n * @param _oracles The `PriceOracle` contracts to be assigned to `underlyings`.\\n * @param _defaultOracle The default `PriceOracle` contract to use.\\n * @param _admin The admin who can assign oracles to underlying tokens.\\n * @param _canAdminOverwrite Controls if `admin` can overwrite existing assignments of oracles to underlying tokens.\\n * @param _wtoken The Wrapped native asset address\\n */\\n function initialize(\\n address[] memory underlyings,\\n BasePriceOracle[] memory _oracles,\\n BasePriceOracle _defaultOracle,\\n address _admin,\\n bool _canAdminOverwrite,\\n address _wtoken\\n ) external initializer {\\n // Input validation\\n require(underlyings.length == _oracles.length, \\\"Lengths of both arrays must be equal.\\\");\\n\\n // Initialize state variables\\n for (uint256 i = 0; i < underlyings.length; i++) {\\n address underlying = underlyings[i];\\n BasePriceOracle newOracle = _oracles[i];\\n oracles[underlying] = newOracle;\\n emit NewOracle(underlying, address(0), address(newOracle));\\n }\\n\\n defaultOracle = _defaultOracle;\\n admin = _admin;\\n noAdminOverwrite = !_canAdminOverwrite;\\n wtoken = _wtoken;\\n }\\n\\n /**\\n * @dev Sets `_oracles` for `underlyings`.\\n */\\n function add(address[] calldata underlyings, BasePriceOracle[] calldata _oracles) external onlyAdmin {\\n // Input validation\\n require(\\n underlyings.length > 0 && underlyings.length == _oracles.length,\\n \\\"Lengths of both arrays must be equal and greater than 0.\\\"\\n );\\n\\n // Assign oracles to underlying tokens\\n for (uint256 i = 0; i < underlyings.length; i++) {\\n address underlying = underlyings[i];\\n address oldOracle = address(oracles[underlying]);\\n if (noAdminOverwrite)\\n require(\\n oldOracle == address(0),\\n \\\"Admin cannot overwrite existing assignments of oracles to underlying tokens.\\\"\\n );\\n BasePriceOracle newOracle = _oracles[i];\\n oracles[underlying] = newOracle;\\n emit NewOracle(underlying, oldOracle, address(newOracle));\\n }\\n }\\n\\n /**\\n * @dev Sets `_oracles` for `underlyings`.\\n */\\n function addFallbacks(address[] calldata underlyings, BasePriceOracle[] calldata _oracles) external onlyAdmin {\\n // Input validation\\n require(\\n underlyings.length > 0 && underlyings.length == _oracles.length,\\n \\\"Lengths of both arrays must be equal and greater than 0.\\\"\\n );\\n\\n // Assign oracles to underlying tokens\\n for (uint256 i = 0; i < underlyings.length; i++) {\\n address underlying = underlyings[i];\\n address oldOracle = address(fallbackOracles[underlying]);\\n if (noAdminOverwrite)\\n require(\\n oldOracle == address(0),\\n \\\"Admin cannot overwrite existing assignments of oracles to underlying tokens.\\\"\\n );\\n BasePriceOracle newOracle = _oracles[i];\\n fallbackOracles[underlying] = newOracle;\\n emit NewOracle(underlying, oldOracle, address(newOracle));\\n }\\n }\\n\\n /**\\n * @dev Changes the default price oracle\\n */\\n function setDefaultOracle(BasePriceOracle newOracle) external onlyAdmin {\\n BasePriceOracle oldOracle = defaultOracle;\\n defaultOracle = newOracle;\\n emit NewDefaultOracle(address(oldOracle), address(newOracle));\\n }\\n\\n /**\\n * @dev Changes the admin and emits an event.\\n */\\n function changeAdmin(address newAdmin) external onlyAdmin {\\n address oldAdmin = admin;\\n admin = newAdmin;\\n emit NewAdmin(oldAdmin, newAdmin);\\n }\\n\\n /**\\n * @dev Modifier that checks if `msg.sender == admin`.\\n */\\n modifier onlyAdmin() {\\n require(msg.sender == admin, \\\"Sender is not the admin.\\\");\\n _;\\n }\\n\\n /**\\n * @notice Returns the price in ETH of the token underlying `cToken`.\\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\\n */\\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\\n // Get underlying ERC20 token address\\n address underlying = address(ICErc20(address(cToken)).underlying());\\n\\n if (underlying == wtoken) return 1e18;\\n\\n BasePriceOracle oracle = oracles[underlying];\\n BasePriceOracle fallbackOracle = fallbackOracles[underlying];\\n\\n if (address(oracle) != address(0)) {\\n try oracle.getUnderlyingPrice(cToken) returns (uint256 underlyingPrice) {\\n if (underlyingPrice == 0) {\\n if (address(fallbackOracle) != address(0)) return fallbackOracle.getUnderlyingPrice(cToken);\\n } else {\\n return underlyingPrice;\\n }\\n } catch {\\n if (address(fallbackOracle) != address(0)) return fallbackOracle.getUnderlyingPrice(cToken);\\n }\\n } else {\\n if (address(fallbackOracle) != address(0)) return fallbackOracle.getUnderlyingPrice(cToken);\\n }\\n revert(\\\"Price oracle not found for this underlying token address.\\\");\\n }\\n\\n /**\\n * @dev Attempts to return the price in ETH of `underlying` (implements `BasePriceOracle`).\\n */\\n function price(address underlying) public view override returns (uint256) {\\n // Return 1e18 for WETH\\n if (underlying == wtoken) return 1e18;\\n\\n // Get underlying price from assigned oracle\\n BasePriceOracle oracle = oracles[underlying];\\n BasePriceOracle fallbackOracle = fallbackOracles[underlying];\\n\\n if (address(oracle) != address(0)) {\\n try oracle.price(underlying) returns (uint256 underlyingPrice) {\\n if (underlyingPrice == 0) {\\n if (address(fallbackOracle) != address(0)) return fallbackOracle.price(underlying);\\n } else {\\n return underlyingPrice;\\n }\\n } catch {\\n if (address(fallbackOracle) != address(0)) return fallbackOracle.price(underlying);\\n }\\n } else {\\n if (address(fallbackOracle) != address(0)) return fallbackOracle.price(underlying);\\n }\\n revert(\\\"Price oracle not found for this underlying token address.\\\");\\n }\\n}\\n\",\"keccak256\":\"0x8748b7e74b8f789617f0b387cd2e2259a0fa3639d54234d7e6c99cb3eae6fc9a\",\"license\":\"UNLICENSED\"},\"contracts/oracles/default/DiaPriceOracle.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity >=0.8.0;\\n\\nimport { ERC20Upgradeable } from \\\"openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\\\";\\n\\nimport { IPriceOracle } from \\\"../../external/compound/IPriceOracle.sol\\\";\\nimport { MasterPriceOracle } from \\\"../MasterPriceOracle.sol\\\";\\nimport { BasePriceOracle, ICErc20 } from \\\"../BasePriceOracle.sol\\\";\\n\\ninterface DIAOracleV2 {\\n function getValue(string memory key) external view returns (uint128, uint128);\\n}\\n\\n/**\\n * @title DiaPriceOracle\\n * @notice Returns prices from DIA.\\n * @dev Implements `PriceOracle`.\\n * @author Rahul Sethuram (https://github.com/rhlsthrm)\\n */\\ncontract DiaPriceOracle is BasePriceOracle {\\n struct DiaOracle {\\n DIAOracleV2 feed;\\n string key;\\n }\\n\\n /**\\n * @notice Maps ERC20 token addresses to ETH-based Chainlink price feed contracts.\\n */\\n mapping(address => DiaOracle) public priceFeeds;\\n\\n /**\\n * @dev The administrator of this `MasterPriceOracle`.\\n */\\n address public admin;\\n\\n /**\\n * @dev Controls if `admin` can overwrite existing assignments of oracles to underlying tokens.\\n */\\n bool public immutable CAN_ADMIN_OVERWRITE;\\n\\n /**\\n * @dev The Wrapped native asset address.\\n */\\n address public immutable WTOKEN;\\n\\n /**\\n * @notice DIA NATIVE/USD price feed contracts.\\n */\\n DIAOracleV2 public immutable NATIVE_TOKEN_USD_PRICE_FEED;\\n string public NATIVE_TOKEN_USD_KEY;\\n\\n /**\\n * @notice MasterPriceOracle for backup for USD price.\\n */\\n MasterPriceOracle public immutable MASTER_PRICE_ORACLE;\\n address public immutable USD_TOKEN; // token to use as USD price (i.e. USDC)\\n\\n /**\\n * @dev Constructor to set admin and canAdminOverwrite, wtoken address and native token USD price feed address\\n */\\n constructor(\\n address _admin,\\n bool canAdminOverwrite,\\n address wtoken,\\n DIAOracleV2 nativeTokenUsd,\\n string memory nativeTokenUsdKey,\\n MasterPriceOracle masterPriceOracle,\\n address usdToken\\n ) {\\n admin = _admin;\\n CAN_ADMIN_OVERWRITE = canAdminOverwrite;\\n WTOKEN = wtoken;\\n NATIVE_TOKEN_USD_PRICE_FEED = nativeTokenUsd;\\n NATIVE_TOKEN_USD_KEY = nativeTokenUsdKey;\\n MASTER_PRICE_ORACLE = masterPriceOracle;\\n USD_TOKEN = usdToken;\\n }\\n\\n /**\\n * @dev Changes the admin and emits an event.\\n */\\n function changeAdmin(address newAdmin) external onlyAdmin {\\n address oldAdmin = admin;\\n admin = newAdmin;\\n emit NewAdmin(oldAdmin, newAdmin);\\n }\\n\\n /**\\n * @dev Event emitted when `admin` is changed.\\n */\\n event NewAdmin(address oldAdmin, address newAdmin);\\n\\n /**\\n * @dev Modifier that checks if `msg.sender == admin`.\\n */\\n modifier onlyAdmin() {\\n require(msg.sender == admin, \\\"Sender is not the admin.\\\");\\n _;\\n }\\n\\n /**\\n * @dev Admin-only function to set price feeds.\\n * @param underlyings Underlying token addresses for which to set price feeds.\\n * @param feeds The DIA price feed contract addresses for each of `underlyings`.\\n * @param keys The keys for each of `underlyings`, in the format \\\"ETH/USD\\\" for example\\n */\\n function setPriceFeeds(\\n address[] memory underlyings,\\n DIAOracleV2[] memory feeds,\\n string[] memory keys\\n ) external onlyAdmin {\\n // Input validation\\n require(\\n underlyings.length > 0 && underlyings.length == feeds.length && underlyings.length == keys.length,\\n \\\"Lengths of both arrays must be equal and greater than 0.\\\"\\n );\\n\\n // For each token/feed\\n for (uint256 i = 0; i < underlyings.length; i++) {\\n address underlying = underlyings[i];\\n\\n // Check for existing oracle if !canAdminOverwrite\\n if (!CAN_ADMIN_OVERWRITE)\\n require(\\n address(priceFeeds[underlying].feed) == address(0),\\n \\\"Admin cannot overwrite existing assignments of price feeds to underlying tokens.\\\"\\n );\\n\\n // Set feed and base currency\\n priceFeeds[underlying] = DiaOracle({ feed: feeds[i], key: keys[i] });\\n }\\n }\\n\\n /**\\n * @dev Internal function returning the price in ETH of `underlying`.\\n * Assumes price feeds are 8 decimals!\\n */\\n function _price(address underlying) internal view returns (uint256) {\\n // Return 1e18 for WTOKEN\\n if (underlying == WTOKEN || underlying == address(0)) return 1e18;\\n\\n // Get token/Native price from Oracle\\n DiaOracle memory feed = priceFeeds[underlying];\\n require(address(feed.feed) != address(0), \\\"No oracle price feed found for this underlying ERC20 token.\\\");\\n\\n if (address(NATIVE_TOKEN_USD_PRICE_FEED) == address(0)) {\\n // Get price from MasterPriceOracle\\n uint256 usdNativeTokenPrice = MASTER_PRICE_ORACLE.price(USD_TOKEN);\\n uint256 nativeTokenUsdPrice = 1e36 / usdNativeTokenPrice; // 18 decimals\\n (uint128 tokenUsdPrice, ) = feed.feed.getValue(feed.key); // 8 decimals\\n return tokenUsdPrice >= 0 ? (uint256(tokenUsdPrice) * 1e28) / uint256(nativeTokenUsdPrice) : 0;\\n } else {\\n (uint128 nativeTokenUsdPrice, ) = NATIVE_TOKEN_USD_PRICE_FEED.getValue(NATIVE_TOKEN_USD_KEY);\\n if (nativeTokenUsdPrice <= 0) return 0;\\n (uint128 tokenUsdPrice, ) = feed.feed.getValue(feed.key); // 8 decimals\\n return tokenUsdPrice >= 0 ? (uint256(tokenUsdPrice) * 1e18) / uint256(nativeTokenUsdPrice) : 0;\\n }\\n }\\n\\n /**\\n * @dev Returns the price in ETH of `underlying` (implements `BasePriceOracle`).\\n */\\n function price(address underlying) external view override returns (uint256) {\\n return _price(underlying);\\n }\\n\\n /**\\n * @notice Returns the price in ETH of the token underlying `cToken`.\\n * @dev Implements the `PriceOracle` interface for Ionic pools (and Compound v2).\\n * @return Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`.\\n */\\n function getUnderlyingPrice(ICErc20 cToken) external view override returns (uint256) {\\n // Get underlying token address\\n address underlying = cToken.underlying();\\n\\n // Get price\\n uint256 oraclePrice = _price(underlying);\\n\\n // Format and return price\\n uint256 underlyingDecimals = uint256(ERC20Upgradeable(underlying).decimals());\\n return\\n underlyingDecimals <= 18\\n ? uint256(oraclePrice) * (10**(18 - underlyingDecimals))\\n : uint256(oraclePrice) / (10**(underlyingDecimals - 18));\\n }\\n}\\n\",\"keccak256\":\"0x313db9e5ad3d081f3d586298a4661bb29e0712254b6e1dc1179004970fc9fa18\",\"license\":\"UNLICENSED\"},\"openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n function __Ownable_init() internal onlyInitializing {\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable_init_unchained() internal onlyInitializing {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x247c62047745915c0af6b955470a72d1696ebad4352d7d3011aef1a2463cd888\",\"license\":\"MIT\"},\"openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n *\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n *\\n * Emits an {Initialized} event the first time it is successfully executed.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n\\n /**\\n * @dev Internal function that returns the initialized version. Returns `_initialized`\\n */\\n function _getInitializedVersion() internal view returns (uint8) {\\n return _initialized;\\n }\\n\\n /**\\n * @dev Internal function that returns the initialized version. Returns `_initializing`\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _initializing;\\n }\\n}\\n\",\"keccak256\":\"0x6c2b54ec184943843041ab77f61988b5060f6f03acbfe92cdc125f95f00891da\",\"license\":\"MIT\"},\"openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC20Upgradeable.sol\\\";\\nimport \\\"./extensions/IERC20MetadataUpgradeable.sol\\\";\\nimport \\\"../../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC20} interface.\\n *\\n * This implementation is agnostic to the way tokens are created. This means\\n * that a supply mechanism has to be added in a derived contract using {_mint}.\\n * For a generic mechanism see {ERC20PresetMinterPauser}.\\n *\\n * TIP: For a detailed writeup see our guide\\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\\n * to implement supply mechanisms].\\n *\\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\\n * instead returning `false` on failure. This behavior is nonetheless\\n * conventional and does not conflict with the expectations of ERC20\\n * applications.\\n *\\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\\n * This allows applications to reconstruct the allowance for all accounts just\\n * by listening to said events. Other implementations of the EIP may not emit\\n * these events, as it isn't required by the specification.\\n *\\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\\n * functions have been added to mitigate the well-known issues around setting\\n * allowances. See {IERC20-approve}.\\n */\\ncontract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable {\\n mapping(address => uint256) private _balances;\\n\\n mapping(address => mapping(address => uint256)) private _allowances;\\n\\n uint256 private _totalSupply;\\n\\n string private _name;\\n string private _symbol;\\n\\n /**\\n * @dev Sets the values for {name} and {symbol}.\\n *\\n * The default value of {decimals} is 18. To select a different value for\\n * {decimals} you should overload it.\\n *\\n * All two of these values are immutable: they can only be set once during\\n * construction.\\n */\\n function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing {\\n __ERC20_init_unchained(name_, symbol_);\\n }\\n\\n function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\\n _name = name_;\\n _symbol = symbol_;\\n }\\n\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() public view virtual override returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev Returns the symbol of the token, usually a shorter version of the\\n * name.\\n */\\n function symbol() public view virtual override returns (string memory) {\\n return _symbol;\\n }\\n\\n /**\\n * @dev Returns the number of decimals used to get its user representation.\\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\\n *\\n * Tokens usually opt for a value of 18, imitating the relationship between\\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\\n * overridden;\\n *\\n * NOTE: This information is only used for _display_ purposes: it in\\n * no way affects any of the arithmetic of the contract, including\\n * {IERC20-balanceOf} and {IERC20-transfer}.\\n */\\n function decimals() public view virtual override returns (uint8) {\\n return 18;\\n }\\n\\n /**\\n * @dev See {IERC20-totalSupply}.\\n */\\n function totalSupply() public view virtual override returns (uint256) {\\n return _totalSupply;\\n }\\n\\n /**\\n * @dev See {IERC20-balanceOf}.\\n */\\n function balanceOf(address account) public view virtual override returns (uint256) {\\n return _balances[account];\\n }\\n\\n /**\\n * @dev See {IERC20-transfer}.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - the caller must have a balance of at least `amount`.\\n */\\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\\n address owner = _msgSender();\\n _transfer(owner, to, amount);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-allowance}.\\n */\\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\\n return _allowances[owner][spender];\\n }\\n\\n /**\\n * @dev See {IERC20-approve}.\\n *\\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\\n * `transferFrom`. This is semantically equivalent to an infinite approval.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n */\\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\\n address owner = _msgSender();\\n _approve(owner, spender, amount);\\n return true;\\n }\\n\\n /**\\n * @dev See {IERC20-transferFrom}.\\n *\\n * Emits an {Approval} event indicating the updated allowance. This is not\\n * required by the EIP. See the note at the beginning of {ERC20}.\\n *\\n * NOTE: Does not update the allowance if the current allowance\\n * is the maximum `uint256`.\\n *\\n * Requirements:\\n *\\n * - `from` and `to` cannot be the zero address.\\n * - `from` must have a balance of at least `amount`.\\n * - the caller must have allowance for ``from``'s tokens of at least\\n * `amount`.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) public virtual override returns (bool) {\\n address spender = _msgSender();\\n _spendAllowance(from, spender, amount);\\n _transfer(from, to, amount);\\n return true;\\n }\\n\\n /**\\n * @dev Atomically increases the allowance granted to `spender` by the caller.\\n *\\n * This is an alternative to {approve} that can be used as a mitigation for\\n * problems described in {IERC20-approve}.\\n *\\n * Emits an {Approval} event indicating the updated allowance.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n */\\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\\n address owner = _msgSender();\\n _approve(owner, spender, allowance(owner, spender) + addedValue);\\n return true;\\n }\\n\\n /**\\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\\n *\\n * This is an alternative to {approve} that can be used as a mitigation for\\n * problems described in {IERC20-approve}.\\n *\\n * Emits an {Approval} event indicating the updated allowance.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `spender` must have allowance for the caller of at least\\n * `subtractedValue`.\\n */\\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\\n address owner = _msgSender();\\n uint256 currentAllowance = allowance(owner, spender);\\n require(currentAllowance >= subtractedValue, \\\"ERC20: decreased allowance below zero\\\");\\n unchecked {\\n _approve(owner, spender, currentAllowance - subtractedValue);\\n }\\n\\n return true;\\n }\\n\\n /**\\n * @dev Moves `amount` of tokens from `from` to `to`.\\n *\\n * This internal function is equivalent to {transfer}, and can be used to\\n * e.g. implement automatic token fees, slashing mechanisms, etc.\\n *\\n * Emits a {Transfer} event.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `from` must have a balance of at least `amount`.\\n */\\n function _transfer(\\n address from,\\n address to,\\n uint256 amount\\n ) internal virtual {\\n require(from != address(0), \\\"ERC20: transfer from the zero address\\\");\\n require(to != address(0), \\\"ERC20: transfer to the zero address\\\");\\n\\n _beforeTokenTransfer(from, to, amount);\\n\\n uint256 fromBalance = _balances[from];\\n require(fromBalance >= amount, \\\"ERC20: transfer amount exceeds balance\\\");\\n unchecked {\\n _balances[from] = fromBalance - amount;\\n // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\\n // decrementing then incrementing.\\n _balances[to] += amount;\\n }\\n\\n emit Transfer(from, to, amount);\\n\\n _afterTokenTransfer(from, to, amount);\\n }\\n\\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\\n * the total supply.\\n *\\n * Emits a {Transfer} event with `from` set to the zero address.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n */\\n function _mint(address account, uint256 amount) internal virtual {\\n require(account != address(0), \\\"ERC20: mint to the zero address\\\");\\n\\n _beforeTokenTransfer(address(0), account, amount);\\n\\n _totalSupply += amount;\\n unchecked {\\n // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\\n _balances[account] += amount;\\n }\\n emit Transfer(address(0), account, amount);\\n\\n _afterTokenTransfer(address(0), account, amount);\\n }\\n\\n /**\\n * @dev Destroys `amount` tokens from `account`, reducing the\\n * total supply.\\n *\\n * Emits a {Transfer} event with `to` set to the zero address.\\n *\\n * Requirements:\\n *\\n * - `account` cannot be the zero address.\\n * - `account` must have at least `amount` tokens.\\n */\\n function _burn(address account, uint256 amount) internal virtual {\\n require(account != address(0), \\\"ERC20: burn from the zero address\\\");\\n\\n _beforeTokenTransfer(account, address(0), amount);\\n\\n uint256 accountBalance = _balances[account];\\n require(accountBalance >= amount, \\\"ERC20: burn amount exceeds balance\\\");\\n unchecked {\\n _balances[account] = accountBalance - amount;\\n // Overflow not possible: amount <= accountBalance <= totalSupply.\\n _totalSupply -= amount;\\n }\\n\\n emit Transfer(account, address(0), amount);\\n\\n _afterTokenTransfer(account, address(0), amount);\\n }\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\\n *\\n * This internal function is equivalent to `approve`, and can be used to\\n * e.g. set automatic allowances for certain subsystems, etc.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `owner` cannot be the zero address.\\n * - `spender` cannot be the zero address.\\n */\\n function _approve(\\n address owner,\\n address spender,\\n uint256 amount\\n ) internal virtual {\\n require(owner != address(0), \\\"ERC20: approve from the zero address\\\");\\n require(spender != address(0), \\\"ERC20: approve to the zero address\\\");\\n\\n _allowances[owner][spender] = amount;\\n emit Approval(owner, spender, amount);\\n }\\n\\n /**\\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\\n *\\n * Does not update the allowance amount in case of infinite allowance.\\n * Revert if not enough allowance is available.\\n *\\n * Might emit an {Approval} event.\\n */\\n function _spendAllowance(\\n address owner,\\n address spender,\\n uint256 amount\\n ) internal virtual {\\n uint256 currentAllowance = allowance(owner, spender);\\n if (currentAllowance != type(uint256).max) {\\n require(currentAllowance >= amount, \\\"ERC20: insufficient allowance\\\");\\n unchecked {\\n _approve(owner, spender, currentAllowance - amount);\\n }\\n }\\n }\\n\\n /**\\n * @dev Hook that is called before any transfer of tokens. This includes\\n * minting and burning.\\n *\\n * Calling conditions:\\n *\\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * will be transferred to `to`.\\n * - when `from` is zero, `amount` tokens will be minted for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(\\n address from,\\n address to,\\n uint256 amount\\n ) internal virtual {}\\n\\n /**\\n * @dev Hook that is called after any transfer of tokens. This includes\\n * minting and burning.\\n *\\n * Calling conditions:\\n *\\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\\n * has been transferred to `to`.\\n * - when `from` is zero, `amount` tokens have been minted for `to`.\\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\\n * - `from` and `to` are never both zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _afterTokenTransfer(\\n address from,\\n address to,\\n uint256 amount\\n ) internal virtual {}\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[45] private __gap;\\n}\\n\",\"keccak256\":\"0x17aff86be546601617585e91fd98aad74cf39f1be65d8eb6f93b7f3c30181275\",\"license\":\"MIT\"},\"openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20Upgradeable {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x4e733d3164f73f461eaf9d8087a7ad1ea180bdc8ba0d3d61b0e1ae16d8e63dff\",\"license\":\"MIT\"},\"openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/IERC20MetadataUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20Upgradeable.sol\\\";\\n\\n/**\\n * @dev Interface for the optional metadata functions from the ERC20 standard.\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC20MetadataUpgradeable is IERC20Upgradeable {\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the decimals places of the token.\\n */\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x605434219ebbe4653f703640f06969faa5a1d78f0bfef878e5ddbb1ca369ceeb\",\"license\":\"MIT\"},\"openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x0a3b4afc301241e2629ad192fa02e0f8626e3cf38ab6f45342bfd7afbde16ee0\",\"license\":\"MIT\"},\"openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract ContextUpgradeable is Initializable {\\n function __Context_init() internal onlyInitializing {\\n }\\n\\n function __Context_init_unchained() internal onlyInitializing {\\n }\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x963ea7f0b48b032eef72fe3a7582edf78408d6f834115b9feadd673a4d5bd149\",\"license\":\"MIT\"},\"solmate/auth/Auth.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity >=0.8.0;\\n\\n/// @notice Provides a flexible and updatable auth pattern which is completely separate from application logic.\\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/Auth.sol)\\n/// @author Modified from Dappsys (https://github.com/dapphub/ds-auth/blob/master/src/auth.sol)\\nabstract contract Auth {\\n event OwnerUpdated(address indexed user, address indexed newOwner);\\n\\n event AuthorityUpdated(address indexed user, Authority indexed newAuthority);\\n\\n address public owner;\\n\\n Authority public authority;\\n\\n constructor(address _owner, Authority _authority) {\\n owner = _owner;\\n authority = _authority;\\n\\n emit OwnerUpdated(msg.sender, _owner);\\n emit AuthorityUpdated(msg.sender, _authority);\\n }\\n\\n modifier requiresAuth() virtual {\\n require(isAuthorized(msg.sender, msg.sig), \\\"UNAUTHORIZED\\\");\\n\\n _;\\n }\\n\\n function isAuthorized(address user, bytes4 functionSig) internal view virtual returns (bool) {\\n Authority auth = authority; // Memoizing authority saves us a warm SLOAD, around 100 gas.\\n\\n // Checking if the caller is the owner only after calling the authority saves gas in most cases, but be\\n // aware that this makes protected functions uncallable even to the owner if the authority is out of order.\\n return (address(auth) != address(0) && auth.canCall(user, address(this), functionSig)) || user == owner;\\n }\\n\\n function setAuthority(Authority newAuthority) public virtual {\\n // We check if the caller is the owner first because we want to ensure they can\\n // always swap out the authority even if it's reverting or using up a lot of gas.\\n require(msg.sender == owner || authority.canCall(msg.sender, address(this), msg.sig));\\n\\n authority = newAuthority;\\n\\n emit AuthorityUpdated(msg.sender, newAuthority);\\n }\\n\\n function setOwner(address newOwner) public virtual requiresAuth {\\n owner = newOwner;\\n\\n emit OwnerUpdated(msg.sender, newOwner);\\n }\\n}\\n\\n/// @notice A generic interface for a contract which provides authorization data to an Auth instance.\\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/Auth.sol)\\n/// @author Modified from Dappsys (https://github.com/dapphub/ds-auth/blob/master/src/auth.sol)\\ninterface Authority {\\n function canCall(\\n address user,\\n address target,\\n bytes4 functionSig\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xd5cf8213a40d727af89c93dd359ad68984c123c1a1a93fc9ad7ba62b3436fb75\",\"license\":\"AGPL-3.0-only\"},\"solmate/auth/authorities/RolesAuthority.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0-only\\npragma solidity >=0.8.0;\\n\\nimport {Auth, Authority} from \\\"../Auth.sol\\\";\\n\\n/// @notice Role based Authority that supports up to 256 roles.\\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/authorities/RolesAuthority.sol)\\n/// @author Modified from Dappsys (https://github.com/dapphub/ds-roles/blob/master/src/roles.sol)\\ncontract RolesAuthority is Auth, Authority {\\n /*//////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////*/\\n\\n event UserRoleUpdated(address indexed user, uint8 indexed role, bool enabled);\\n\\n event PublicCapabilityUpdated(address indexed target, bytes4 indexed functionSig, bool enabled);\\n\\n event RoleCapabilityUpdated(uint8 indexed role, address indexed target, bytes4 indexed functionSig, bool enabled);\\n\\n /*//////////////////////////////////////////////////////////////\\n CONSTRUCTOR\\n //////////////////////////////////////////////////////////////*/\\n\\n constructor(address _owner, Authority _authority) Auth(_owner, _authority) {}\\n\\n /*//////////////////////////////////////////////////////////////\\n ROLE/USER STORAGE\\n //////////////////////////////////////////////////////////////*/\\n\\n mapping(address => bytes32) public getUserRoles;\\n\\n mapping(address => mapping(bytes4 => bool)) public isCapabilityPublic;\\n\\n mapping(address => mapping(bytes4 => bytes32)) public getRolesWithCapability;\\n\\n function doesUserHaveRole(address user, uint8 role) public view virtual returns (bool) {\\n return (uint256(getUserRoles[user]) >> role) & 1 != 0;\\n }\\n\\n function doesRoleHaveCapability(\\n uint8 role,\\n address target,\\n bytes4 functionSig\\n ) public view virtual returns (bool) {\\n return (uint256(getRolesWithCapability[target][functionSig]) >> role) & 1 != 0;\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n AUTHORIZATION LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n function canCall(\\n address user,\\n address target,\\n bytes4 functionSig\\n ) public view virtual override returns (bool) {\\n return\\n isCapabilityPublic[target][functionSig] ||\\n bytes32(0) != getUserRoles[user] & getRolesWithCapability[target][functionSig];\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n ROLE CAPABILITY CONFIGURATION LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n function setPublicCapability(\\n address target,\\n bytes4 functionSig,\\n bool enabled\\n ) public virtual requiresAuth {\\n isCapabilityPublic[target][functionSig] = enabled;\\n\\n emit PublicCapabilityUpdated(target, functionSig, enabled);\\n }\\n\\n function setRoleCapability(\\n uint8 role,\\n address target,\\n bytes4 functionSig,\\n bool enabled\\n ) public virtual requiresAuth {\\n if (enabled) {\\n getRolesWithCapability[target][functionSig] |= bytes32(1 << role);\\n } else {\\n getRolesWithCapability[target][functionSig] &= ~bytes32(1 << role);\\n }\\n\\n emit RoleCapabilityUpdated(role, target, functionSig, enabled);\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n USER ROLE ASSIGNMENT LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n function setUserRole(\\n address user,\\n uint8 role,\\n bool enabled\\n ) public virtual requiresAuth {\\n if (enabled) {\\n getUserRoles[user] |= bytes32(1 << role);\\n } else {\\n getUserRoles[user] &= ~bytes32(1 << role);\\n }\\n\\n emit UserRoleUpdated(user, role, enabled);\\n }\\n}\\n\",\"keccak256\":\"0x278247a2c5b0accb60af8d3749e34ab5d4436ee4f35a8fff301aaa25ab690762\",\"license\":\"AGPL-3.0-only\"}},\"version\":1}", + "bytecode": "0x6101206040523480156200001257600080fd5b5060405162001835380380620018358339810160408190526200003591620000d5565b600180546001600160a01b0319166001600160a01b038981169190911790915586151560805285811660a052841660c0526002620000748482620002bb565b506001600160a01b0391821660e052166101005250620003879350505050565b6001600160a01b0381168114620000aa57600080fd5b50565b8051620000ba8162000094565b919050565b634e487b7160e01b600052604160045260246000fd5b600080600080600080600060e0888a031215620000f157600080fd5b8751620000fe8162000094565b8097505060208089015180151581146200011757600080fd5b60408a01519097506200012a8162000094565b60608a01519096506200013d8162000094565b60808a01519095506001600160401b03808211156200015b57600080fd5b818b0191508b601f8301126200017057600080fd5b815181811115620001855762000185620000bf565b604051601f8201601f19908116603f01168101908382118183101715620001b057620001b0620000bf565b816040528281528e86848701011115620001c957600080fd5b600093505b82841015620001ed5784840186015181850187015292850192620001ce565b60008684830101528098505050505050506200020c60a08901620000ad565b91506200021c60c08901620000ad565b905092959891949750929550565b600181811c908216806200023f57607f821691505b6020821081036200026057634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620002b6576000816000526020600020601f850160051c81016020861015620002915750805b601f850160051c820191505b81811015620002b2578281556001016200029d565b5050505b505050565b81516001600160401b03811115620002d757620002d7620000bf565b620002ef81620002e884546200022a565b8462000266565b602080601f8311600181146200032757600084156200030e5750858301515b600019600386901b1c1916600185901b178555620002b2565b600085815260208120601f198616915b82811015620003585788860151825594840194600190910190840162000337565b5085821015620003775787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a05160c05160e05161010051611441620003f4600039600081816101b101526109f701526000818161014e0152610a2201526000818160fa015281816109b40152610b75015260008181610175015261081501526000818160be015261056901526114416000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c80639d23c812116100715780639d23c812146101ac5780639dcb511a146101d3578063aea91078146101f4578063b48f0a5414610215578063f851a44014610228578063fc57d4df1461023b57600080fd5b806319983c85146100b95780633a750685146100f55780634805e467146101345780635381c2ae146101495780635bcf1f76146101705780638f28397014610197575b600080fd5b6100e07f000000000000000000000000000000000000000000000000000000000000000081565b60405190151581526020015b60405180910390f35b61011c7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100ec565b61013c61024e565b6040516100ec9190610cfd565b61011c7f000000000000000000000000000000000000000000000000000000000000000081565b61011c7f000000000000000000000000000000000000000000000000000000000000000081565b6101aa6101a5366004610d2f565b6102dc565b005b61011c7f000000000000000000000000000000000000000000000000000000000000000081565b6101e66101e1366004610d2f565b610397565b6040516100ec929190610d4c565b610207610202366004610d2f565b610446565b6040519081526020016100ec565b6101aa610223366004610f40565b610457565b60015461011c906001600160a01b031681565b610207610249366004610d2f565b6106dd565b6002805461025b90611026565b80601f016020809104026020016040519081016040528092919081815260200182805461028790611026565b80156102d45780601f106102a9576101008083540402835291602001916102d4565b820191906000526020600020905b8154815290600101906020018083116102b757829003601f168201915b505050505081565b6001546001600160a01b031633146103365760405162461bcd60e51b815260206004820152601860248201527729b2b73232b91034b9903737ba103a34329030b236b4b71760411b60448201526064015b60405180910390fd5b600180546001600160a01b038381166001600160a01b031983168117909355604080519190921680825260208201939093527ff9ffabca9c8276e99321725bcb43fb076a6c66a54b7f21c4e8146d8519b417dc910160405180910390a15050565b600060208190529081526040902080546001820180546001600160a01b0390921692916103c390611026565b80601f01602080910402602001604051908101604052809291908181526020018280546103ef90611026565b801561043c5780601f106104115761010080835404028352916020019161043c565b820191906000526020600020905b81548152906001019060200180831161041f57829003601f168201915b5050505050905082565b600061045182610811565b92915050565b6001546001600160a01b031633146104ac5760405162461bcd60e51b815260206004820152601860248201527729b2b73232b91034b9903737ba103a34329030b236b4b71760411b604482015260640161032d565b600083511180156104be575081518351145b80156104cb575080518351145b61053d5760405162461bcd60e51b815260206004820152603860248201527f4c656e67746873206f6620626f746820617272617973206d757374206265206560448201527f7175616c20616e642067726561746572207468616e20302e0000000000000000606482015260840161032d565b60005b83518110156106d757600084828151811061055d5761055d61105a565b602002602001015190507f0000000000000000000000000000000000000000000000000000000000000000610633576001600160a01b0381811660009081526020819052604090205416156106335760405162461bcd60e51b815260206004820152605060248201527f41646d696e2063616e6e6f74206f7665727772697465206578697374696e672060448201527f61737369676e6d656e7473206f6620707269636520666565647320746f20756e60648201526f3232b9363cb4b733903a37b5b2b7399760811b608482015260a40161032d565b60405180604001604052808584815181106106505761065061105a565b60200260200101516001600160a01b031681526020018484815181106106785761067861105a565b6020908102919091018101519091526001600160a01b03838116600090815280835260409020835181546001600160a01b03191692169190911781559082015160018201906106c790826110c1565b5050600190920191506105409050565b50505050565b600080826001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa15801561071e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107429190611181565b9050600061074f82610811565b90506000826001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610791573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b5919061119e565b60ff16905060128111156107e8576107ce6012826111d7565b6107d990600a6112ce565b6107e390836112da565b610808565b6107f38160126111d7565b6107fe90600a6112ce565b61080890836112fc565b95945050505050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b0316148061085a57506001600160a01b038216155b1561086e5750670de0b6b3a7640000919050565b6001600160a01b038083166000908152602081815260408083208151808301909252805490941681526001840180549394919391928401916108af90611026565b80601f01602080910402602001604051908101604052809291908181526020018280546108db90611026565b80156109285780601f106108fd57610100808354040283529160200191610928565b820191906000526020600020905b81548152906001019060200180831161090b57829003601f168201915b5050509190925250508151919250506001600160a01b03166109b25760405162461bcd60e51b815260206004820152603b60248201527f4e6f206f7261636c65207072696365206665656420666f756e6420666f72207460448201527f68697320756e6465726c79696e6720455243323020746f6b656e2e0000000000606482015260840161032d565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610b5b576040516315d5220f60e31b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811660048301526000917f00000000000000000000000000000000000000000000000000000000000000009091169063aea9107890602401602060405180830381865afa158015610a6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8f9190611313565b90506000610aac826ec097ce7bc90715b34b9f10000000006112da565b835160208501516040516304b01c2560e51b81529293506000926001600160a01b039092169163960384a091610ae491600401610cfd565b6040805180830381865afa158015610b00573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b249190611348565b50905081610b476001600160801b0383166b204fce5e3e250261100000006112fc565b610b5191906112da565b9695505050505050565b6040516304b01c2560e51b81526000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063960384a090610bab9060029060040161137b565b6040805180830381865afa158015610bc7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610beb9190611348565b5090506000816001600160801b031611610c09575060009392505050565b815160208301516040516304b01c2560e51b81526000926001600160a01b03169163960384a091610c3d9190600401610cfd565b6040805180830381865afa158015610c59573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c7d9190611348565b509050816001600160801b0316816001600160801b0316670de0b6b3a7640000610ca791906112fc565b61080891906112da565b50919050565b6000815180845260005b81811015610cdd57602081850181015186830182015201610cc1565b506000602082860101526020601f19601f83011685010191505092915050565b602081526000610d106020830184610cb7565b9392505050565b6001600160a01b0381168114610d2c57600080fd5b50565b600060208284031215610d4157600080fd5b8135610d1081610d17565b6001600160a01b0383168152604060208201819052600090610d7090830184610cb7565b949350505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715610db757610db7610d78565b604052919050565b600067ffffffffffffffff821115610dd957610dd9610d78565b5060051b60200190565b600082601f830112610df457600080fd5b81356020610e09610e0483610dbf565b610d8e565b8083825260208201915060208460051b870101935086841115610e2b57600080fd5b602086015b84811015610e50578035610e4381610d17565b8352918301918301610e30565b509695505050505050565b6000601f83601f840112610e6e57600080fd5b82356020610e7e610e0483610dbf565b82815260059290921b85018101918181019087841115610e9d57600080fd5b8287015b84811015610f3457803567ffffffffffffffff80821115610ec25760008081fd5b818a0191508a603f830112610ed75760008081fd5b85820135604082821115610eed57610eed610d78565b610efe828b01601f19168901610d8e565b92508183528c81838601011115610f155760008081fd5b8181850189850137506000908201870152845250918301918301610ea1565b50979650505050505050565b600080600060608486031215610f5557600080fd5b833567ffffffffffffffff80821115610f6d57600080fd5b818601915086601f830112610f8157600080fd5b81356020610f91610e0483610dbf565b82815260059290921b8401810191818101908a841115610fb057600080fd5b948201945b83861015610fd7578535610fc881610d17565b82529482019490820190610fb5565b97505087013592505080821115610fed57600080fd5b610ff987838801610de3565b9350604086013591508082111561100f57600080fd5b5061101c86828701610e5b565b9150509250925092565b600181811c9082168061103a57607f821691505b602082108103610cb157634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b601f8211156110bc576000816000526020600020601f850160051c810160208610156110995750805b601f850160051c820191505b818110156110b8578281556001016110a5565b5050505b505050565b815167ffffffffffffffff8111156110db576110db610d78565b6110ef816110e98454611026565b84611070565b602080601f831160018114611124576000841561110c5750858301515b600019600386901b1c1916600185901b1785556110b8565b600085815260208120601f198616915b8281101561115357888601518255948401946001909101908401611134565b50858210156111715787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60006020828403121561119357600080fd5b8151610d1081610d17565b6000602082840312156111b057600080fd5b815160ff81168114610d1057600080fd5b634e487b7160e01b600052601160045260246000fd5b81810381811115610451576104516111c1565b600181815b8085111561122557816000190482111561120b5761120b6111c1565b8085161561121857918102915b93841c93908002906111ef565b509250929050565b60008261123c57506001610451565b8161124957506000610451565b816001811461125f576002811461126957611285565b6001915050610451565b60ff84111561127a5761127a6111c1565b50506001821b610451565b5060208310610133831016604e8410600b84101617156112a8575081810a610451565b6112b283836111ea565b80600019048211156112c6576112c66111c1565b029392505050565b6000610d10838361122d565b6000826112f757634e487b7160e01b600052601260045260246000fd5b500490565b8082028115828204841417610451576104516111c1565b60006020828403121561132557600080fd5b5051919050565b80516001600160801b038116811461134357600080fd5b919050565b6000806040838503121561135b57600080fd5b6113648361132c565b91506113726020840161132c565b90509250929050565b600060208083526000845461138f81611026565b80602087015260406001808416600081146113b157600181146113cd576113fd565b60ff19851660408a0152604084151560051b8a010195506113fd565b89600052602060002060005b858110156113f45781548b82018601529083019088016113d9565b8a016040019650505b50939897505050505050505056fea26469706673582212202067af773b5f9c56b25e244b357641486256755cb4eeed12d3f8f887c962cabf64736f6c63430008160033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100b45760003560e01c80639d23c812116100715780639d23c812146101ac5780639dcb511a146101d3578063aea91078146101f4578063b48f0a5414610215578063f851a44014610228578063fc57d4df1461023b57600080fd5b806319983c85146100b95780633a750685146100f55780634805e467146101345780635381c2ae146101495780635bcf1f76146101705780638f28397014610197575b600080fd5b6100e07f000000000000000000000000000000000000000000000000000000000000000081565b60405190151581526020015b60405180910390f35b61011c7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100ec565b61013c61024e565b6040516100ec9190610cfd565b61011c7f000000000000000000000000000000000000000000000000000000000000000081565b61011c7f000000000000000000000000000000000000000000000000000000000000000081565b6101aa6101a5366004610d2f565b6102dc565b005b61011c7f000000000000000000000000000000000000000000000000000000000000000081565b6101e66101e1366004610d2f565b610397565b6040516100ec929190610d4c565b610207610202366004610d2f565b610446565b6040519081526020016100ec565b6101aa610223366004610f40565b610457565b60015461011c906001600160a01b031681565b610207610249366004610d2f565b6106dd565b6002805461025b90611026565b80601f016020809104026020016040519081016040528092919081815260200182805461028790611026565b80156102d45780601f106102a9576101008083540402835291602001916102d4565b820191906000526020600020905b8154815290600101906020018083116102b757829003601f168201915b505050505081565b6001546001600160a01b031633146103365760405162461bcd60e51b815260206004820152601860248201527729b2b73232b91034b9903737ba103a34329030b236b4b71760411b60448201526064015b60405180910390fd5b600180546001600160a01b038381166001600160a01b031983168117909355604080519190921680825260208201939093527ff9ffabca9c8276e99321725bcb43fb076a6c66a54b7f21c4e8146d8519b417dc910160405180910390a15050565b600060208190529081526040902080546001820180546001600160a01b0390921692916103c390611026565b80601f01602080910402602001604051908101604052809291908181526020018280546103ef90611026565b801561043c5780601f106104115761010080835404028352916020019161043c565b820191906000526020600020905b81548152906001019060200180831161041f57829003601f168201915b5050505050905082565b600061045182610811565b92915050565b6001546001600160a01b031633146104ac5760405162461bcd60e51b815260206004820152601860248201527729b2b73232b91034b9903737ba103a34329030b236b4b71760411b604482015260640161032d565b600083511180156104be575081518351145b80156104cb575080518351145b61053d5760405162461bcd60e51b815260206004820152603860248201527f4c656e67746873206f6620626f746820617272617973206d757374206265206560448201527f7175616c20616e642067726561746572207468616e20302e0000000000000000606482015260840161032d565b60005b83518110156106d757600084828151811061055d5761055d61105a565b602002602001015190507f0000000000000000000000000000000000000000000000000000000000000000610633576001600160a01b0381811660009081526020819052604090205416156106335760405162461bcd60e51b815260206004820152605060248201527f41646d696e2063616e6e6f74206f7665727772697465206578697374696e672060448201527f61737369676e6d656e7473206f6620707269636520666565647320746f20756e60648201526f3232b9363cb4b733903a37b5b2b7399760811b608482015260a40161032d565b60405180604001604052808584815181106106505761065061105a565b60200260200101516001600160a01b031681526020018484815181106106785761067861105a565b6020908102919091018101519091526001600160a01b03838116600090815280835260409020835181546001600160a01b03191692169190911781559082015160018201906106c790826110c1565b5050600190920191506105409050565b50505050565b600080826001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa15801561071e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107429190611181565b9050600061074f82610811565b90506000826001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610791573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b5919061119e565b60ff16905060128111156107e8576107ce6012826111d7565b6107d990600a6112ce565b6107e390836112da565b610808565b6107f38160126111d7565b6107fe90600a6112ce565b61080890836112fc565b95945050505050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b0316148061085a57506001600160a01b038216155b1561086e5750670de0b6b3a7640000919050565b6001600160a01b038083166000908152602081815260408083208151808301909252805490941681526001840180549394919391928401916108af90611026565b80601f01602080910402602001604051908101604052809291908181526020018280546108db90611026565b80156109285780601f106108fd57610100808354040283529160200191610928565b820191906000526020600020905b81548152906001019060200180831161090b57829003601f168201915b5050509190925250508151919250506001600160a01b03166109b25760405162461bcd60e51b815260206004820152603b60248201527f4e6f206f7261636c65207072696365206665656420666f756e6420666f72207460448201527f68697320756e6465726c79696e6720455243323020746f6b656e2e0000000000606482015260840161032d565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610b5b576040516315d5220f60e31b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811660048301526000917f00000000000000000000000000000000000000000000000000000000000000009091169063aea9107890602401602060405180830381865afa158015610a6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8f9190611313565b90506000610aac826ec097ce7bc90715b34b9f10000000006112da565b835160208501516040516304b01c2560e51b81529293506000926001600160a01b039092169163960384a091610ae491600401610cfd565b6040805180830381865afa158015610b00573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b249190611348565b50905081610b476001600160801b0383166b204fce5e3e250261100000006112fc565b610b5191906112da565b9695505050505050565b6040516304b01c2560e51b81526000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063960384a090610bab9060029060040161137b565b6040805180830381865afa158015610bc7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610beb9190611348565b5090506000816001600160801b031611610c09575060009392505050565b815160208301516040516304b01c2560e51b81526000926001600160a01b03169163960384a091610c3d9190600401610cfd565b6040805180830381865afa158015610c59573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c7d9190611348565b509050816001600160801b0316816001600160801b0316670de0b6b3a7640000610ca791906112fc565b61080891906112da565b50919050565b6000815180845260005b81811015610cdd57602081850181015186830182015201610cc1565b506000602082860101526020601f19601f83011685010191505092915050565b602081526000610d106020830184610cb7565b9392505050565b6001600160a01b0381168114610d2c57600080fd5b50565b600060208284031215610d4157600080fd5b8135610d1081610d17565b6001600160a01b0383168152604060208201819052600090610d7090830184610cb7565b949350505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715610db757610db7610d78565b604052919050565b600067ffffffffffffffff821115610dd957610dd9610d78565b5060051b60200190565b600082601f830112610df457600080fd5b81356020610e09610e0483610dbf565b610d8e565b8083825260208201915060208460051b870101935086841115610e2b57600080fd5b602086015b84811015610e50578035610e4381610d17565b8352918301918301610e30565b509695505050505050565b6000601f83601f840112610e6e57600080fd5b82356020610e7e610e0483610dbf565b82815260059290921b85018101918181019087841115610e9d57600080fd5b8287015b84811015610f3457803567ffffffffffffffff80821115610ec25760008081fd5b818a0191508a603f830112610ed75760008081fd5b85820135604082821115610eed57610eed610d78565b610efe828b01601f19168901610d8e565b92508183528c81838601011115610f155760008081fd5b8181850189850137506000908201870152845250918301918301610ea1565b50979650505050505050565b600080600060608486031215610f5557600080fd5b833567ffffffffffffffff80821115610f6d57600080fd5b818601915086601f830112610f8157600080fd5b81356020610f91610e0483610dbf565b82815260059290921b8401810191818101908a841115610fb057600080fd5b948201945b83861015610fd7578535610fc881610d17565b82529482019490820190610fb5565b97505087013592505080821115610fed57600080fd5b610ff987838801610de3565b9350604086013591508082111561100f57600080fd5b5061101c86828701610e5b565b9150509250925092565b600181811c9082168061103a57607f821691505b602082108103610cb157634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b601f8211156110bc576000816000526020600020601f850160051c810160208610156110995750805b601f850160051c820191505b818110156110b8578281556001016110a5565b5050505b505050565b815167ffffffffffffffff8111156110db576110db610d78565b6110ef816110e98454611026565b84611070565b602080601f831160018114611124576000841561110c5750858301515b600019600386901b1c1916600185901b1785556110b8565b600085815260208120601f198616915b8281101561115357888601518255948401946001909101908401611134565b50858210156111715787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60006020828403121561119357600080fd5b8151610d1081610d17565b6000602082840312156111b057600080fd5b815160ff81168114610d1057600080fd5b634e487b7160e01b600052601160045260246000fd5b81810381811115610451576104516111c1565b600181815b8085111561122557816000190482111561120b5761120b6111c1565b8085161561121857918102915b93841c93908002906111ef565b509250929050565b60008261123c57506001610451565b8161124957506000610451565b816001811461125f576002811461126957611285565b6001915050610451565b60ff84111561127a5761127a6111c1565b50506001821b610451565b5060208310610133831016604e8410600b84101617156112a8575081810a610451565b6112b283836111ea565b80600019048211156112c6576112c66111c1565b029392505050565b6000610d10838361122d565b6000826112f757634e487b7160e01b600052601260045260246000fd5b500490565b8082028115828204841417610451576104516111c1565b60006020828403121561132557600080fd5b5051919050565b80516001600160801b038116811461134357600080fd5b919050565b6000806040838503121561135b57600080fd5b6113648361132c565b91506113726020840161132c565b90509250929050565b600060208083526000845461138f81611026565b80602087015260406001808416600081146113b157600181146113cd576113fd565b60ff19851660408a0152604084151560051b8a010195506113fd565b89600052602060002060005b858110156113f45781548b82018601529083019088016113d9565b8a016040019650505b50939897505050505050505056fea26469706673582212202067af773b5f9c56b25e244b357641486256755cb4eeed12d3f8f887c962cabf64736f6c63430008160033", + "devdoc": { + "author": "Rahul Sethuram (https://github.com/rhlsthrm)", + "details": "Implements `PriceOracle`.", + "events": { + "NewAdmin(address,address)": { + "details": "Event emitted when `admin` is changed." + } + }, + "kind": "dev", + "methods": { + "changeAdmin(address)": { + "details": "Changes the admin and emits an event." + }, + "constructor": { + "details": "Constructor to set admin and canAdminOverwrite, wtoken address and native token USD price feed address" + }, + "getUnderlyingPrice(address)": { + "details": "Implements the `PriceOracle` interface for Ionic pools (and Compound v2).", + "returns": { + "_0": "Price in ETH of the token underlying `cToken`, scaled by `10 ** (36 - underlyingDecimals)`." + } + }, + "price(address)": { + "details": "Returns the price in ETH of `underlying` (implements `BasePriceOracle`)." + }, + "setPriceFeeds(address[],address[],string[])": { + "details": "Admin-only function to set price feeds.", + "params": { + "feeds": "The DIA price feed contract addresses for each of `underlyings`.", + "keys": "The keys for each of `underlyings`, in the format \"ETH/USD\" for example", + "underlyings": "Underlying token addresses for which to set price feeds." + } + } + }, + "stateVariables": { + "CAN_ADMIN_OVERWRITE": { + "details": "Controls if `admin` can overwrite existing assignments of oracles to underlying tokens." + }, + "WTOKEN": { + "details": "The Wrapped native asset address." + }, + "admin": { + "details": "The administrator of this `MasterPriceOracle`." + } + }, + "title": "DiaPriceOracle", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "MASTER_PRICE_ORACLE()": { + "notice": "MasterPriceOracle for backup for USD price." + }, + "NATIVE_TOKEN_USD_PRICE_FEED()": { + "notice": "DIA NATIVE/USD price feed contracts." + }, + "getUnderlyingPrice(address)": { + "notice": "Returns the price in ETH of the token underlying `cToken`." + }, + "priceFeeds(address)": { + "notice": "Maps ERC20 token addresses to ETH-based Chainlink price feed contracts." + } + }, + "notice": "Returns prices from DIA.", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 77145, + "contract": "contracts/oracles/default/DiaPriceOracle.sol:DiaPriceOracle", + "label": "priceFeeds", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_address,t_struct(DiaOracle)77139_storage)" + }, + { + "astId": 77148, + "contract": "contracts/oracles/default/DiaPriceOracle.sol:DiaPriceOracle", + "label": "admin", + "offset": 0, + "slot": "1", + "type": "t_address" + }, + { + "astId": 77160, + "contract": "contracts/oracles/default/DiaPriceOracle.sol:DiaPriceOracle", + "label": "NATIVE_TOKEN_USD_KEY", + "offset": 0, + "slot": "2", + "type": "t_string_storage" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_contract(DIAOracleV2)77130": { + "encoding": "inplace", + "label": "contract DIAOracleV2", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_struct(DiaOracle)77139_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => struct DiaPriceOracle.DiaOracle)", + "numberOfBytes": "32", + "value": "t_struct(DiaOracle)77139_storage" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_struct(DiaOracle)77139_storage": { + "encoding": "inplace", + "label": "struct DiaPriceOracle.DiaOracle", + "members": [ + { + "astId": 77136, + "contract": "contracts/oracles/default/DiaPriceOracle.sol:DiaPriceOracle", + "label": "feed", + "offset": 0, + "slot": "0", + "type": "t_contract(DIAOracleV2)77130" + }, + { + "astId": 77138, + "contract": "contracts/oracles/default/DiaPriceOracle.sol:DiaPriceOracle", + "label": "key", + "offset": 0, + "slot": "1", + "type": "t_string_storage" + } + ], + "numberOfBytes": "64" + } + } + } +} \ No newline at end of file diff --git a/packages/contracts/tasks/chain-specific/base/index.ts b/packages/contracts/tasks/chain-specific/base/index.ts index 7db7508b9..8933c6cc8 100644 --- a/packages/contracts/tasks/chain-specific/base/index.ts +++ b/packages/contracts/tasks/chain-specific/base/index.ts @@ -34,4 +34,5 @@ export const cbBTC_MARKET = "0x1De166df671AE6DB4C4C98903df88E8007593748"; export const uSOL_MARKET = "0xbd06905590b6E1b6Ac979Fc477A0AebB58d52371"; export const uSUI_MARKET = "0xAa255Cf8e294BD7fcAB21897C0791e50C99BAc69"; export const sUSDz_MARKET = "0xf64bfd19DdCB2Bb54e6f976a233d0A9400ed84eA"; -export const fBOMB_MARKET = "0xd333681242F376f9005d1208ff946C3EE73eD659"; \ No newline at end of file +export const fBOMB_MARKET = "0xd333681242F376f9005d1208ff946C3EE73eD659"; +export const KLIMA_MARKET = "0x600D660440f15EeADbC3fc1403375e04b318F07e"; \ No newline at end of file diff --git a/packages/contracts/tasks/chain-specific/base/markets.ts b/packages/contracts/tasks/chain-specific/base/markets.ts index ea8238010..3d6175307 100644 --- a/packages/contracts/tasks/chain-specific/base/markets.ts +++ b/packages/contracts/tasks/chain-specific/base/markets.ts @@ -6,7 +6,7 @@ import { Address, zeroAddress } from "viem"; import { prepareAndLogTransaction } from "../../../chainDeploy/helpers/logging"; task("markets:deploy:base:new", "deploy base market").setAction(async (_, { viem, run }) => { - const assetsToDeploy: string[] = [assetSymbols.fBOMB]; + const assetsToDeploy: string[] = [assetSymbols.KLIMA]; for (const asset of base.assets.filter((asset) => assetsToDeploy.includes(asset.symbol))) { console.log("Deploying market for ", asset.symbol, asset.name); await new Promise((resolve) => setTimeout(resolve, 10000)); // Wait 10 seconds @@ -42,13 +42,13 @@ task("markets:deploy:base:new", "deploy base market").setAction(async (_, { viem task("base:set-caps:new", "one time setup").setAction(async (_, { viem, run, getNamedAccounts, deployments }) => { const { deployer } = await getNamedAccounts(); - const assetsToDeploy: string[] = [assetSymbols.sUSDz, assetSymbols.weETH, assetSymbols.wUSDM]; + const assetsToDeploy: string[] = [assetSymbols.KLIMA]; for (const asset of base.assets.filter((asset) => assetsToDeploy.includes(asset.symbol))) { const pool = await viem.getContractAt("IonicComptroller", COMPTROLLER); const cToken = await pool.read.cTokensByUnderlying([asset.underlying]); const asExt = await viem.getContractAt("CTokenFirstExtension", cToken); const admin = await pool.read.admin(); - const ap = await deployments.get("AddressesProvider"); + // const ap = await deployments.get("AddressesProvider"); // if (admin.toLowerCase() !== deployer.toLowerCase()) { // await prepareAndLogTransaction({ // contractInstance: asExt, diff --git a/packages/contracts/tasks/chain-specific/base/rewards.ts b/packages/contracts/tasks/chain-specific/base/rewards.ts index 12e84ec5f..8b94aef83 100644 --- a/packages/contracts/tasks/chain-specific/base/rewards.ts +++ b/packages/contracts/tasks/chain-specific/base/rewards.ts @@ -11,6 +11,7 @@ import { hyUSD, hyUSD_MARKET, ION, + KLIMA_MARKET, RSR_MARKET, sUSDz_MARKET, USDC_MARKET, @@ -433,7 +434,7 @@ task("base:add-rewards:epoch5:supply", "add rewards to a market").setAction( const { deployer, multisig } = await getNamedAccounts(); const rewardToken = ION; const rewardTokenName = "ION"; - const market = fBOMB_MARKET; + const market = KLIMA_MARKET; const _market = await viem.getContractAt("EIP20Interface", market); const name = await _market.read.name(); diff --git a/packages/sdk/deployments/base.json b/packages/sdk/deployments/base.json index 40e8bc83f..a31d72b39 100644 --- a/packages/sdk/deployments/base.json +++ b/packages/sdk/deployments/base.json @@ -80,6 +80,9 @@ "DefaultProxyAdmin": { "address": "0x04C21Db52CcA974dF3Dc019C92E52e522ce57156" }, + "DiaPriceOracle": { + "address": "0xa66bff05c0410883951F2Da2Fa6b135D4856aF84" + }, "ERC4626Oracle": { "address": "0xa87c5D63AC47911639A3Cbf65a618E397B7De144" }, diff --git a/packages/types/src/chain.ts b/packages/types/src/chain.ts index f11c566f7..4142b1443 100644 --- a/packages/types/src/chain.ts +++ b/packages/types/src/chain.ts @@ -12,6 +12,11 @@ export type ChainlinkSpecificParams = { export type PythSpecificParams = { feed: string }; +export type DiaSpecificParams = { + feed: Address; + key: string; +}; + export type VelodromeSpecificParams = { pricesContract: Address; }; diff --git a/packages/types/src/enums.ts b/packages/types/src/enums.ts index 47b84dc81..b7b48eb1c 100644 --- a/packages/types/src/enums.ts +++ b/packages/types/src/enums.ts @@ -207,6 +207,7 @@ export enum assetSymbols { uSUI = "uSUI", sUSDz = "sUSDz", fBOMB = "fBOMB", + KLIMA = "KLIMA", // optimism OP = "OP", diff --git a/packages/ui/app/_components/markets/PoolRows.tsx b/packages/ui/app/_components/markets/PoolRows.tsx index 98ed0739f..4ae486771 100644 --- a/packages/ui/app/_components/markets/PoolRows.tsx +++ b/packages/ui/app/_components/markets/PoolRows.tsx @@ -339,7 +339,7 @@ const PoolRows = ({ COLLATERAL FACTOR: - {collateralFactor}% + {Math.round(collateralFactor)}%
= { 'wstETH', 'cbETH', 'USD+', - 'fBOMB' + 'fBOMB', + 'KLIMA' ] } ] diff --git a/packages/ui/public/img/symbols/32/color/klima.png b/packages/ui/public/img/symbols/32/color/klima.png new file mode 100644 index 000000000..5f0d480a2 Binary files /dev/null and b/packages/ui/public/img/symbols/32/color/klima.png differ diff --git a/packages/ui/utils/multipliers.ts b/packages/ui/utils/multipliers.ts index 2bf74a3c3..5b355c650 100644 --- a/packages/ui/utils/multipliers.ts +++ b/packages/ui/utils/multipliers.ts @@ -633,6 +633,20 @@ export const multipliers: Record< ionAPR: true, flywheel: true } + }, + KLIMA: { + borrow: { + ionic: 0, + turtle: false, + ionAPR: false, + flywheel: false + }, + supply: { + ionic: 0, + turtle: false, + ionAPR: true, + flywheel: true + } } } },