From c7e65a3088810a7c8f8d6aee44384e04fbfaa222 Mon Sep 17 00:00:00 2001 From: Akshat Mittal Date: Wed, 25 Oct 2023 22:00:56 +0530 Subject: [PATCH] Remove Forknet Stuff (#992) --- contracts/forknet/ForkedOracle.sol | 52 -------------------------- hardhat.config.ts | 3 -- scripts/replaceOracles.ts | 60 ------------------------------ 3 files changed, 115 deletions(-) delete mode 100644 contracts/forknet/ForkedOracle.sol delete mode 100644 scripts/replaceOracles.ts diff --git a/contracts/forknet/ForkedOracle.sol b/contracts/forknet/ForkedOracle.sol deleted file mode 100644 index cb0f4b0d99..0000000000 --- a/contracts/forknet/ForkedOracle.sol +++ /dev/null @@ -1,52 +0,0 @@ -// SPDX-License-Identifier: BlueOak-1.0.0 -pragma solidity 0.8.19; - -interface AggregatorV3MixedInterface { - function decimals() external view returns (uint8); - - function description() external view returns (string memory); - - function latestRoundData() - external - view - returns ( - uint80 roundId, - int256 answer, - uint256 startedAt, - uint256 updatedAt, - uint80 answeredInRound - ); - - function aggregator() external view returns (address); -} - -contract ForkedOracle is AggregatorV3MixedInterface { - address public constant aggregator = address(0x1); - string public constant description = "FORKED"; - - uint8 public decimals; - int256 private answerInternal; - - function setData(uint8 _decimals, int256 _answer) external { - decimals = _decimals; - answerInternal = _answer; - } - - function latestRoundData() - external - view - returns ( - uint80 roundId, - int256 answer, - uint256 startedAt, - uint256 updatedAt, - uint80 answeredInRound - ) - { - roundId = 1; - answer = answerInternal; - startedAt = 0; - updatedAt = block.timestamp - 1; - answeredInRound = 1; - } -} diff --git a/hardhat.config.ts b/hardhat.config.ts index 9dddd006bf..d4c23bc1b9 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -54,9 +54,6 @@ const config: HardhatUserConfig = { blockGasLimit: 0x1fffffffffffff, allowUnlimitedContractSize: true, }, - // anvil: { - // url: 'http://127.0.0.1:8545/', - // }, goerli: { chainId: 5, url: GOERLI_RPC_URL, diff --git a/scripts/replaceOracles.ts b/scripts/replaceOracles.ts deleted file mode 100644 index e9a72a8225..0000000000 --- a/scripts/replaceOracles.ts +++ /dev/null @@ -1,60 +0,0 @@ -import hre, { ethers } from 'hardhat' - -const supportedNodes = ['anvil', 'hardhat'] -const oracleList = [ - '0x759bbc1be8f90ee6457c44abc7d443842a976d02', - '0xAed0c38402a5d19df6E4c03F4E2DceD6e29c1ee9', - '0x8fFfFfd4AfB6115b954Bd326cbe7B4BA576818f6', - '0x3E7d1eAB13ad0104d2750B8863b489D65364e32D', - '0x833D8Eb16D306ed1FbB5D7A2E019e106B960965A', - '0x09023c0DA49Aaf8fc3fA3ADF34C6A7016D38D5e3', - '0xec746eCF986E2927Abd291a2A1716c940100f8Ba', - '0xad35Bd71b9aFE6e4bDc266B345c198eaDEf9Ad94', - '0xB9E1E3A9feFf48998E45Fa90847ed4D467E8BcfD', - '0x7A364e8770418566e3eb2001A96116E6138Eb32F', - '0x5f4ec3df9cbd43714fe2740f5e3616155c5b8419', - '0xF4030086522a5bEEa4988F8cA5B36dbC97BeE88c', - '0x01D391A48f4F7339aC64CA2c83a07C22F95F587a', - '0xb49f677943BC038e9857d61E7d053CaA2C1734C1', - '0x86392dc19c0b719886221c78ab11eb8cf5c52812', - '0xCfE54B5cD566aB89272946F602D76Ea879CAb4a8', - '0x536218f9E9Eb48863970252233c8F271f554C2d0', - '0xf017fcb346a1885194689ba23eff2fe6fa5c483b', - '0xfdFD9C85aD200c506Cf9e21F1FD8dd01932FBB23', -] - -async function main() { - const clientVersion = await hre.ethers.provider.send('web3_clientVersion', []) - const isSupported = supportedNodes.some((node) => clientVersion.toLowerCase().includes(node)) - console.log({ clientVersion, isSupported }) - - if (!isSupported) { - throw Error('Unsupported Network') - } - - const forkedOracleArtifact = await hre.artifacts.readArtifact('ForkedOracle') - - for (const oracleAddress of oracleList) { - const oracle = await hre.ethers.getContractAt('ForkedOracle', oracleAddress) - - const description = await oracle.description() - const decimals = await oracle.decimals() - const roundData = await oracle.latestRoundData() - - console.log(`-------- Updating ${description} (${oracle.address}) Oracle...`) - console.log(`>>>> Current Answer:`, ethers.utils.formatUnits(roundData.answer, decimals)) - - console.log('>>>> Updating code...') - await hre.ethers.provider.send('hardhat_setCode', [ - oracle.address, - forkedOracleArtifact.deployedBytecode, - ]) - console.log('>>>> Updating data...') - await oracle.setData(decimals, roundData.answer, { - gasLimit: 10_000_000, - }) - console.log('>>>> Done!') - } -} - -main().catch((e) => console.error(e))