From f7414975bf5d4ede52ded17823c6737a16c980b1 Mon Sep 17 00:00:00 2001 From: Cheng JIANG Date: Fri, 5 Jan 2024 16:28:20 +0800 Subject: [PATCH] feat: add sepolia & arbitrum sepolia (#430) * feat: add sepolia & arbitrun sepolia Signed-off-by: GopherJ * chore: support batch Signed-off-by: GopherJ * feat: add set-timelock-strategy Signed-off-by: GopherJ * chore: add parax dev Signed-off-by: GopherJ * chore: add missing info Signed-off-by: GopherJ * chore: fix parax dev deployment Signed-off-by: GopherJ * chore: display more contracts' size Signed-off-by: GopherJ * chore: allow no entrypoint Signed-off-by: GopherJ * chore: aUSDC * chore: update parax dev urls Signed-off-by: GopherJ * feat: add neon & parallel Signed-off-by: GopherJ * fix: parax dev Signed-off-by: GopherJ * fix: config Signed-off-by: GopherJ --------- Signed-off-by: GopherJ Co-authored-by: zhoujia6139 --- .husky/pre-push | 6 - Makefile | 8 +- hardhat.config.ts | 74 ++++--- helper-hardhat-config.ts | 30 ++- helpers/contracts-deployments.ts | 5 +- helpers/hardhat-constants.ts | 39 +++- helpers/init-helpers.ts | 3 +- helpers/misc-utils.ts | 31 ++- helpers/types.ts | 12 +- market-config/index.ts | 85 +++++++- market-config/mocks.ts | 2 + market-config/rateStrategies.ts | 8 + market-config/reservesConfigs.ts | 18 ++ market-config/timeLockStrategies.ts | 12 ++ package.json | 8 +- .../deployments/steps/10_allAggregators.ts | 10 +- .../steps/24_accountAbstraction.ts | 13 +- scripts/upgrade/accountAbstraction.ts | 10 +- scripts/upgrade/ntoken.ts | 6 +- tasks/dev/reserveConfigurator.ts | 182 +++++++++++------- yarn.lock | 53 ++--- 21 files changed, 458 insertions(+), 157 deletions(-) delete mode 100755 .husky/pre-push diff --git a/.husky/pre-push b/.husky/pre-push deleted file mode 100755 index 4779cffc9..000000000 --- a/.husky/pre-push +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env sh -. "$(dirname -- "$0")/_/husky.sh" - -yarn typechain -yarn lint -yarn size diff --git a/Makefile b/Makefile index 857afca13..b498f34b7 100644 --- a/Makefile +++ b/Makefile @@ -448,8 +448,8 @@ send-eth: set-traits-multipliers: make SCRIPT_PATH=./scripts/dev/11.set-traits-multipliers.ts run -.PHONY: set-timelock-strategy -set-timelock-strategy: +.PHONY: update-timelock-strategy +update-timelock-strategy: make SCRIPT_PATH=./scripts/dev/12.set-timelock-strategy.ts run .PHONY: acl @@ -576,6 +576,10 @@ set-interest-rate-strategy: set-auction-strategy: make TASK_NAME=set-auction-strategy run-task +.PHONY: set-timelock-strategy +set-timelock-strategy: + make TASK_NAME=set-timelock-strategy run-task + .PHONY: set-supply-cap set-supply-cap: make TASK_NAME=set-supply-cap run-task diff --git a/hardhat.config.ts b/hardhat.config.ts index 55eb6d5e8..310611deb 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -27,9 +27,13 @@ import { MOONBASE_ETHERSCAN_KEY, LINEA_ETHERSCAN_KEY, LINEA_GOERLI_ETHERSCAN_KEY, + SEPOLIA_ETHERSCAN_KEY, + ARBITRUM_SEPOLIA_ETHERSCAN_KEY, + PARALLEL_DEV_ETHERSCAN_KEY, + NEON_ETHERSCAN_KEY, + PARALLEL_ETHERSCAN_KEY, } from "./helpers/hardhat-constants"; import {accounts} from "./wallets"; -import {accounts as evmAccounts} from "./evm-wallets"; import { buildForkConfig, CHAINS_ID, @@ -74,12 +78,7 @@ const hardhatConfig: HardhatUserConfig = { alphaSort: true, runOnCompile: false, disambiguatePaths: false, - except: [ - "Mock*", - "ApeCoinStaking", - "SwapRouter", - "NonfungiblePositionManager", - ], + except: ["Mock*"], strict: true, }, paths: { @@ -154,13 +153,23 @@ const hardhatConfig: HardhatUserConfig = { allowUnlimitedContractSize: true, timeout: 9000000, }, + hardhat: { + hardfork: HARDFORK, + blockGasLimit: DEFAULT_BLOCK_GAS_LIMIT, + gas: DEFAULT_BLOCK_GAS_LIMIT, + gasPrice: "auto", + chainId: CHAINS_ID[eEthereumNetwork.hardhat], + throwOnTransactionFailures: true, + throwOnCallFailures: true, + accounts, + loggingEnabled: VERBOSE, + forking: buildForkConfig(), + allowUnlimitedContractSize: true, + }, parallel: { url: NETWORKS_RPC_URL[eEthereumNetwork.parallel], chainId: CHAINS_ID[eEthereumNetwork.parallel], - accounts: evmAccounts.map(({privateKey}) => privateKey), - gasPrice: 4e9, - gas: 4e6, - allowUnlimitedContractSize: true, + accounts: DEPLOYER, }, moonbeam: { chainId: CHAINS_ID[eEthereumNetwork.moonbeam], @@ -172,24 +181,16 @@ const hardhatConfig: HardhatUserConfig = { url: NETWORKS_RPC_URL[eEthereumNetwork.moonbase], accounts: DEPLOYER, }, - hardhat: { - hardfork: HARDFORK, - blockGasLimit: DEFAULT_BLOCK_GAS_LIMIT, - gas: DEFAULT_BLOCK_GAS_LIMIT, - gasPrice: "auto", - chainId: CHAINS_ID[eEthereumNetwork.hardhat], - throwOnTransactionFailures: true, - throwOnCallFailures: true, - accounts, - loggingEnabled: VERBOSE, - forking: buildForkConfig(), - allowUnlimitedContractSize: true, - }, goerli: { chainId: CHAINS_ID[eEthereumNetwork.goerli], url: NETWORKS_RPC_URL[eEthereumNetwork.goerli], accounts: DEPLOYER, }, + sepolia: { + chainId: CHAINS_ID[eEthereumNetwork.sepolia], + url: NETWORKS_RPC_URL[eEthereumNetwork.sepolia], + accounts: DEPLOYER, + }, arbitrum: { chainId: CHAINS_ID[eEthereumNetwork.arbitrum], url: NETWORKS_RPC_URL[eEthereumNetwork.arbitrum], @@ -200,6 +201,16 @@ const hardhatConfig: HardhatUserConfig = { url: NETWORKS_RPC_URL[eEthereumNetwork.arbitrumGoerli], accounts: DEPLOYER, }, + arbitrumSepolia: { + chainId: CHAINS_ID[eEthereumNetwork.arbitrumSepolia], + url: NETWORKS_RPC_URL[eEthereumNetwork.arbitrumSepolia], + accounts: DEPLOYER, + }, + parallelDev: { + chainId: CHAINS_ID[eEthereumNetwork.parallelDev], + url: NETWORKS_RPC_URL[eEthereumNetwork.parallelDev], + accounts: DEPLOYER, + }, polygon: { chainId: CHAINS_ID[eEthereumNetwork.polygon], url: NETWORKS_RPC_URL[eEthereumNetwork.polygon], @@ -246,6 +257,11 @@ const hardhatConfig: HardhatUserConfig = { url: NETWORKS_RPC_URL[eEthereumNetwork.lineaGoerli], accounts: DEPLOYER, }, + neon: { + chainId: CHAINS_ID[eEthereumNetwork.neon], + url: NETWORKS_RPC_URL[eEthereumNetwork.neon], + accounts: DEPLOYER, + }, mainnet: { chainId: CHAINS_ID[eEthereumNetwork.mainnet], url: NETWORKS_RPC_URL[eEthereumNetwork.mainnet], @@ -257,8 +273,11 @@ const hardhatConfig: HardhatUserConfig = { localhost: ETHERSCAN_KEY, mainnet: ETHERSCAN_KEY, goerli: GOERLI_ETHERSCAN_KEY, + sepolia: SEPOLIA_ETHERSCAN_KEY, arbitrum: ARBITRUM_ETHERSCAN_KEY, arbitrumGoerli: ARBITRUM_GOERLI_ETHERSCAN_KEY, + arbitrumSepolia: ARBITRUM_SEPOLIA_ETHERSCAN_KEY, + parallelDev: PARALLEL_DEV_ETHERSCAN_KEY, polygon: POLYGON_ETHERSCAN_KEY, polygonMumbai: POLYGON_MUMBAI_ETHERSCAN_KEY, polygonZkevm: POLYGON_ZKEVM_ETHERSCAN_KEY, @@ -267,12 +286,17 @@ const hardhatConfig: HardhatUserConfig = { moonbase: MOONBASE_ETHERSCAN_KEY, linea: LINEA_ETHERSCAN_KEY, lineaGoerli: LINEA_GOERLI_ETHERSCAN_KEY, + neon: NEON_ETHERSCAN_KEY, + parallel: PARALLEL_ETHERSCAN_KEY, }, customChains: [ eEthereumNetwork.localhost, eEthereumNetwork.goerli, + eEthereumNetwork.sepolia, eEthereumNetwork.arbitrum, eEthereumNetwork.arbitrumGoerli, + eEthereumNetwork.arbitrumSepolia, + eEthereumNetwork.parallelDev, eEthereumNetwork.polygon, eEthereumNetwork.polygonZkevm, eEthereumNetwork.polygonMumbai, @@ -283,6 +307,8 @@ const hardhatConfig: HardhatUserConfig = { eEthereumNetwork.moonbase, eEthereumNetwork.linea, eEthereumNetwork.lineaGoerli, + eEthereumNetwork.neon, + eEthereumNetwork.parallel, ].map((network) => ({ network, chainId: CHAINS_ID[network]!, diff --git a/helper-hardhat-config.ts b/helper-hardhat-config.ts index 50717531b..c4c30ff8e 100644 --- a/helper-hardhat-config.ts +++ b/helper-hardhat-config.ts @@ -9,6 +9,7 @@ import { FORK_BLOCK_NUMBER, FORK_CHAINID, GOERLI_CHAINID, + SEPOLIA_CHAINID, HARDHAT_CHAINID, INFURA_KEY, L1_RPC_URL, @@ -27,6 +28,9 @@ import { TENDERLY_FORK_ID, ZKSYNC_CHAINID, ZKSYNC_GOERLI_CHAINID, + ARBITRUM_SEPOLIA_CHAINID, + PARALLEL_DEV_CHAINID, + NEON_CHAINID, } from "./helpers/hardhat-constants"; dotenv.config(); @@ -55,6 +59,12 @@ export const NETWORKS_RPC_URL: iParamsPerNetwork = { (ALCHEMY_KEY ? `https://eth-goerli.alchemyapi.io/v2/${ALCHEMY_KEY}` : `https://goerli.infura.io/v3/${INFURA_KEY}`), + [eEthereumNetwork.sepolia]: + L1_RPC_URL || + RPC_URL || + (ALCHEMY_KEY + ? `https://eth-sepolia.alchemyapi.io/v2/${ALCHEMY_KEY}` + : `https://sepolia.infura.io/v3/${INFURA_KEY}`), [eEthereumNetwork.mainnet]: L1_RPC_URL || RPC_URL || @@ -66,7 +76,7 @@ export const NETWORKS_RPC_URL: iParamsPerNetwork = { [eEthereumNetwork.ganache]: RPC_URL || "http://localhost:8545", [eEthereumNetwork.tenderlyMain]: RPC_URL || `https://rpc.tenderly.co/fork/${TENDERLY_FORK_ID}`, - [eEthereumNetwork.parallel]: RPC_URL || "http://localhost:29933", + [eEthereumNetwork.parallel]: RPC_URL || "https://rpc.parallel.fi", [eEthereumNetwork.moonbeam]: "https://rpc.api.moonbeam.network", [eEthereumNetwork.moonbase]: "https://rpc.testnet.moonbeam.network", [eEthereumNetwork.arbitrum]: @@ -77,6 +87,14 @@ export const NETWORKS_RPC_URL: iParamsPerNetwork = { L2_RPC_URL || RPC_URL || `https://arb-goerli.g.alchemy.com/v2/${ALCHEMY_KEY}`, + [eEthereumNetwork.arbitrumSepolia]: + L2_RPC_URL || + RPC_URL || + `https://arb-sepolia.g.alchemy.com/v2/${ALCHEMY_KEY}`, + [eEthereumNetwork.parallelDev]: + L2_RPC_URL || + RPC_URL || + `https://rpc-surprised-harlequin-bonobo-fvcy2k9oqh.t.conduit.xyz`, [eEthereumNetwork.polygon]: RPC_URL || `https://polygon-mainnet.g.alchemy.com/v2/${ALCHEMY_KEY}`, [eEthereumNetwork.polygonMumbai]: @@ -105,11 +123,14 @@ export const NETWORKS_RPC_URL: iParamsPerNetwork = { (INFURA_KEY ? `https://linea-goerli.infura.io/v3/${INFURA_KEY}` : `https://rpc.goerli.linea.build`), + [eEthereumNetwork.neon]: + RPC_URL || `https://neon-proxy-mainnet.solana.p2p.org`, }; export const CHAINS_ID: iParamsPerNetwork = { [eEthereumNetwork.mainnet]: MAINNET_CHAINID, [eEthereumNetwork.goerli]: GOERLI_CHAINID, + [eEthereumNetwork.sepolia]: SEPOLIA_CHAINID, [eEthereumNetwork.hardhat]: FORK ? FORK_CHAINID : HARDHAT_CHAINID, [eEthereumNetwork.anvil]: HARDHAT_CHAINID, [eEthereumNetwork.ganache]: undefined, @@ -119,6 +140,8 @@ export const CHAINS_ID: iParamsPerNetwork = { [eEthereumNetwork.moonbase]: MOONBASE_CHAINID, [eEthereumNetwork.arbitrum]: ARBITRUM_ONE_CHAINID, [eEthereumNetwork.arbitrumGoerli]: ARBITRUM_GOERLI_CHAINID, + [eEthereumNetwork.arbitrumSepolia]: ARBITRUM_SEPOLIA_CHAINID, + [eEthereumNetwork.parallelDev]: PARALLEL_DEV_CHAINID, [eEthereumNetwork.polygon]: POLYGON_CHAINID, [eEthereumNetwork.polygonMumbai]: POLYGON_MUMBAI_CHAINID, [eEthereumNetwork.polygonZkevm]: POLYGON_ZKEVM_CHAINID, @@ -127,11 +150,13 @@ export const CHAINS_ID: iParamsPerNetwork = { [eEthereumNetwork.zksyncGoerli]: ZKSYNC_GOERLI_CHAINID, [eEthereumNetwork.linea]: LINEA_CHAINID, [eEthereumNetwork.lineaGoerli]: LINEA_GOERLI_CHAINID, + [eEthereumNetwork.neon]: NEON_CHAINID, }; export const BLOCK_TO_FORK: iParamsPerNetwork = { [eEthereumNetwork.mainnet]: undefined, [eEthereumNetwork.goerli]: undefined, + [eEthereumNetwork.sepolia]: undefined, [eEthereumNetwork.hardhat]: undefined, [eEthereumNetwork.anvil]: undefined, [eEthereumNetwork.ganache]: undefined, @@ -141,6 +166,8 @@ export const BLOCK_TO_FORK: iParamsPerNetwork = { [eEthereumNetwork.moonbase]: undefined, [eEthereumNetwork.arbitrum]: undefined, [eEthereumNetwork.arbitrumGoerli]: undefined, + [eEthereumNetwork.arbitrumSepolia]: undefined, + [eEthereumNetwork.parallelDev]: undefined, [eEthereumNetwork.polygon]: undefined, [eEthereumNetwork.polygonMumbai]: undefined, [eEthereumNetwork.polygonZkevm]: undefined, @@ -149,4 +176,5 @@ export const BLOCK_TO_FORK: iParamsPerNetwork = { [eEthereumNetwork.zksyncGoerli]: undefined, [eEthereumNetwork.linea]: undefined, [eEthereumNetwork.lineaGoerli]: undefined, + [eEthereumNetwork.neon]: undefined, }; diff --git a/helpers/contracts-deployments.ts b/helpers/contracts-deployments.ts index b825dbb2f..bd01db02f 100644 --- a/helpers/contracts-deployments.ts +++ b/helpers/contracts-deployments.ts @@ -957,14 +957,13 @@ export const deployPoolComponents = async ( const config = getParaSpaceConfig(); const treasuryAddress = config.Treasury; - const cApe = await getAutoCompoundApe(); const poolApeStaking = allTokens.APE ? ((await withSaveAndVerify( await getContractFactory("PoolApeStaking", apeStakingLibraries), eContractid.PoolApeStakingImpl, [ provider, - cApe.address, + (await getAutoCompoundApe()).address, allTokens.APE.address, allTokens.USDC.address, (await getUniswapV3SwapRouter()).address, @@ -987,7 +986,7 @@ export const deployPoolComponents = async ( ? ((await withSaveAndVerify( await getContractFactory("PoolBorrowAndStake", BorrowAndStakeLibraries), eContractid.PoolBorrowAndStakeImpl, - [provider, cApe.address, allTokens.APE.address], + [provider, (await getAutoCompoundApe()).address, allTokens.APE.address], verify, false, BorrowAndStakeLibraries, diff --git a/helpers/hardhat-constants.ts b/helpers/hardhat-constants.ts index ef66a0b05..ca2df4817 100644 --- a/helpers/hardhat-constants.ts +++ b/helpers/hardhat-constants.ts @@ -22,13 +22,16 @@ const getPrivateKeyfromEncryptedJson = ( export const HARDHAT_CHAINID = 31337; export const GOERLI_CHAINID = 5; +export const SEPOLIA_CHAINID = 11155111; export const FORK_CHAINID = 522; export const MAINNET_CHAINID = 1; -export const PARALLEL_CHAINID = 1592; +export const PARALLEL_CHAINID = 1024; +export const PARALLEL_DEV_CHAINID = 2982896226593698; export const MOONBEAM_CHAINID = 1284; export const MOONBASE_CHAINID = 1287; export const ARBITRUM_ONE_CHAINID = 42161; export const ARBITRUM_GOERLI_CHAINID = 421613; +export const ARBITRUM_SEPOLIA_CHAINID = 421613; export const POLYGON_CHAINID = 137; export const POLYGON_ZKEVM_CHAINID = 1101; export const POLYGON_ZKEVM_GOERLI_CHAINID = 1442; @@ -37,6 +40,7 @@ export const ZKSYNC_CHAINID = 324; export const ZKSYNC_GOERLI_CHAINID = 280; export const LINEA_GOERLI_CHAINID = 59140; export const LINEA_CHAINID = 59144; +export const NEON_CHAINID = 245022934; export const INFURA_KEY = process.env.INFURA_KEY || ""; export const ALCHEMY_KEY = process.env.ALCHEMY_KEY || ""; @@ -67,10 +71,16 @@ export const DB_PATH = process.env.DB_PATH ?? ":memory:"; export const ETHERSCAN_KEY = process.env.ETHERSCAN_KEY || ""; export const GOERLI_ETHERSCAN_KEY = process.env.GOERLI_ETHERSCAN_KEY || ETHERSCAN_KEY; +export const SEPOLIA_ETHERSCAN_KEY = + process.env.SEPOLIA_ETHERSCAN_KEY || ETHERSCAN_KEY; export const ARBITRUM_ETHERSCAN_KEY = process.env.ARBITRUM_ETHERSCAN_KEY || ETHERSCAN_KEY; export const ARBITRUM_GOERLI_ETHERSCAN_KEY = process.env.ARBITRUM_GOERLI_ETHERSCAN_KEY || ARBITRUM_ETHERSCAN_KEY; +export const ARBITRUM_SEPOLIA_ETHERSCAN_KEY = + process.env.ARBITRUM_SEPOLIA_ETHERSCAN_KEY || ARBITRUM_ETHERSCAN_KEY; +export const PARALLEL_DEV_ETHERSCAN_KEY = + process.env.PARALLEL_DEV_ETHERSCAN_KEY || ETHERSCAN_KEY; export const POLYGON_ETHERSCAN_KEY = process.env.POLYGON_ETHERSCAN_KEY || ETHERSCAN_KEY; export const POLYGON_MUMBAI_ETHERSCAN_KEY = @@ -99,11 +109,19 @@ export const ETHERSCAN_VERIFICATION_JOBS = parseInt( export const ETHERSCAN_VERIFICATION_MAX_RETRIES = parseInt( process.env.ETHERSCAN_VERIFICATION_MAX_RETRIES || "3" ); +export const NEON_ETHERSCAN_KEY = + process.env.NEON_ETHERSCAN_KEY || ETHERSCAN_KEY; +export const PARALLEL_ETHERSCAN_KEY = + process.env.PARALLEL_ETHERSCAN_KEY || ETHERSCAN_KEY; + export const ETHERSCAN_NETWORKS = [ "localhost", "mainnet", "goerli", "arbitrum", + "arbitrumGoerli", + "arbitrumSepolia", + "parallelDev", "polygon", "matic", "polygonMumbai", @@ -115,6 +133,8 @@ export const ETHERSCAN_NETWORKS = [ "lineaGoerli", "moonbeam", "moonbase", + "neon", + "parallel", ]; export const ETHERSCAN_APIS = { localhost: "http://localhost:4000/api", @@ -122,6 +142,9 @@ export const ETHERSCAN_APIS = { goerli: "https://api-goerli.etherscan.io/api", arbitrum: "https://api.arbiscan.io/api", arbitrumGoerli: "https://api-goerli.arbiscan.io/api", + arbitrumSepolia: "https://api-sepolia.arbiscan.io/api", + parallelDev: + "https://explorerl2new-surprised-harlequin-bonobo-fvcy2k9oqh.t.conduit.xyz/api", polygon: "https://api.polygonscan.com/api", matic: "https://api.polygonscan.com/api", polygonMumbai: "https://api-mumbai.polygonscan.com/api", @@ -134,6 +157,8 @@ export const ETHERSCAN_APIS = { moonbase: "https://api-moonbase.moonscan.io/api", linea: "http://explorer.linea.build/api", lineaGoerli: "https://explorer.goerli.linea.build/api", + neon: "https://neonscan.org/api", + parallel: "https://explorer.parallel.fi/api", }; export const BROWSER_URLS = { localhost: "http://localhost:4000", @@ -141,8 +166,11 @@ export const BROWSER_URLS = { goerli: "https://goerli.etherscan.io", arbitrum: "https://arbiscan.io", arbitrumGoerli: "https://goerli.arbiscan.io", + arbitrumSepolia: "https://sepolia.arbiscan.io", polygonZkevm: "https://zkevm.polygonscan.com", polygonZkevmGoerli: "https://testnet-zkevm.polygonscan.com", + parallelDev: + "https://explorerl2new-surprised-harlequin-bonobo-fvcy2k9oqh.t.conduit.xyz", polygon: "https://polygonscan.com", matic: "https://polygonscan.com", polygonMumbai: "https://mumbai.polygonscan.com", @@ -152,6 +180,8 @@ export const BROWSER_URLS = { moonbase: "https://moonbase.moonscan.io", linea: "https://explorer.linea.build", lineaGoerli: "https://explorer.goerli.linea.build", + neon: "https://neonscan.org", + parallel: "https://explorer.parallel.fi", }; export const DEPLOY_START = parseInt(process.env.DEPLOY_START || "0"); @@ -217,7 +247,7 @@ export const MULTI_SIG_NONCE = process.env.MULTI_SIG_NONCE ? parseInt(process.env.MULTI_SIG_NONCE) : undefined; export const MULTI_SEND_CHUNK_SIZE = parseInt( - process.env.MULTI_SEND_CHUNK_SIZE || "30" + process.env.MULTI_SEND_CHUNK_SIZE || "45" ); export const VERSION = version; @@ -498,5 +528,6 @@ export const XTOKEN_TYPE_UPGRADE_WHITELIST = .split(/\s?,\s?/) .map((x) => +x); export const XTOKEN_SYMBOL_UPGRADE_WHITELIST = - process.env.XTOKEN_SYMBOL_UPGRADE_WHITELIST?.trim() - .split(/\s?,\s?/); + process.env.XTOKEN_SYMBOL_UPGRADE_WHITELIST?.trim().split(/\s?,\s?/); + +export const STACKUP_KEY = process.env.STACKUP_KEY || ""; diff --git a/helpers/init-helpers.ts b/helpers/init-helpers.ts index a8cb6c807..70508561f 100644 --- a/helpers/init-helpers.ts +++ b/helpers/init-helpers.ts @@ -420,7 +420,8 @@ export const initReservesByHelper = async ( variableDebtTokenToUse = stKSMVariableDebtTokenImplementationAddress; } else if ( reserveSymbol === ERC20TokenContractId.aWETH || - reserveSymbol === ERC20TokenContractId.awstETH + reserveSymbol === ERC20TokenContractId.awstETH || + reserveSymbol === ERC20TokenContractId.aUSDC ) { if (!pTokenATokenImplementationAddress) { pTokenATokenImplementationAddress = ( diff --git a/helpers/misc-utils.ts b/helpers/misc-utils.ts index 011ff7f3a..b8a41a6f4 100644 --- a/helpers/misc-utils.ts +++ b/helpers/misc-utils.ts @@ -28,6 +28,11 @@ import { MOONBASE_CHAINID, LINEA_CHAINID, LINEA_GOERLI_CHAINID, + SEPOLIA_CHAINID, + ARBITRUM_SEPOLIA_CHAINID, + PARALLEL_DEV_CHAINID, + NEON_CHAINID, + PARALLEL_CHAINID, } from "./hardhat-constants"; import {ConstructorArgs, eContractid, tEthereumAddress} from "./types"; import dotenv from "dotenv"; @@ -57,7 +62,10 @@ export const isPublicTestnet = (): boolean => { return ( [ GOERLI_CHAINID, + SEPOLIA_CHAINID, ARBITRUM_GOERLI_CHAINID, + ARBITRUM_SEPOLIA_CHAINID, + PARALLEL_DEV_CHAINID, ZKSYNC_GOERLI_CHAINID, POLYGON_ZKEVM_GOERLI_CHAINID, POLYGON_MUMBAI_CHAINID, @@ -66,7 +74,10 @@ export const isPublicTestnet = (): boolean => { ].includes(DRE.network.config.chainId!) || [ eEthereumNetwork.goerli, + eEthereumNetwork.sepolia, eEthereumNetwork.arbitrumGoerli, + eEthereumNetwork.arbitrumSepolia, + eEthereumNetwork.parallelDev, eEthereumNetwork.zksyncGoerli, eEthereumNetwork.polygonZkevmGoerli, eEthereumNetwork.polygonMumbai, @@ -137,6 +148,22 @@ export const isLinea = (): boolean => { ); }; +export const isNeon = (): boolean => { + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + return ( + [NEON_CHAINID].includes(DRE.network.config.chainId!) || + [eEthereumNetwork.neon].includes(FORK as eEthereumNetwork) + ); +}; + +export const isParallel = (): boolean => { + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + return ( + [PARALLEL_CHAINID].includes(DRE.network.config.chainId!) || + [eEthereumNetwork.parallel].includes(FORK as eEthereumNetwork) + ); +}; + export const isMainnet = (): boolean => isEthereum() || isMoonbeam() || @@ -144,7 +171,9 @@ export const isMainnet = (): boolean => isZkSync() || isPolygon() || isPolygonZkEVM() || - isLinea(); + isLinea() || + isNeon() || + isParallel(); export const safeTransactionServiceUrl = (): string => { return isMoonbeam() diff --git a/helpers/types.ts b/helpers/types.ts index 5e6c1842e..01a7a4ea2 100644 --- a/helpers/types.ts +++ b/helpers/types.ts @@ -84,6 +84,7 @@ export type ParaSpaceLibraryAddresses = Libraries; export enum eEthereumNetwork { ropsten = "ropsten", goerli = "goerli", + sepolia = "sepolia", mainnet = "mainnet", hardhat = "hardhat", tenderlyMain = "tenderlyMain", @@ -95,6 +96,8 @@ export enum eEthereumNetwork { moonbase = "moonbase", arbitrum = "arbitrum", arbitrumGoerli = "arbitrumGoerli", + arbitrumSepolia = "arbitrumSepolia", + parallelDev = "parallelDev", polygon = "polygon", polygonMumbai = "polygonMumbai", polygonZkevm = "polygonZkevm", @@ -103,6 +106,7 @@ export enum eEthereumNetwork { zksyncGoerli = "zksyncGoerli", linea = "linea", lineaGoerli = "lineaGoerli", + neon = "neon", } export enum eContractid { @@ -455,6 +459,7 @@ export interface iAssetBase { DAI: T; WETH: T; USDC: T; + aUSDC: T; USDT: T; FRAX: T; WBTC: T; @@ -588,6 +593,7 @@ export enum ERC20TokenContractId { DAI = "DAI", WETH = "WETH", USDC = "USDC", + aUSDC = "aUSDC", USDT = "USDT", FRAX = "FRAX", WBTC = "WBTC", @@ -745,6 +751,7 @@ export type iParamsPerNetworkAll = iEthereumParamsPerNetwork; export interface iEthereumParamsPerNetwork { [eEthereumNetwork.goerli]: T; + [eEthereumNetwork.sepolia]: T; [eEthereumNetwork.mainnet]: T; [eEthereumNetwork.hardhat]: T; [eEthereumNetwork.anvil]: T; @@ -755,6 +762,8 @@ export interface iEthereumParamsPerNetwork { [eEthereumNetwork.moonbase]: T; [eEthereumNetwork.arbitrum]: T; [eEthereumNetwork.arbitrumGoerli]: T; + [eEthereumNetwork.arbitrumSepolia]: T; + [eEthereumNetwork.parallelDev]: T; [eEthereumNetwork.polygon]: T; [eEthereumNetwork.polygonMumbai]: T; [eEthereumNetwork.polygonZkevm]: T; @@ -763,6 +772,7 @@ export interface iEthereumParamsPerNetwork { [eEthereumNetwork.zksyncGoerli]: T; [eEthereumNetwork.linea]: T; [eEthereumNetwork.lineaGoerli]: T; + [eEthereumNetwork.neon]: T; } export enum RateMode { @@ -947,7 +957,7 @@ export interface ICommonConfiguration { Governance: IGovernanceConfig; - AccountAbstraction: IAccountAbstraction; + AccountAbstraction: IAccountAbstraction | undefined; } export interface IParaSpaceConfiguration extends ICommonConfiguration { diff --git a/market-config/index.ts b/market-config/index.ts index 5eecaa4cf..aebe7f02b 100644 --- a/market-config/index.ts +++ b/market-config/index.ts @@ -1,5 +1,5 @@ import {ZERO_ADDRESS} from "../helpers/constants"; -import {MULTI_SEND, MULTI_SIG} from "../helpers/hardhat-constants"; +import {MULTI_SEND, MULTI_SIG, STACKUP_KEY} from "../helpers/hardhat-constants"; import { eEthereumNetwork, ERC20TokenContractId, @@ -78,6 +78,7 @@ import { strategyEXRP, strategyuBAYC, strategyuPPG, + strategyAUSDC, } from "./reservesConfigs"; export const CommonConfig: Pick< @@ -137,10 +138,7 @@ export const CommonConfig: Pick< }, // ParaSpaceV1 ParaSpaceV1: undefined, - AccountAbstraction: { - rpcUrl: `https://api.stackup.sh/v1/node/${process.env.STACKUP_KEY}`, - paymasterUrl: `https://api.stackup.sh/v1/paymaster/${process.env.STACKUP_KEY}`, - }, + AccountAbstraction: undefined, }; export const HardhatConfig: IParaSpaceConfiguration = { @@ -631,6 +629,75 @@ export const ArbitrumGoerliConfig: IParaSpaceConfiguration = { Oracle: ArbitrumOracleConfig, }; +export const ArbitrumSepoliaConfig: IParaSpaceConfiguration = { + // BASIC INFO + ...CommonConfig, + ParaSpaceTeam: "0x018281853eCC543Aa251732e8FDaa7323247eBeB", + Treasury: "0x018281853eCC543Aa251732e8FDaa7323247eBeB", + YogaLabs: {}, + Uniswap: {}, + Tokens: {}, + Marketplace: {}, + Chainlink: {}, + BendDAO: {}, + Stakefish: {}, + // RESERVE ASSETS - CONFIG, ASSETS, BORROW RATES, + ReservesConfig: { + DAI: strategyDAI, + USDC: strategyUSDC, + USDT: strategyUSDT, + FRAX: strategyFRAX, + WETH: strategyWETH, + WBTC: strategyWBTC, + PUNK: strategyPUNK, + BLUR: strategyBLUR, + DOODLE: strategyDoodles, + WPUNKS: strategyWPunks, + MOONBIRD: strategyMoonbird, + MEEBITS: strategyMeebits, + AZUKI: strategyAzuki, + OTHR: strategyOthr, + CLONEX: strategyClonex, + BLOCKS: strategyBLOCKS, + SEWER: strategySEWER, + PPG: strategyPudgyPenguins, + }, +}; +export const ParallelDevConfig: IParaSpaceConfiguration = { + // BASIC INFO + ...CommonConfig, + ParaSpaceTeam: "0x018281853eCC543Aa251732e8FDaa7323247eBeB", + Treasury: "0x018281853eCC543Aa251732e8FDaa7323247eBeB", + YogaLabs: {}, + Uniswap: {}, + Tokens: {}, + Marketplace: {}, + Chainlink: {}, + BendDAO: {}, + Stakefish: {}, + // RESERVE ASSETS - CONFIG, ASSETS, BORROW RATES, + ReservesConfig: { + DAI: strategyDAI, + USDC: strategyUSDC, + USDT: strategyUSDT, + FRAX: strategyFRAX, + WETH: strategyWETH, + WBTC: strategyWBTC, + PUNK: strategyPUNK, + BLUR: strategyBLUR, + DOODLE: strategyDoodles, + WPUNKS: strategyWPunks, + MOONBIRD: strategyMoonbird, + MEEBITS: strategyMeebits, + AZUKI: strategyAzuki, + OTHR: strategyOthr, + CLONEX: strategyClonex, + BLOCKS: strategyBLOCKS, + SEWER: strategySEWER, + PPG: strategyPudgyPenguins, + }, +}; + export const ZkSyncGoerliConfig: IParaSpaceConfiguration = { // BASIC INFO ...CommonConfig, @@ -1009,6 +1076,10 @@ export const MainnetConfig: IParaSpaceConfiguration = { TimeLockV1: "0x59B72FdB45B3182c8502cC297167FE4f821f332d", P2PPairStakingV1: "0xf090Eb4c2B63e7B26E8Bb09e6Fc0cC3A7586263B", }, + AccountAbstraction: { + rpcUrl: `https://api.stackup.sh/v1/node/${STACKUP_KEY}`, + paymasterUrl: `https://api.stackup.sh/v1/paymaster/${STACKUP_KEY}`, + }, }; export const ParaSpaceConfigs: Partial< @@ -1022,6 +1093,8 @@ export const ParaSpaceConfigs: Partial< [eEthereumNetwork.goerli]: GoerliConfig, [eEthereumNetwork.mainnet]: MainnetConfig, [eEthereumNetwork.arbitrumGoerli]: ArbitrumGoerliConfig, + [eEthereumNetwork.arbitrumSepolia]: ArbitrumSepoliaConfig, + [eEthereumNetwork.parallelDev]: ParallelDevConfig, [eEthereumNetwork.arbitrum]: ArbitrumConfig, [eEthereumNetwork.polygon]: PolygonConfig, [eEthereumNetwork.polygonMumbai]: PolygonMumbaiConfig, @@ -1031,4 +1104,6 @@ export const ParaSpaceConfigs: Partial< [eEthereumNetwork.zksyncGoerli]: ZkSyncGoerliConfig, [eEthereumNetwork.linea]: LineaConfig, [eEthereumNetwork.lineaGoerli]: LineaGoerliConfig, + [eEthereumNetwork.parallel]: HardhatConfig, + [eEthereumNetwork.neon]: HardhatConfig, }; diff --git a/market-config/mocks.ts b/market-config/mocks.ts index 6d4fdc362..19c131648 100644 --- a/market-config/mocks.ts +++ b/market-config/mocks.ts @@ -6,6 +6,7 @@ export const MOCK_CHAINLINK_AGGREGATORS_PRICES = { // ERC20 DAI: parseEther("0.000908578801039414").toString(), USDC: parseEther("0.000915952223931999").toString(), + aUSDC: parseEther("0.000477910115122588").toString(), USDT: parseEther("0.000915952223931999").toString(), FRAX: parseEther("0.000915952223931999").toString(), WETH: parseEther("1").toString(), @@ -72,6 +73,7 @@ export const MOCK_CHAINLINK_AGGREGATORS_USD_PRICES = { // ERC20 DAI: parseUnits("1", 8).toString(), USDC: parseUnits("1", 8).toString(), + aUSDC: parseUnits("1", 8).toString(), USDT: parseUnits("1", 8).toString(), FRAX: parseUnits("1", 8).toString(), WETH: parseUnits("1896", 8).toString(), diff --git a/market-config/rateStrategies.ts b/market-config/rateStrategies.ts index 3d3cc4b67..2c8b2ddaf 100644 --- a/market-config/rateStrategies.ts +++ b/market-config/rateStrategies.ts @@ -17,6 +17,14 @@ export const rateStrategyUSDC: IInterestRateStrategyParams = { variableRateSlope2: utils.parseUnits("0.60", 27).toString(), }; +export const rateStrategyaUSDC: IInterestRateStrategyParams = { + name: "rateStrategyaUSDC", + optimalUsageRatio: utils.parseUnits("0.9", 27).toString(), + baseVariableBorrowRate: utils.parseUnits("0", 27).toString(), + variableRateSlope1: utils.parseUnits("0.04", 27).toString(), + variableRateSlope2: utils.parseUnits("0.60", 27).toString(), +}; + export const rateStrategyUSDT: IInterestRateStrategyParams = { name: "rateStrategyUSDT", optimalUsageRatio: utils.parseUnits("0.9", 27).toString(), diff --git a/market-config/reservesConfigs.ts b/market-config/reservesConfigs.ts index 70c0ea388..e498a748d 100644 --- a/market-config/reservesConfigs.ts +++ b/market-config/reservesConfigs.ts @@ -28,6 +28,7 @@ import { rateStrategyAAVE, rateStrategyAPE, rateStrategyARB, + rateStrategyaUSDC, rateStrategyBAL, rateStrategyBLUR, rateStrategyCRV, @@ -114,6 +115,7 @@ import { timeLockStrategyEXRP, timeLockStrategyuPPG, timeLockStrategyuBAYC, + timeLockStrategyaUSDC, } from "./timeLockStrategies"; export const strategyDAI: IReserveParams = { @@ -148,6 +150,22 @@ export const strategyUSDC: IReserveParams = { supplyCap: "0", }; +export const strategyAUSDC: IReserveParams = { + strategy: rateStrategyaUSDC, + auctionStrategy: auctionStrategyZero, + timeLockStrategy: timeLockStrategyaUSDC, + baseLTVAsCollateral: "8700", + liquidationThreshold: "8900", + liquidationProtocolFeePercentage: "0", + liquidationBonus: "10450", + borrowingEnabled: true, + reserveDecimals: "6", + xTokenImpl: eContractid.PTokenATokenImpl, + reserveFactor: "1000", + borrowCap: "0", + supplyCap: "0", +}; + export const strategyUSDT: IReserveParams = { strategy: rateStrategyUSDT, auctionStrategy: auctionStrategyZero, diff --git a/market-config/timeLockStrategies.ts b/market-config/timeLockStrategies.ts index 14fa32282..fe705e005 100644 --- a/market-config/timeLockStrategies.ts +++ b/market-config/timeLockStrategies.ts @@ -13,6 +13,18 @@ export const timeLockStrategyUSDC: ITimeLockStrategyParams = { period: "86400", }; +export const timeLockStrategyaUSDC: ITimeLockStrategyParams = { + name: "timeLockStrategyaUSDC", + minThreshold: parseUnits("105000", 6).toString(), + midThreshold: parseUnits("400000", 6).toString(), + minWaitTime: "12", + midWaitTime: "7200", + maxWaitTime: "21600", + poolPeriodWaitTime: "600", + poolPeriodLimit: parseUnits("1875000", 6).toString(), + period: "86400", +}; + export const timeLockStrategyUSDT: ITimeLockStrategyParams = { name: "timeLockStrategyUSDT", minThreshold: parseUnits("105000", 6).toString(), diff --git a/package.json b/package.json index 2b9547652..3923cfe2f 100644 --- a/package.json +++ b/package.json @@ -47,12 +47,12 @@ "@safe-global/safe-ethers-lib": "^1.7.0", "@safe-global/safe-service-client": "^1.5.0", "@tenderly/hardhat-tenderly": "1.1.0-beta.5", - "@typechain/ethers-v5": "^11.0.0", - "@typechain/hardhat": "^6.1.2", + "@typechain/ethers-v5": "^11.1.2", + "@typechain/hardhat": "^9.1.0", "@types/chai": "^4.2.11", "@types/lowdb": "1.0.9", "@types/mocha": "^9.1.1", - "@types/node": "^18.0.6", + "@types/node": "^20.9.2", "@typescript-eslint/eslint-plugin": "5.33.0", "@typescript-eslint/parser": "5.33.0", "@uniswap/v3-periphery": "1.4.1", @@ -79,7 +79,7 @@ "hardhat-contract-sizer": "^2.0.3", "hardhat-deploy": "^0.11.30", "hardhat-gas-reporter": "^1.0.9", - "hardhat-typechain": "^0.3.3", + "hardhat-typechain": "^0.3.5", "husky": "^8.0.1", "lodash": "^4.17.21", "lowdb": "1.0.0", diff --git a/scripts/deployments/steps/10_allAggregators.ts b/scripts/deployments/steps/10_allAggregators.ts index 39469b580..0280a8b39 100644 --- a/scripts/deployments/steps/10_allAggregators.ts +++ b/scripts/deployments/steps/10_allAggregators.ts @@ -11,9 +11,11 @@ import { getAllTokens, getFirstSigner, getPoolAddressesProvider, - getPriceOracle, } from "../../../helpers/contracts-getters"; -import {getEthersSignersAddresses} from "../../../helpers/contracts-helpers"; +import { + getContractAddressInDb, + getEthersSignersAddresses, +} from "../../../helpers/contracts-helpers"; import {GLOBAL_OVERRIDES} from "../../../helpers/hardhat-constants"; import {getParaSpaceConfig, waitForTx} from "../../../helpers/misc-utils"; import { @@ -23,6 +25,7 @@ import { import { ERC20TokenContractId, ERC721TokenContractId, + eContractid, } from "../../../helpers/types"; export const deployNftOracle = async (verify = false) => { @@ -69,7 +72,6 @@ export const step_10 = async (verify = false) => { try { const allTokens = await getAllTokens(); const addressesProvider = await getPoolAddressesProvider(); - const fallbackOracle = await getPriceOracle(); const paraSpaceConfig = getParaSpaceConfig(); const oracleConfig = paraSpaceConfig.Oracle; const chainlinkConfig = paraSpaceConfig.Chainlink; @@ -93,7 +95,7 @@ export const step_10 = async (verify = false) => { addressesProvider.address, tokens, aggregators, - fallbackOracle.address, + (await getContractAddressInDb(eContractid.PriceOracle)) || ZERO_ADDRESS, oracleConfig.BaseCurrency == ZERO_ADDRESS ? oracleConfig.BaseCurrency : allTokens[oracleConfig.BaseCurrency].address, diff --git a/scripts/deployments/steps/24_accountAbstraction.ts b/scripts/deployments/steps/24_accountAbstraction.ts index 46399bdba..e95edad2a 100644 --- a/scripts/deployments/steps/24_accountAbstraction.ts +++ b/scripts/deployments/steps/24_accountAbstraction.ts @@ -1,3 +1,4 @@ +import {ZERO_ADDRESS} from "../../../helpers/constants"; import {deployAccountFactory} from "../../../helpers/contracts-deployments"; import {getParaSpaceConfig, isLocalTestnet} from "../../../helpers/misc-utils"; import {Client} from "userop"; @@ -6,10 +7,14 @@ export const step_24 = async (verify = false) => { const paraSpaceConfig = getParaSpaceConfig(); try { if (!isLocalTestnet()) { - const client = Client.init(paraSpaceConfig.AccountAbstraction.rpcUrl); - - const entryPoint = (await client).entryPoint.address; - await deployAccountFactory(entryPoint, verify); + await deployAccountFactory( + paraSpaceConfig.AccountAbstraction?.rpcUrl + ? ( + await Client.init(paraSpaceConfig.AccountAbstraction.rpcUrl) + ).entryPoint.address + : ZERO_ADDRESS, + verify + ); } } catch (error) { console.error(error); diff --git a/scripts/upgrade/accountAbstraction.ts b/scripts/upgrade/accountAbstraction.ts index 832bf4b48..a261cbd97 100644 --- a/scripts/upgrade/accountAbstraction.ts +++ b/scripts/upgrade/accountAbstraction.ts @@ -4,17 +4,19 @@ import {getAccountRegistry} from "../../helpers/contracts-getters"; import {dryRunEncodedData} from "../../helpers/contracts-helpers"; import {DRY_RUN, GLOBAL_OVERRIDES} from "../../helpers/hardhat-constants"; import {getParaSpaceConfig, waitForTx} from "../../helpers/misc-utils"; +import {ZERO_ADDRESS} from "../../helpers/constants"; export const upgradeAccountAbstraction = async (verify = false) => { console.time("deploy AccountAbstraction"); const paraSpaceConfig = getParaSpaceConfig(); - const client = Client.init(paraSpaceConfig.AccountAbstraction.rpcUrl); const accountRegistry = await getAccountRegistry(); const account = await deployAccount( - ( - await client - ).entryPoint.address, + paraSpaceConfig.AccountAbstraction?.rpcUrl + ? ( + await Client.init(paraSpaceConfig.AccountAbstraction.rpcUrl) + ).entryPoint.address + : ZERO_ADDRESS, verify ); diff --git a/scripts/upgrade/ntoken.ts b/scripts/upgrade/ntoken.ts index ba3ca36f6..21713a50b 100644 --- a/scripts/upgrade/ntoken.ts +++ b/scripts/upgrade/ntoken.ts @@ -76,12 +76,14 @@ export const upgradeNToken = async (verify = false) => { continue; } - if (XTOKEN_SYMBOL_UPGRADE_WHITELIST && !XTOKEN_SYMBOL_UPGRADE_WHITELIST.includes(symbol)) { + if ( + XTOKEN_SYMBOL_UPGRADE_WHITELIST && + !XTOKEN_SYMBOL_UPGRADE_WHITELIST.includes(symbol) + ) { console.log(symbol + "not in XTOKEN_SYMBOL_UPGRADE_WHITELIST, skip..."); continue; } - if (xTokenType == XTokenType.NTokenBAYC) { if (!nTokenBAYCImplementationAddress) { console.log("deploy NTokenBAYC implementation"); diff --git a/tasks/dev/reserveConfigurator.ts b/tasks/dev/reserveConfigurator.ts index d045689c1..6aaebcc3a 100644 --- a/tasks/dev/reserveConfigurator.ts +++ b/tasks/dev/reserveConfigurator.ts @@ -4,9 +4,9 @@ import {DRY_RUN} from "../../helpers/hardhat-constants"; import {waitForTx} from "../../helpers/misc-utils"; task("set-ltv", "Set LTV") - .addPositionalParam("asset", "asset") + .addPositionalParam("assets", "assets") .addPositionalParam("ltv", "ltv") - .setAction(async ({asset, ltv}, DRE) => { + .setAction(async ({assets, ltv}, DRE) => { await DRE.run("set-DRE"); const {dryRunEncodedData} = await import("../../helpers/contracts-helpers"); const { @@ -19,40 +19,42 @@ task("set-ltv", "Set LTV") const configurator = await getPoolConfiguratorProxy(); const [reservesData] = await ui.getReservesData(provider.address); - const reserveData = reservesData.find( - (x) => x.underlyingAsset === utils.getAddress(asset) - ); - if (!reserveData) { - return; - } + for (const asset of assets.split(",")) { + const reserveData = reservesData.find( + (x) => x.underlyingAsset === utils.getAddress(asset) + ); + if (!reserveData) { + return; + } - const encodedData = configurator.interface.encodeFunctionData( - "configureReserveAsCollateral", - [ - reserveData.underlyingAsset, - ltv, - reserveData.reserveLiquidationThreshold, - reserveData.reserveLiquidationBonus, - ] - ); - if (DRY_RUN) { - await dryRunEncodedData(configurator.address, encodedData); - } else { - await waitForTx( - await configurator.configureReserveAsCollateral( + const encodedData = configurator.interface.encodeFunctionData( + "configureReserveAsCollateral", + [ reserveData.underlyingAsset, ltv, reserveData.reserveLiquidationThreshold, - reserveData.reserveLiquidationBonus - ) + reserveData.reserveLiquidationBonus, + ] ); + if (DRY_RUN) { + await dryRunEncodedData(configurator.address, encodedData); + } else { + await waitForTx( + await configurator.configureReserveAsCollateral( + reserveData.underlyingAsset, + ltv, + reserveData.reserveLiquidationThreshold, + reserveData.reserveLiquidationBonus + ) + ); + } } }); task("set-liquidation-threshold", "Set liquidation threshold") - .addPositionalParam("asset", "asset") + .addPositionalParam("assets", "assets") .addPositionalParam("liquidationThreshold", "liquidation threshold") - .setAction(async ({asset, liquidationThreshold}, DRE) => { + .setAction(async ({assets, liquidationThreshold}, DRE) => { await DRE.run("set-DRE"); const {dryRunEncodedData} = await import("../../helpers/contracts-helpers"); const { @@ -65,40 +67,42 @@ task("set-liquidation-threshold", "Set liquidation threshold") const configurator = await getPoolConfiguratorProxy(); const [reservesData] = await ui.getReservesData(provider.address); - const reserveData = reservesData.find( - (x) => x.underlyingAsset === utils.getAddress(asset) - ); - if (!reserveData) { - return; - } + for (const asset of assets.split(",")) { + const reserveData = reservesData.find( + (x) => x.underlyingAsset === utils.getAddress(asset) + ); + if (!reserveData) { + return; + } - const encodedData = configurator.interface.encodeFunctionData( - "configureReserveAsCollateral", - [ - reserveData.underlyingAsset, - reserveData.baseLTVasCollateral, - liquidationThreshold, - reserveData.reserveLiquidationBonus, - ] - ); - if (DRY_RUN) { - await dryRunEncodedData(configurator.address, encodedData); - } else { - await waitForTx( - await configurator.configureReserveAsCollateral( + const encodedData = configurator.interface.encodeFunctionData( + "configureReserveAsCollateral", + [ reserveData.underlyingAsset, reserveData.baseLTVasCollateral, liquidationThreshold, - reserveData.reserveLiquidationBonus - ) + reserveData.reserveLiquidationBonus, + ] ); + if (DRY_RUN) { + await dryRunEncodedData(configurator.address, encodedData); + } else { + await waitForTx( + await configurator.configureReserveAsCollateral( + reserveData.underlyingAsset, + reserveData.baseLTVasCollateral, + liquidationThreshold, + reserveData.reserveLiquidationBonus + ) + ); + } } }); task("set-reserve-factor", "Set reserve factor") - .addPositionalParam("asset", "asset") + .addPositionalParam("assets", "assets") .addPositionalParam("reserveFactor", "reserve factor") - .setAction(async ({asset, reserveFactor}, DRE) => { + .setAction(async ({assets, reserveFactor}, DRE) => { await DRE.run("set-DRE"); const {dryRunEncodedData} = await import("../../helpers/contracts-helpers"); const { @@ -111,26 +115,28 @@ task("set-reserve-factor", "Set reserve factor") const configurator = await getPoolConfiguratorProxy(); const [reservesData] = await ui.getReservesData(provider.address); - const reserveData = reservesData.find( - (x) => x.underlyingAsset === utils.getAddress(asset) - ); - if (!reserveData) { - return; - } + for (const asset of assets.split(",")) { + const reserveData = reservesData.find( + (x) => x.underlyingAsset === utils.getAddress(asset) + ); + if (!reserveData) { + return; + } - const encodedData = configurator.interface.encodeFunctionData( - "setReserveFactor", - [reserveData.underlyingAsset, reserveFactor] - ); - if (DRY_RUN) { - await dryRunEncodedData(configurator.address, encodedData); - } else { - await waitForTx( - await configurator.setReserveFactor( - reserveData.underlyingAsset, - reserveFactor - ) + const encodedData = configurator.interface.encodeFunctionData( + "setReserveFactor", + [reserveData.underlyingAsset, reserveFactor] ); + if (DRY_RUN) { + await dryRunEncodedData(configurator.address, encodedData); + } else { + await waitForTx( + await configurator.setReserveFactor( + reserveData.underlyingAsset, + reserveFactor + ) + ); + } } }); @@ -216,6 +222,46 @@ task("set-auction-strategy", "Set auction strategy") } }); +task("set-timelock-strategy", "Set timelock strategy") + .addPositionalParam("assets", "assets") + .addPositionalParam("timeLockStrategyAddress", "time lock strategy address") + .setAction(async ({assets, timeLockStrategyAddress}, DRE) => { + await DRE.run("set-DRE"); + const {dryRunEncodedData} = await import("../../helpers/contracts-helpers"); + const { + getPoolConfiguratorProxy, + getPoolAddressesProvider, + getUiPoolDataProvider, + } = await import("../../helpers/contracts-getters"); + const ui = await getUiPoolDataProvider(); + const provider = await getPoolAddressesProvider(); + const configurator = await getPoolConfiguratorProxy(); + const [reservesData] = await ui.getReservesData(provider.address); + + for (const asset of assets.split(",")) { + const reserveData = reservesData.find( + (x) => x.underlyingAsset === utils.getAddress(asset) + ); + if (!reserveData) { + continue; + } + const encodedData = configurator.interface.encodeFunctionData( + "setReserveTimeLockStrategyAddress", + [reserveData.underlyingAsset, timeLockStrategyAddress] + ); + if (DRY_RUN) { + await dryRunEncodedData(configurator.address, encodedData); + } else { + await waitForTx( + await configurator.setReserveTimeLockStrategyAddress( + reserveData.underlyingAsset, + timeLockStrategyAddress + ) + ); + } + } + }); + task("set-supply-cap", "Set supply cap") .addPositionalParam("asset", "asset") .addPositionalParam("supplyCap", "new supply cap") diff --git a/yarn.lock b/yarn.lock index ee72519f1..e45cccd70 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1619,12 +1619,12 @@ __metadata: "@safe-global/safe-ethers-lib": ^1.7.0 "@safe-global/safe-service-client": ^1.5.0 "@tenderly/hardhat-tenderly": 1.1.0-beta.5 - "@typechain/ethers-v5": ^11.0.0 - "@typechain/hardhat": ^6.1.2 + "@typechain/ethers-v5": ^11.1.2 + "@typechain/hardhat": ^9.1.0 "@types/chai": ^4.2.11 "@types/lowdb": 1.0.9 "@types/mocha": ^9.1.1 - "@types/node": ^18.0.6 + "@types/node": ^20.9.2 "@typescript-eslint/eslint-plugin": 5.33.0 "@typescript-eslint/parser": 5.33.0 "@uniswap/v3-periphery": 1.4.1 @@ -1651,7 +1651,7 @@ __metadata: hardhat-contract-sizer: ^2.0.3 hardhat-deploy: ^0.11.30 hardhat-gas-reporter: ^1.0.9 - hardhat-typechain: ^0.3.3 + hardhat-typechain: ^0.3.5 husky: ^8.0.1 lodash: ^4.17.21 lowdb: 1.0.0 @@ -2061,9 +2061,9 @@ __metadata: languageName: node linkType: hard -"@typechain/ethers-v5@npm:^11.0.0": - version: 11.1.1 - resolution: "@typechain/ethers-v5@npm:11.1.1" +"@typechain/ethers-v5@npm:^11.1.2": + version: 11.1.2 + resolution: "@typechain/ethers-v5@npm:11.1.2" dependencies: lodash: ^4.17.15 ts-essentials: ^7.0.1 @@ -2071,9 +2071,9 @@ __metadata: "@ethersproject/abi": ^5.0.0 "@ethersproject/providers": ^5.0.0 ethers: ^5.1.3 - typechain: ^8.3.1 + typechain: ^8.3.2 typescript: ">=4.3.0" - checksum: af4f3198c4f76e38cf45f992482329b172e1c668f5a5c4743764ab5011d928cdc66a1feb9c02dba80a14fb3124bc37f39a6956f5323c0ac32f919e09cfb2a3b8 + checksum: 4f2d458306094c8e57bc0e05c86c1def210bd8b2cadd1062218cbc35fe3f6ac98aca08646c935a6fa5e57599be9fc0ddd2d4f7cf960fe28e27bf3ed58906c71f languageName: node linkType: hard @@ -2089,19 +2089,17 @@ __metadata: languageName: node linkType: hard -"@typechain/hardhat@npm:^6.1.2": - version: 6.1.6 - resolution: "@typechain/hardhat@npm:6.1.6" +"@typechain/hardhat@npm:^9.1.0": + version: 9.1.0 + resolution: "@typechain/hardhat@npm:9.1.0" dependencies: fs-extra: ^9.1.0 peerDependencies: - "@ethersproject/abi": ^5.4.7 - "@ethersproject/providers": ^5.4.7 - "@typechain/ethers-v5": ^10.2.1 - ethers: ^5.4.7 + "@typechain/ethers-v6": ^0.5.1 + ethers: ^6.1.0 hardhat: ^2.9.9 - typechain: ^8.1.1 - checksum: f214bebf7860956230478cb92696ba757829cfd9dc65ac99c3bc7e539378310318d92b009054186f446595c8ffc1a81e9c6d028da0eb04253253049ea1b6e8d3 + typechain: ^8.3.2 + checksum: a05998ce89bb4a297f233f4489e4af2a3ad0abcedd75392096745a378d7c5bab9650fcd5dd778c9deaf790bf16e3a849b3ed91a6ae916173df6dfc9e574efcbc languageName: node linkType: hard @@ -2298,10 +2296,12 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:^18.0.6": - version: 18.17.8 - resolution: "@types/node@npm:18.17.8" - checksum: ebb71526368c9c58f03e2c2408bfda4aa686c13d84226e2c9b48d9c4aee244fb82e672aaf4aa8ccb6e4993b4274d5f4b2b3d52d0a2e57ab187ae653903376411 +"@types/node@npm:^20.9.2": + version: 20.9.2 + resolution: "@types/node@npm:20.9.2" + dependencies: + undici-types: ~5.26.4 + checksum: 5bbb8fb2248fc5c5c4071d9809fb9af85997677c07124d65665202b53283a3b7bdff26fb844e9ee407e3847dfce6399c2b01e3329ea44a4b720647b1b987c678 languageName: node linkType: hard @@ -8515,7 +8515,7 @@ __metadata: languageName: node linkType: hard -"hardhat-typechain@npm:^0.3.3": +"hardhat-typechain@npm:^0.3.5": version: 0.3.5 resolution: "hardhat-typechain@npm:0.3.5" peerDependencies: @@ -15363,6 +15363,13 @@ __metadata: languageName: node linkType: hard +"undici-types@npm:~5.26.4": + version: 5.26.5 + resolution: "undici-types@npm:5.26.5" + checksum: 3192ef6f3fd5df652f2dc1cd782b49d6ff14dc98e5dced492aa8a8c65425227da5da6aafe22523c67f035a272c599bb89cfe803c1db6311e44bed3042fc25487 + languageName: node + linkType: hard + "undici@npm:^5.14.0": version: 5.23.0 resolution: "undici@npm:5.23.0"