From 0558b531e5922e39717445efebfa21f806e4ec57 Mon Sep 17 00:00:00 2001 From: danilo neves cruz Date: Sun, 23 Jul 2023 13:09:06 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=80=20optimism:=20deploy=20`EXA`=20pri?= =?UTF-8?q?ce=20feed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/sour-suns-change.md | 5 + deployments/optimism/EXAPool.json | 559 +++++++++++++++++++++++++ deployments/optimism/PriceFeedEXA.json | 183 ++++++++ 3 files changed, 747 insertions(+) create mode 100644 .changeset/sour-suns-change.md create mode 100644 deployments/optimism/EXAPool.json create mode 100644 deployments/optimism/PriceFeedEXA.json diff --git a/.changeset/sour-suns-change.md b/.changeset/sour-suns-change.md new file mode 100644 index 000000000..fc0cf9930 --- /dev/null +++ b/.changeset/sour-suns-change.md @@ -0,0 +1,5 @@ +--- +"@exactly/protocol": patch +--- + +🚀 optimism: deploy `EXA` price feed diff --git a/deployments/optimism/EXAPool.json b/deployments/optimism/EXAPool.json new file mode 100644 index 000000000..d932b4c89 --- /dev/null +++ b/deployments/optimism/EXAPool.json @@ -0,0 +1,559 @@ +{ + "address": "0xf3C45b45223Df6071a478851B9C17e0630fDf535", + "abi": [ + { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, + { "inputs": [], "name": "BelowMinimumK", "type": "error" }, + { "inputs": [], "name": "DepositsNotEqual", "type": "error" }, + { "inputs": [], "name": "FactoryAlreadySet", "type": "error" }, + { "inputs": [], "name": "InsufficientInputAmount", "type": "error" }, + { "inputs": [], "name": "InsufficientLiquidity", "type": "error" }, + { "inputs": [], "name": "InsufficientLiquidityBurned", "type": "error" }, + { "inputs": [], "name": "InsufficientLiquidityMinted", "type": "error" }, + { "inputs": [], "name": "InsufficientOutputAmount", "type": "error" }, + { "inputs": [], "name": "InvalidTo", "type": "error" }, + { "inputs": [], "name": "IsPaused", "type": "error" }, + { "inputs": [], "name": "K", "type": "error" }, + { "inputs": [], "name": "NotEmergencyCouncil", "type": "error" }, + { + "inputs": [{ "internalType": "string", "name": "str", "type": "string" }], + "name": "StringTooLong", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount0", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "amount1", "type": "uint256" } + ], + "name": "Burn", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "recipient", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount0", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "amount1", "type": "uint256" } + ], + "name": "Claim", + "type": "event" + }, + { "anonymous": false, "inputs": [], "name": "EIP712DomainChanged", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount0", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "amount1", "type": "uint256" } + ], + "name": "Fees", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount0", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "amount1", "type": "uint256" } + ], + "name": "Mint", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount0In", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "amount1In", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "amount0Out", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "amount1Out", "type": "uint256" } + ], + "name": "Swap", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "reserve0", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "reserve1", "type": "uint256" } + ], + "name": "Sync", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [], + "name": "DOMAIN_SEPARATOR", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" }, + { "internalType": "address", "name": "spender", "type": "address" } + ], + "name": "allowance", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "approve", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "balanceOf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "blockTimestampLast", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], + "name": "burn", + "outputs": [ + { "internalType": "uint256", "name": "amount0", "type": "uint256" }, + { "internalType": "uint256", "name": "amount1", "type": "uint256" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "claimFees", + "outputs": [ + { "internalType": "uint256", "name": "claimed0", "type": "uint256" }, + { "internalType": "uint256", "name": "claimed1", "type": "uint256" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "claimable0", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "claimable1", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "currentCumulativePrices", + "outputs": [ + { "internalType": "uint256", "name": "reserve0Cumulative", "type": "uint256" }, + { "internalType": "uint256", "name": "reserve1Cumulative", "type": "uint256" }, + { "internalType": "uint256", "name": "blockTimestamp", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "subtractedValue", "type": "uint256" } + ], + "name": "decreaseAllowance", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "eip712Domain", + "outputs": [ + { "internalType": "bytes1", "name": "fields", "type": "bytes1" }, + { "internalType": "string", "name": "name", "type": "string" }, + { "internalType": "string", "name": "version", "type": "string" }, + { "internalType": "uint256", "name": "chainId", "type": "uint256" }, + { "internalType": "address", "name": "verifyingContract", "type": "address" }, + { "internalType": "bytes32", "name": "salt", "type": "bytes32" }, + { "internalType": "uint256[]", "name": "extensions", "type": "uint256[]" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "factory", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "amountIn", "type": "uint256" }, + { "internalType": "address", "name": "tokenIn", "type": "address" } + ], + "name": "getAmountOut", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getReserves", + "outputs": [ + { "internalType": "uint256", "name": "_reserve0", "type": "uint256" }, + { "internalType": "uint256", "name": "_reserve1", "type": "uint256" }, + { "internalType": "uint256", "name": "_blockTimestampLast", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "addedValue", "type": "uint256" } + ], + "name": "increaseAllowance", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "index0", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "index1", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_token0", "type": "address" }, + { "internalType": "address", "name": "_token1", "type": "address" }, + { "internalType": "bool", "name": "_stable", "type": "bool" } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "lastObservation", + "outputs": [ + { + "components": [ + { "internalType": "uint256", "name": "timestamp", "type": "uint256" }, + { "internalType": "uint256", "name": "reserve0Cumulative", "type": "uint256" }, + { "internalType": "uint256", "name": "reserve1Cumulative", "type": "uint256" } + ], + "internalType": "struct Pool.Observation", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "metadata", + "outputs": [ + { "internalType": "uint256", "name": "dec0", "type": "uint256" }, + { "internalType": "uint256", "name": "dec1", "type": "uint256" }, + { "internalType": "uint256", "name": "r0", "type": "uint256" }, + { "internalType": "uint256", "name": "r1", "type": "uint256" }, + { "internalType": "bool", "name": "st", "type": "bool" }, + { "internalType": "address", "name": "t0", "type": "address" }, + { "internalType": "address", "name": "t1", "type": "address" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], + "name": "mint", + "outputs": [{ "internalType": "uint256", "name": "liquidity", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }], + "name": "nonces", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "observationLength", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "name": "observations", + "outputs": [ + { "internalType": "uint256", "name": "timestamp", "type": "uint256" }, + { "internalType": "uint256", "name": "reserve0Cumulative", "type": "uint256" }, + { "internalType": "uint256", "name": "reserve1Cumulative", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" }, + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "value", "type": "uint256" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "name": "permit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "poolFees", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "tokenIn", "type": "address" }, + { "internalType": "uint256", "name": "amountIn", "type": "uint256" }, + { "internalType": "uint256", "name": "points", "type": "uint256" } + ], + "name": "prices", + "outputs": [{ "internalType": "uint256[]", "name": "", "type": "uint256[]" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "tokenIn", "type": "address" }, + { "internalType": "uint256", "name": "amountIn", "type": "uint256" }, + { "internalType": "uint256", "name": "granularity", "type": "uint256" } + ], + "name": "quote", + "outputs": [{ "internalType": "uint256", "name": "amountOut", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "reserve0", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "reserve0CumulativeLast", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "reserve1", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "reserve1CumulativeLast", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "tokenIn", "type": "address" }, + { "internalType": "uint256", "name": "amountIn", "type": "uint256" }, + { "internalType": "uint256", "name": "points", "type": "uint256" }, + { "internalType": "uint256", "name": "window", "type": "uint256" } + ], + "name": "sample", + "outputs": [{ "internalType": "uint256[]", "name": "", "type": "uint256[]" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "string", "name": "__name", "type": "string" }], + "name": "setName", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "string", "name": "__symbol", "type": "string" }], + "name": "setSymbol", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], + "name": "skim", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "stable", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "supplyIndex0", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "supplyIndex1", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "amount0Out", "type": "uint256" }, + { "internalType": "uint256", "name": "amount1Out", "type": "uint256" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "bytes", "name": "data", "type": "bytes" } + ], + "name": "swap", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "stateMutability": "view", + "type": "function" + }, + { "inputs": [], "name": "sync", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [], + "name": "token0", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "token1", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "tokens", + "outputs": [ + { "internalType": "address", "name": "", "type": "address" }, + { "internalType": "address", "name": "", "type": "address" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transfer", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "from", "type": "address" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "transferFrom", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + } + ] +} diff --git a/deployments/optimism/PriceFeedEXA.json b/deployments/optimism/PriceFeedEXA.json new file mode 100644 index 000000000..e1fcb2815 --- /dev/null +++ b/deployments/optimism/PriceFeedEXA.json @@ -0,0 +1,183 @@ +{ + "address": "0x5fE09baAa75fd107a8dF8565813f66b3603a13D3", + "abi": [ + { + "inputs": [ + { + "internalType": "contract IPool", + "name": "pool_", + "type": "address" + }, + { + "internalType": "contract IPriceFeed", + "name": "basePriceFeed_", + "type": "address" + }, + { + "internalType": "bool", + "name": "token1Based_", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "basePriceFeed", + "outputs": [ + { + "internalType": "contract IPriceFeed", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "baseUnit0", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "baseUnit1", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "latestAnswer", + "outputs": [ + { + "internalType": "int256", + "name": "", + "type": "int256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pool", + "outputs": [ + { + "internalType": "contract IPool", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "token1Based", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0xde95f0c798455911179e22c24f637d58f90f50bddc9a7ec35d03242ca92a7a01", + "receipt": { + "to": null, + "from": "0xe61Bdef3FFF4C3CF7A07996DCB8802b5C85B665a", + "contractAddress": "0x5fE09baAa75fd107a8dF8565813f66b3603a13D3", + "transactionIndex": 5, + "gasUsed": "362515", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x63e09ee35eceb7a2f2df3c18aea43400b1a7b64789e3b1739b4d110519cb59e2", + "transactionHash": "0xde95f0c798455911179e22c24f637d58f90f50bddc9a7ec35d03242ca92a7a01", + "logs": [], + "blockNumber": 107256222, + "cumulativeGasUsed": "1178521", + "status": 1, + "byzantium": true + }, + "args": [ + "0xf3C45b45223Df6071a478851B9C17e0630fDf535", + "0x13e3Ee699D1909E989722E753853AE30b17e08c5", + true + ], + "numDeployments": 1, + "solcInputHash": "120b0733f5d03531b1e1b849c000e48c", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IPool\",\"name\":\"pool_\",\"type\":\"address\"},{\"internalType\":\"contract IPriceFeed\",\"name\":\"basePriceFeed_\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"token1Based_\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"basePriceFeed\",\"outputs\":[{\"internalType\":\"contract IPriceFeed\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"baseUnit0\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"baseUnit1\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestAnswer\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"\",\"type\":\"int256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pool\",\"outputs\":[{\"internalType\":\"contract IPool\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"token1Based\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"latestAnswer()\":{\"details\":\"Value should only be used for display purposes since pool reserves can be easily manipulated.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"basePriceFeed()\":{\"notice\":\"Base price feed where the price is fetched from.\"},\"baseUnit0()\":{\"notice\":\"Base unit of pool's token0.\"},\"baseUnit1()\":{\"notice\":\"Base unit of pool's token1.\"},\"decimals()\":{\"notice\":\"Number of decimals that the answer of this price feed has.\"},\"latestAnswer()\":{\"notice\":\"Returns the price feed's latest value considering the pool's reserves (exchange rate).\"},\"pool()\":{\"notice\":\"Pool where the exchange rate is fetched from.\"},\"token1Based()\":{\"notice\":\"Whether the pool's token1 is the base price feed's asset.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/PriceFeedPool.sol\":\"PriceFeedPool\"},\"debug\":{\"revertStrings\":\"strip\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"contracts/PriceFeedPool.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity 0.8.17;\\n\\nimport { ERC20 } from \\\"solmate/src/tokens/ERC20.sol\\\";\\nimport { FixedPointMathLib } from \\\"solmate/src/utils/FixedPointMathLib.sol\\\";\\nimport { IPriceFeed } from \\\"./utils/IPriceFeed.sol\\\";\\n\\ncontract PriceFeedPool is IPriceFeed {\\n using FixedPointMathLib for uint256;\\n\\n /// @notice Base price feed where the price is fetched from.\\n IPriceFeed public immutable basePriceFeed;\\n /// @notice Base unit of pool's token0.\\n uint256 public immutable baseUnit0;\\n /// @notice Base unit of pool's token1.\\n uint256 public immutable baseUnit1;\\n /// @notice Number of decimals that the answer of this price feed has.\\n uint8 public immutable decimals;\\n /// @notice Whether the pool's token1 is the base price feed's asset.\\n bool public immutable token1Based;\\n /// @notice Pool where the exchange rate is fetched from.\\n IPool public immutable pool;\\n\\n constructor(IPool pool_, IPriceFeed basePriceFeed_, bool token1Based_) {\\n pool = pool_;\\n token1Based = token1Based_;\\n basePriceFeed = basePriceFeed_;\\n decimals = basePriceFeed_.decimals();\\n baseUnit0 = 10 ** pool_.token0().decimals();\\n baseUnit1 = 10 ** pool_.token1().decimals();\\n }\\n\\n /// @notice Returns the price feed's latest value considering the pool's reserves (exchange rate).\\n /// @dev Value should only be used for display purposes since pool reserves can be easily manipulated.\\n function latestAnswer() external view returns (int256) {\\n int256 mainPrice = basePriceFeed.latestAnswer();\\n (uint256 reserve0, uint256 reserve1, ) = pool.getReserves();\\n return\\n int256(\\n token1Based\\n ? uint256(mainPrice).mulDivDown((reserve1 * baseUnit0) / reserve0, baseUnit1)\\n : uint256(mainPrice).mulDivDown((reserve0 * baseUnit1) / reserve1, baseUnit0)\\n );\\n }\\n}\\n\\ninterface IPool {\\n function token0() external view returns (ERC20);\\n\\n function token1() external view returns (ERC20);\\n\\n function getReserves() external view returns (uint256 reserve0, uint256 reserve1, uint256 blockTimestampLast);\\n}\\n\",\"keccak256\":\"0x65d62b2cb7d963cf8fd9f6940e11b69c64a84e3af54e8fd3586c7429538748c3\",\"license\":\"BUSL-1.1\"},\"contracts/utils/IPriceFeed.sol\":{\"content\":\"// SPDX-License-Identifier: BUSL-1.1\\npragma solidity 0.8.17;\\n\\ninterface IPriceFeed {\\n function decimals() external view returns (uint8);\\n\\n function latestAnswer() external view returns (int256);\\n}\\n\",\"keccak256\":\"0xce1b3c2ebe700449e2e3c7637ffaf85e574eed3f79925feee22426b2c43fc667\",\"license\":\"BUSL-1.1\"},\"solmate/src/tokens/ERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.0;\\n\\n/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation.\\n/// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC20.sol)\\n/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol)\\n/// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it.\\nabstract contract ERC20 {\\n /*//////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////*/\\n\\n event Transfer(address indexed from, address indexed to, uint256 amount);\\n\\n event Approval(address indexed owner, address indexed spender, uint256 amount);\\n\\n /*//////////////////////////////////////////////////////////////\\n METADATA STORAGE\\n //////////////////////////////////////////////////////////////*/\\n\\n string public name;\\n\\n string public symbol;\\n\\n uint8 public immutable decimals;\\n\\n /*//////////////////////////////////////////////////////////////\\n ERC20 STORAGE\\n //////////////////////////////////////////////////////////////*/\\n\\n uint256 public totalSupply;\\n\\n mapping(address => uint256) public balanceOf;\\n\\n mapping(address => mapping(address => uint256)) public allowance;\\n\\n /*//////////////////////////////////////////////////////////////\\n EIP-2612 STORAGE\\n //////////////////////////////////////////////////////////////*/\\n\\n uint256 internal immutable INITIAL_CHAIN_ID;\\n\\n bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR;\\n\\n mapping(address => uint256) public nonces;\\n\\n /*//////////////////////////////////////////////////////////////\\n CONSTRUCTOR\\n //////////////////////////////////////////////////////////////*/\\n\\n constructor(\\n string memory _name,\\n string memory _symbol,\\n uint8 _decimals\\n ) {\\n name = _name;\\n symbol = _symbol;\\n decimals = _decimals;\\n\\n INITIAL_CHAIN_ID = block.chainid;\\n INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator();\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n ERC20 LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n function approve(address spender, uint256 amount) public virtual returns (bool) {\\n allowance[msg.sender][spender] = amount;\\n\\n emit Approval(msg.sender, spender, amount);\\n\\n return true;\\n }\\n\\n function transfer(address to, uint256 amount) public virtual returns (bool) {\\n balanceOf[msg.sender] -= amount;\\n\\n // Cannot overflow because the sum of all user\\n // balances can't exceed the max uint256 value.\\n unchecked {\\n balanceOf[to] += amount;\\n }\\n\\n emit Transfer(msg.sender, to, amount);\\n\\n return true;\\n }\\n\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) public virtual returns (bool) {\\n uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals.\\n\\n if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount;\\n\\n balanceOf[from] -= amount;\\n\\n // Cannot overflow because the sum of all user\\n // balances can't exceed the max uint256 value.\\n unchecked {\\n balanceOf[to] += amount;\\n }\\n\\n emit Transfer(from, to, amount);\\n\\n return true;\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n EIP-2612 LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) public virtual {\\n require(deadline >= block.timestamp, \\\"PERMIT_DEADLINE_EXPIRED\\\");\\n\\n // Unchecked because the only math done is incrementing\\n // the owner's nonce which cannot realistically overflow.\\n unchecked {\\n address recoveredAddress = ecrecover(\\n keccak256(\\n abi.encodePacked(\\n \\\"\\\\x19\\\\x01\\\",\\n DOMAIN_SEPARATOR(),\\n keccak256(\\n abi.encode(\\n keccak256(\\n \\\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\\\"\\n ),\\n owner,\\n spender,\\n value,\\n nonces[owner]++,\\n deadline\\n )\\n )\\n )\\n ),\\n v,\\n r,\\n s\\n );\\n\\n require(recoveredAddress != address(0) && recoveredAddress == owner, \\\"INVALID_SIGNER\\\");\\n\\n allowance[recoveredAddress][spender] = value;\\n }\\n\\n emit Approval(owner, spender, value);\\n }\\n\\n function DOMAIN_SEPARATOR() public view virtual returns (bytes32) {\\n return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator();\\n }\\n\\n function computeDomainSeparator() internal view virtual returns (bytes32) {\\n return\\n keccak256(\\n abi.encode(\\n keccak256(\\\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\\\"),\\n keccak256(bytes(name)),\\n keccak256(\\\"1\\\"),\\n block.chainid,\\n address(this)\\n )\\n );\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n INTERNAL MINT/BURN LOGIC\\n //////////////////////////////////////////////////////////////*/\\n\\n function _mint(address to, uint256 amount) internal virtual {\\n totalSupply += amount;\\n\\n // Cannot overflow because the sum of all user\\n // balances can't exceed the max uint256 value.\\n unchecked {\\n balanceOf[to] += amount;\\n }\\n\\n emit Transfer(address(0), to, amount);\\n }\\n\\n function _burn(address from, uint256 amount) internal virtual {\\n balanceOf[from] -= amount;\\n\\n // Cannot underflow because a user's balance\\n // will never be larger than the total supply.\\n unchecked {\\n totalSupply -= amount;\\n }\\n\\n emit Transfer(from, address(0), amount);\\n }\\n}\\n\",\"keccak256\":\"0x43aa1509bb753f053143530705d9c4eee415691d26a4779769bf028a74e6ac69\",\"license\":\"MIT\"},\"solmate/src/utils/FixedPointMathLib.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.0;\\n\\n/// @notice Arithmetic library with operations for fixed-point numbers.\\n/// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/utils/FixedPointMathLib.sol)\\nlibrary FixedPointMathLib {\\n /*//////////////////////////////////////////////////////////////\\n SIMPLIFIED FIXED POINT OPERATIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n uint256 internal constant WAD = 1e18; // The scalar of ETH and most ERC20s.\\n\\n function mulWadDown(uint256 x, uint256 y) internal pure returns (uint256) {\\n return mulDivDown(x, y, WAD); // Equivalent to (x * y) / WAD rounded down.\\n }\\n\\n function mulWadUp(uint256 x, uint256 y) internal pure returns (uint256) {\\n return mulDivUp(x, y, WAD); // Equivalent to (x * y) / WAD rounded up.\\n }\\n\\n function divWadDown(uint256 x, uint256 y) internal pure returns (uint256) {\\n return mulDivDown(x, WAD, y); // Equivalent to (x * WAD) / y rounded down.\\n }\\n\\n function divWadUp(uint256 x, uint256 y) internal pure returns (uint256) {\\n return mulDivUp(x, WAD, y); // Equivalent to (x * WAD) / y rounded up.\\n }\\n\\n function powWad(int256 x, int256 y) internal pure returns (int256) {\\n // Equivalent to x to the power of y because x ** y = (e ** ln(x)) ** y = e ** (ln(x) * y)\\n return expWad((lnWad(x) * y) / int256(WAD)); // Using ln(x) means x must be greater than 0.\\n }\\n\\n function expWad(int256 x) internal pure returns (int256 r) {\\n unchecked {\\n // When the result is < 0.5 we return zero. This happens when\\n // x <= floor(log(0.5e18) * 1e18) ~ -42e18\\n if (x <= -42139678854452767551) return 0;\\n\\n // When the result is > (2**255 - 1) / 1e18 we can not represent it as an\\n // int. This happens when x >= floor(log((2**255 - 1) / 1e18) * 1e18) ~ 135.\\n if (x >= 135305999368893231589) revert(\\\"EXP_OVERFLOW\\\");\\n\\n // x is now in the range (-42, 136) * 1e18. Convert to (-42, 136) * 2**96\\n // for more intermediate precision and a binary basis. This base conversion\\n // is a multiplication by 1e18 / 2**96 = 5**18 / 2**78.\\n x = (x << 78) / 5**18;\\n\\n // Reduce range of x to (-\\u00bd ln 2, \\u00bd ln 2) * 2**96 by factoring out powers\\n // of two such that exp(x) = exp(x') * 2**k, where k is an integer.\\n // Solving this gives k = round(x / log(2)) and x' = x - k * log(2).\\n int256 k = ((x << 96) / 54916777467707473351141471128 + 2**95) >> 96;\\n x = x - k * 54916777467707473351141471128;\\n\\n // k is in the range [-61, 195].\\n\\n // Evaluate using a (6, 7)-term rational approximation.\\n // p is made monic, we'll multiply by a scale factor later.\\n int256 y = x + 1346386616545796478920950773328;\\n y = ((y * x) >> 96) + 57155421227552351082224309758442;\\n int256 p = y + x - 94201549194550492254356042504812;\\n p = ((p * y) >> 96) + 28719021644029726153956944680412240;\\n p = p * x + (4385272521454847904659076985693276 << 96);\\n\\n // We leave p in 2**192 basis so we don't need to scale it back up for the division.\\n int256 q = x - 2855989394907223263936484059900;\\n q = ((q * x) >> 96) + 50020603652535783019961831881945;\\n q = ((q * x) >> 96) - 533845033583426703283633433725380;\\n q = ((q * x) >> 96) + 3604857256930695427073651918091429;\\n q = ((q * x) >> 96) - 14423608567350463180887372962807573;\\n q = ((q * x) >> 96) + 26449188498355588339934803723976023;\\n\\n assembly {\\n // Div in assembly because solidity adds a zero check despite the unchecked.\\n // The q polynomial won't have zeros in the domain as all its roots are complex.\\n // No scaling is necessary because p is already 2**96 too large.\\n r := sdiv(p, q)\\n }\\n\\n // r should be in the range (0.09, 0.25) * 2**96.\\n\\n // We now need to multiply r by:\\n // * the scale factor s = ~6.031367120.\\n // * the 2**k factor from the range reduction.\\n // * the 1e18 / 2**96 factor for base conversion.\\n // We do this all at once, with an intermediate result in 2**213\\n // basis, so the final right shift is always by a positive amount.\\n r = int256((uint256(r) * 3822833074963236453042738258902158003155416615667) >> uint256(195 - k));\\n }\\n }\\n\\n function lnWad(int256 x) internal pure returns (int256 r) {\\n unchecked {\\n require(x > 0, \\\"UNDEFINED\\\");\\n\\n // We want to convert x from 10**18 fixed point to 2**96 fixed point.\\n // We do this by multiplying by 2**96 / 10**18. But since\\n // ln(x * C) = ln(x) + ln(C), we can simply do nothing here\\n // and add ln(2**96 / 10**18) at the end.\\n\\n // Reduce range of x to (1, 2) * 2**96\\n // ln(2^k * x) = k * ln(2) + ln(x)\\n int256 k = int256(log2(uint256(x))) - 96;\\n x <<= uint256(159 - k);\\n x = int256(uint256(x) >> 159);\\n\\n // Evaluate using a (8, 8)-term rational approximation.\\n // p is made monic, we will multiply by a scale factor later.\\n int256 p = x + 3273285459638523848632254066296;\\n p = ((p * x) >> 96) + 24828157081833163892658089445524;\\n p = ((p * x) >> 96) + 43456485725739037958740375743393;\\n p = ((p * x) >> 96) - 11111509109440967052023855526967;\\n p = ((p * x) >> 96) - 45023709667254063763336534515857;\\n p = ((p * x) >> 96) - 14706773417378608786704636184526;\\n p = p * x - (795164235651350426258249787498 << 96);\\n\\n // We leave p in 2**192 basis so we don't need to scale it back up for the division.\\n // q is monic by convention.\\n int256 q = x + 5573035233440673466300451813936;\\n q = ((q * x) >> 96) + 71694874799317883764090561454958;\\n q = ((q * x) >> 96) + 283447036172924575727196451306956;\\n q = ((q * x) >> 96) + 401686690394027663651624208769553;\\n q = ((q * x) >> 96) + 204048457590392012362485061816622;\\n q = ((q * x) >> 96) + 31853899698501571402653359427138;\\n q = ((q * x) >> 96) + 909429971244387300277376558375;\\n assembly {\\n // Div in assembly because solidity adds a zero check despite the unchecked.\\n // The q polynomial is known not to have zeros in the domain.\\n // No scaling required because p is already 2**96 too large.\\n r := sdiv(p, q)\\n }\\n\\n // r is in the range (0, 0.125) * 2**96\\n\\n // Finalization, we need to:\\n // * multiply by the scale factor s = 5.549\\u2026\\n // * add ln(2**96 / 10**18)\\n // * add k * ln(2)\\n // * multiply by 10**18 / 2**96 = 5**18 >> 78\\n\\n // mul s * 5e18 * 2**96, base is now 5**18 * 2**192\\n r *= 1677202110996718588342820967067443963516166;\\n // add ln(2) * k * 5e18 * 2**192\\n r += 16597577552685614221487285958193947469193820559219878177908093499208371 * k;\\n // add ln(2**96 / 10**18) * 5e18 * 2**192\\n r += 600920179829731861736702779321621459595472258049074101567377883020018308;\\n // base conversion: mul 2**18 / 2**192\\n r >>= 174;\\n }\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n LOW LEVEL FIXED POINT OPERATIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function mulDivDown(\\n uint256 x,\\n uint256 y,\\n uint256 denominator\\n ) internal pure returns (uint256 z) {\\n assembly {\\n // Store x * y in z for now.\\n z := mul(x, y)\\n\\n // Equivalent to require(denominator != 0 && (x == 0 || (x * y) / x == y))\\n if iszero(and(iszero(iszero(denominator)), or(iszero(x), eq(div(z, x), y)))) {\\n revert(0, 0)\\n }\\n\\n // Divide z by the denominator.\\n z := div(z, denominator)\\n }\\n }\\n\\n function mulDivUp(\\n uint256 x,\\n uint256 y,\\n uint256 denominator\\n ) internal pure returns (uint256 z) {\\n assembly {\\n // Store x * y in z for now.\\n z := mul(x, y)\\n\\n // Equivalent to require(denominator != 0 && (x == 0 || (x * y) / x == y))\\n if iszero(and(iszero(iszero(denominator)), or(iszero(x), eq(div(z, x), y)))) {\\n revert(0, 0)\\n }\\n\\n // First, divide z - 1 by the denominator and add 1.\\n // We allow z - 1 to underflow if z is 0, because we multiply the\\n // end result by 0 if z is zero, ensuring we return 0 if z is zero.\\n z := mul(iszero(iszero(z)), add(div(sub(z, 1), denominator), 1))\\n }\\n }\\n\\n function rpow(\\n uint256 x,\\n uint256 n,\\n uint256 scalar\\n ) internal pure returns (uint256 z) {\\n assembly {\\n switch x\\n case 0 {\\n switch n\\n case 0 {\\n // 0 ** 0 = 1\\n z := scalar\\n }\\n default {\\n // 0 ** n = 0\\n z := 0\\n }\\n }\\n default {\\n switch mod(n, 2)\\n case 0 {\\n // If n is even, store scalar in z for now.\\n z := scalar\\n }\\n default {\\n // If n is odd, store x in z for now.\\n z := x\\n }\\n\\n // Shifting right by 1 is like dividing by 2.\\n let half := shr(1, scalar)\\n\\n for {\\n // Shift n right by 1 before looping to halve it.\\n n := shr(1, n)\\n } n {\\n // Shift n right by 1 each iteration to halve it.\\n n := shr(1, n)\\n } {\\n // Revert immediately if x ** 2 would overflow.\\n // Equivalent to iszero(eq(div(xx, x), x)) here.\\n if shr(128, x) {\\n revert(0, 0)\\n }\\n\\n // Store x squared.\\n let xx := mul(x, x)\\n\\n // Round to the nearest number.\\n let xxRound := add(xx, half)\\n\\n // Revert if xx + half overflowed.\\n if lt(xxRound, xx) {\\n revert(0, 0)\\n }\\n\\n // Set x to scaled xxRound.\\n x := div(xxRound, scalar)\\n\\n // If n is even:\\n if mod(n, 2) {\\n // Compute z * x.\\n let zx := mul(z, x)\\n\\n // If z * x overflowed:\\n if iszero(eq(div(zx, x), z)) {\\n // Revert if x is non-zero.\\n if iszero(iszero(x)) {\\n revert(0, 0)\\n }\\n }\\n\\n // Round to the nearest number.\\n let zxRound := add(zx, half)\\n\\n // Revert if zx + half overflowed.\\n if lt(zxRound, zx) {\\n revert(0, 0)\\n }\\n\\n // Return properly scaled zxRound.\\n z := div(zxRound, scalar)\\n }\\n }\\n }\\n }\\n }\\n\\n /*//////////////////////////////////////////////////////////////\\n GENERAL NUMBER UTILITIES\\n //////////////////////////////////////////////////////////////*/\\n\\n function sqrt(uint256 x) internal pure returns (uint256 z) {\\n assembly {\\n let y := x // We start y at x, which will help us make our initial estimate.\\n\\n z := 181 // The \\\"correct\\\" value is 1, but this saves a multiplication later.\\n\\n // This segment is to get a reasonable initial estimate for the Babylonian method. With a bad\\n // start, the correct # of bits increases ~linearly each iteration instead of ~quadratically.\\n\\n // We check y >= 2^(k + 8) but shift right by k bits\\n // each branch to ensure that if x >= 256, then y >= 256.\\n if iszero(lt(y, 0x10000000000000000000000000000000000)) {\\n y := shr(128, y)\\n z := shl(64, z)\\n }\\n if iszero(lt(y, 0x1000000000000000000)) {\\n y := shr(64, y)\\n z := shl(32, z)\\n }\\n if iszero(lt(y, 0x10000000000)) {\\n y := shr(32, y)\\n z := shl(16, z)\\n }\\n if iszero(lt(y, 0x1000000)) {\\n y := shr(16, y)\\n z := shl(8, z)\\n }\\n\\n // Goal was to get z*z*y within a small factor of x. More iterations could\\n // get y in a tighter range. Currently, we will have y in [256, 256*2^16).\\n // We ensured y >= 256 so that the relative difference between y and y+1 is small.\\n // That's not possible if x < 256 but we can just verify those cases exhaustively.\\n\\n // Now, z*z*y <= x < z*z*(y+1), and y <= 2^(16+8), and either y >= 256, or x < 256.\\n // Correctness can be checked exhaustively for x < 256, so we assume y >= 256.\\n // Then z*sqrt(y) is within sqrt(257)/sqrt(256) of sqrt(x), or about 20bps.\\n\\n // For s in the range [1/256, 256], the estimate f(s) = (181/1024) * (s+1) is in the range\\n // (1/2.84 * sqrt(s), 2.84 * sqrt(s)), with largest error when s = 1 and when s = 256 or 1/256.\\n\\n // Since y is in [256, 256*2^16), let a = y/65536, so that a is in [1/256, 256). Then we can estimate\\n // sqrt(y) using sqrt(65536) * 181/1024 * (a + 1) = 181/4 * (y + 65536)/65536 = 181 * (y + 65536)/2^18.\\n\\n // There is no overflow risk here since y < 2^136 after the first branch above.\\n z := shr(18, mul(z, add(y, 65536))) // A mul() is saved from starting z at 181.\\n\\n // Given the worst case multiplicative error of 2.84 above, 7 iterations should be enough.\\n z := shr(1, add(z, div(x, z)))\\n z := shr(1, add(z, div(x, z)))\\n z := shr(1, add(z, div(x, z)))\\n z := shr(1, add(z, div(x, z)))\\n z := shr(1, add(z, div(x, z)))\\n z := shr(1, add(z, div(x, z)))\\n z := shr(1, add(z, div(x, z)))\\n\\n // If x+1 is a perfect square, the Babylonian method cycles between\\n // floor(sqrt(x)) and ceil(sqrt(x)). This statement ensures we return floor.\\n // See: https://en.wikipedia.org/wiki/Integer_square_root#Using_only_integer_division\\n // Since the ceil is rare, we save gas on the assignment and repeat division in the rare case.\\n // If you don't care whether the floor or ceil square root is returned, you can remove this statement.\\n z := sub(z, lt(div(x, z), z))\\n }\\n }\\n\\n function log2(uint256 x) internal pure returns (uint256 r) {\\n require(x > 0, \\\"UNDEFINED\\\");\\n\\n assembly {\\n r := shl(7, lt(0xffffffffffffffffffffffffffffffff, x))\\n r := or(r, shl(6, lt(0xffffffffffffffff, shr(r, x))))\\n r := or(r, shl(5, lt(0xffffffff, shr(r, x))))\\n r := or(r, shl(4, lt(0xffff, shr(r, x))))\\n r := or(r, shl(3, lt(0xff, shr(r, x))))\\n r := or(r, shl(2, lt(0xf, shr(r, x))))\\n r := or(r, shl(1, lt(0x3, shr(r, x))))\\n r := or(r, lt(0x1, shr(r, x)))\\n }\\n }\\n\\n function unsafeMod(uint256 x, uint256 y) internal pure returns (uint256 z) {\\n assembly {\\n // z will equal 0 if y is 0, unlike in Solidity where it will revert.\\n z := mod(x, y)\\n }\\n }\\n\\n function unsafeDiv(uint256 x, uint256 y) internal pure returns (uint256 z) {\\n assembly {\\n // z will equal 0 if y is 0, unlike in Solidity where it will revert.\\n z := div(x, y)\\n }\\n }\\n\\n /// @dev Will return 0 instead of reverting if y is zero.\\n function unsafeDivUp(uint256 x, uint256 y) internal pure returns (uint256 z) {\\n assembly {\\n // Add 1 to x * y if x % y > 0.\\n z := add(gt(mod(x, y), 0), div(x, y))\\n }\\n }\\n}\\n\",\"keccak256\":\"0x0bf1d4f3999a4471e0fded0a2f67e7fe328e2a27385348571b1fc0a8d9c9f62e\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6101406040523480156200001257600080fd5b50604051620009903803806200099083398101604081905262000035916200029a565b6001600160a01b038084166101205281151561010052821660808190526040805163313ce56760e01b8152905163313ce567916004808201926020929091908290030181865afa1580156200008e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000b49190620002f2565b60ff1660e08160ff1681525050826001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000100573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200012691906200031e565b6001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000164573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200018a9190620002f2565b6200019790600a62000453565b60a08181525050826001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015620001dd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200020391906200031e565b6001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000241573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002679190620002f2565b6200027490600a62000453565b60c0525062000464915050565b6001600160a01b03811681146200029757600080fd5b50565b600080600060608486031215620002b057600080fd5b8351620002bd8162000281565b6020850151909350620002d08162000281565b60408501519092508015158114620002e757600080fd5b809150509250925092565b6000602082840312156200030557600080fd5b815160ff811681146200031757600080fd5b9392505050565b6000602082840312156200033157600080fd5b8151620003178162000281565b634e487b7160e01b600052601160045260246000fd5b600181815b80851115620003955781600019048211156200037957620003796200033e565b808516156200038757918102915b93841c939080029062000359565b509250929050565b600082620003ae575060016200044d565b81620003bd575060006200044d565b8160018114620003d65760028114620003e15762000401565b60019150506200044d565b60ff841115620003f557620003f56200033e565b50506001821b6200044d565b5060208310610133831016604e8410600b841016171562000426575081810a6200044d565b62000432838362000354565b80600019048211156200044957620004496200033e565b0290505b92915050565b60006200031760ff8416836200039d565b60805160a05160c05160e05161010051610120516104ad620004e3600039600081816087015261024d01526000818161016801526102d40152600060cb01526000818161014101528181610300015261039801526000818161011a01528181610333015261036501526000818161019f01526101c601526104ad6000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c806399b85f5d1161005b57806399b85f5d14610115578063d8f9c10c1461013c578063dedb52cc14610163578063e41e75121461019a57600080fd5b806316f0115b14610082578063313ce567146100c657806350d25bcd146100ff575b600080fd5b6100a97f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b6100ed7f000000000000000000000000000000000000000000000000000000000000000081565b60405160ff90911681526020016100bd565b6101076101c1565b6040519081526020016100bd565b6101077f000000000000000000000000000000000000000000000000000000000000000081565b6101077f000000000000000000000000000000000000000000000000000000000000000081565b61018a7f000000000000000000000000000000000000000000000000000000000000000081565b60405190151581526020016100bd565b6100a97f000000000000000000000000000000000000000000000000000000000000000081565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166350d25bcd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610222573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061024691906103e3565b90506000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa1580156102a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102cd91906103fc565b50915091507f000000000000000000000000000000000000000000000000000000000000000061035c57610357816103257f00000000000000000000000000000000000000000000000000000000000000008561042a565b61032f9190610455565b84907f00000000000000000000000000000000000000000000000000000000000000006103c4565b6103bc565b6103bc8261038a7f00000000000000000000000000000000000000000000000000000000000000008461042a565b6103949190610455565b84907f00000000000000000000000000000000000000000000000000000000000000006103c4565b935050505090565b8282028115158415858304851417166103dc57600080fd5b0492915050565b6000602082840312156103f557600080fd5b5051919050565b60008060006060848603121561041157600080fd5b8351925060208401519150604084015190509250925092565b808202811582820484141761044f57634e487b7160e01b600052601160045260246000fd5b92915050565b60008261047257634e487b7160e01b600052601260045260246000fd5b50049056fea26469706673582212202f73ccba9db8c8f29b2d65bd997b9d648491892baaeabaa4a3c8305b256605d864736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061007d5760003560e01c806399b85f5d1161005b57806399b85f5d14610115578063d8f9c10c1461013c578063dedb52cc14610163578063e41e75121461019a57600080fd5b806316f0115b14610082578063313ce567146100c657806350d25bcd146100ff575b600080fd5b6100a97f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b6100ed7f000000000000000000000000000000000000000000000000000000000000000081565b60405160ff90911681526020016100bd565b6101076101c1565b6040519081526020016100bd565b6101077f000000000000000000000000000000000000000000000000000000000000000081565b6101077f000000000000000000000000000000000000000000000000000000000000000081565b61018a7f000000000000000000000000000000000000000000000000000000000000000081565b60405190151581526020016100bd565b6100a97f000000000000000000000000000000000000000000000000000000000000000081565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166350d25bcd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610222573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061024691906103e3565b90506000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa1580156102a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102cd91906103fc565b50915091507f000000000000000000000000000000000000000000000000000000000000000061035c57610357816103257f00000000000000000000000000000000000000000000000000000000000000008561042a565b61032f9190610455565b84907f00000000000000000000000000000000000000000000000000000000000000006103c4565b6103bc565b6103bc8261038a7f00000000000000000000000000000000000000000000000000000000000000008461042a565b6103949190610455565b84907f00000000000000000000000000000000000000000000000000000000000000006103c4565b935050505090565b8282028115158415858304851417166103dc57600080fd5b0492915050565b6000602082840312156103f557600080fd5b5051919050565b60008060006060848603121561041157600080fd5b8351925060208401519150604084015190509250925092565b808202811582820484141761044f57634e487b7160e01b600052601160045260246000fd5b92915050565b60008261047257634e487b7160e01b600052601260045260246000fd5b50049056fea26469706673582212202f73ccba9db8c8f29b2d65bd997b9d648491892baaeabaa4a3c8305b256605d864736f6c63430008110033", + "devdoc": { + "kind": "dev", + "methods": { + "latestAnswer()": { + "details": "Value should only be used for display purposes since pool reserves can be easily manipulated." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "basePriceFeed()": { + "notice": "Base price feed where the price is fetched from." + }, + "baseUnit0()": { + "notice": "Base unit of pool's token0." + }, + "baseUnit1()": { + "notice": "Base unit of pool's token1." + }, + "decimals()": { + "notice": "Number of decimals that the answer of this price feed has." + }, + "latestAnswer()": { + "notice": "Returns the price feed's latest value considering the pool's reserves (exchange rate)." + }, + "pool()": { + "notice": "Pool where the exchange rate is fetched from." + }, + "token1Based()": { + "notice": "Whether the pool's token1 is the base price feed's asset." + } + }, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file