From 8221d44caed3ebc69611aa11b28d4c6fcc6090d1 Mon Sep 17 00:00:00 2001 From: David K Date: Wed, 15 Mar 2023 21:26:24 +0100 Subject: [PATCH] fix: Add metadata field to deployment artifacts (#309) * fix: keep metadata field at deployment artifacts via using the correct build-info path * chore: lint package.json * chore: remove the need to merge artifacts, and use hardhat dependency compiler for better integration without --no-compile flags * chore: lint --- hardhat.config.ts | 59 +++++++++++++++++++++++++++++++++++++++++++---- package-lock.json | 15 ++++++------ package.json | 6 ++--- setup-test-env.sh | 35 ++-------------------------- 4 files changed, 67 insertions(+), 48 deletions(-) diff --git a/hardhat.config.ts b/hardhat.config.ts index e6f0281e..238a2730 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -78,7 +78,6 @@ const hardhatConfig: HardhatUserConfig = { outDir: 'types', target: 'ethers-v5', alwaysGenerateOverloads: false, // should overloads with full signatures like deposit(uint256) be generated always, even if there are no overloads? - externalArtifacts: [], // optional array of glob patterns with external artifacts to process (for example external libs from node_modules) }, gasReporter: { enabled: process.env.REPORT_GAS ? true : false, @@ -90,27 +89,77 @@ const hardhatConfig: HardhatUserConfig = { external: { contracts: [ { - artifacts: './temp-artifacts', + artifacts: './artifacts', deploy: 'node_modules/@aave/deploy-v3/dist/deploy', }, ], }, dependencyCompiler: { paths: [ - '@aave/core-v3/contracts/dependencies/chainlink/AggregatorInterface', + '@aave/core-v3/contracts/protocol/configuration/PoolAddressesProviderRegistry.sol', + '@aave/core-v3/contracts/protocol/configuration/PoolAddressesProvider.sol', '@aave/core-v3/contracts/misc/AaveOracle.sol', - '@aave/core-v3/contracts/protocol/configuration/ACLManager.sol', - '@aave/core-v3/contracts/protocol/libraries/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy', '@aave/core-v3/contracts/protocol/tokenization/AToken.sol', + '@aave/core-v3/contracts/protocol/tokenization/DelegationAwareAToken.sol', '@aave/core-v3/contracts/protocol/tokenization/StableDebtToken.sol', '@aave/core-v3/contracts/protocol/tokenization/VariableDebtToken.sol', + '@aave/core-v3/contracts/protocol/libraries/logic/GenericLogic.sol', + '@aave/core-v3/contracts/protocol/libraries/logic/ValidationLogic.sol', + '@aave/core-v3/contracts/protocol/libraries/logic/ReserveLogic.sol', + '@aave/core-v3/contracts/protocol/libraries/logic/SupplyLogic.sol', + '@aave/core-v3/contracts/protocol/libraries/logic/EModeLogic.sol', + '@aave/core-v3/contracts/protocol/libraries/logic/BorrowLogic.sol', + '@aave/core-v3/contracts/protocol/libraries/logic/BridgeLogic.sol', + '@aave/core-v3/contracts/protocol/libraries/logic/FlashLoanLogic.sol', + '@aave/core-v3/contracts/protocol/libraries/logic/CalldataLogic.sol', '@aave/core-v3/contracts/protocol/pool/Pool.sol', + '@aave/core-v3/contracts/protocol/pool/L2Pool.sol', '@aave/core-v3/contracts/protocol/pool/PoolConfigurator.sol', + '@aave/core-v3/contracts/protocol/pool/DefaultReserveInterestRateStrategy.sol', + '@aave/core-v3/contracts/protocol/libraries/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol', + '@aave/core-v3/contracts/dependencies/openzeppelin/upgradeability/InitializableAdminUpgradeabilityProxy.sol', + '@aave/core-v3/contracts/deployments/ReservesSetupHelper.sol', '@aave/core-v3/contracts/misc/AaveProtocolDataProvider.sol', + '@aave/core-v3/contracts/misc/L2Encoder.sol', + '@aave/core-v3/contracts/protocol/configuration/ACLManager.sol', + '@aave/core-v3/contracts/dependencies/weth/WETH9.sol', + '@aave/core-v3/contracts/mocks/helpers/MockIncentivesController.sol', + '@aave/core-v3/contracts/mocks/helpers/MockReserveConfiguration.sol', '@aave/core-v3/contracts/mocks/oracle/CLAggregators/MockAggregator.sol', '@aave/core-v3/contracts/mocks/tokens/MintableERC20.sol', + '@aave/core-v3/contracts/mocks/flashloan/MockFlashLoanReceiver.sol', + '@aave/core-v3/contracts/mocks/tokens/WETH9Mocked.sol', + '@aave/core-v3/contracts/mocks/upgradeability/MockVariableDebtToken.sol', + '@aave/core-v3/contracts/mocks/upgradeability/MockAToken.sol', + '@aave/core-v3/contracts/mocks/upgradeability/MockStableDebtToken.sol', + '@aave/core-v3/contracts/mocks/upgradeability/MockInitializableImplementation.sol', + '@aave/core-v3/contracts/mocks/helpers/MockPool.sol', + '@aave/core-v3/contracts/mocks/helpers/MockL2Pool.sol', + '@aave/core-v3/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol', + '@aave/core-v3/contracts/dependencies/openzeppelin/contracts/IERC20.sol', '@aave/core-v3/contracts/mocks/oracle/PriceOracle.sol', '@aave/core-v3/contracts/mocks/tokens/MintableDelegationERC20.sol', + '@aave/periphery-v3/contracts/misc/UiPoolDataProviderV3.sol', + '@aave/periphery-v3/contracts/misc/WalletBalanceProvider.sol', + '@aave/periphery-v3/contracts/misc/WrappedTokenGatewayV3.sol', + '@aave/periphery-v3/contracts/misc/interfaces/IWETH.sol', + '@aave/periphery-v3/contracts/misc/UiIncentiveDataProviderV3.sol', + '@aave/periphery-v3/contracts/rewards/RewardsController.sol', + '@aave/periphery-v3/contracts/rewards/transfer-strategies/StakedTokenTransferStrategy.sol', + '@aave/periphery-v3/contracts/rewards/transfer-strategies/PullRewardsTransferStrategy.sol', + '@aave/periphery-v3/contracts/rewards/EmissionManager.sol', + '@aave/periphery-v3/contracts/mocks/WETH9Mock.sol', + '@aave/periphery-v3/contracts/mocks/testnet-helpers/Faucet.sol', + '@aave/periphery-v3/contracts/mocks/testnet-helpers/TestnetERC20.sol', + '@aave/periphery-v3/contracts/treasury/Collector.sol', + '@aave/periphery-v3/contracts/treasury/CollectorController.sol', + '@aave/periphery-v3/contracts/treasury/AaveEcosystemReserveV2.sol', + '@aave/periphery-v3/contracts/treasury/AaveEcosystemReserveController.sol', + '@aave/periphery-v3/contracts/adapters/paraswap/ParaSwapLiquiditySwapAdapter.sol', + '@aave/periphery-v3/contracts/adapters/paraswap/ParaSwapRepayAdapter.sol', + '@aave/safety-module/contracts/stake/StakedAave.sol', + '@aave/safety-module/contracts/stake/StakedAaveV2.sol', + '@aave/safety-module/contracts/proposals/extend-stkaave-distribution/StakedTokenV2Rev3.sol', ], }, tracer: { diff --git a/package-lock.json b/package-lock.json index 12c62cba..b0ef2eb4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,11 +5,12 @@ "packages": { "": { "name": "@aave/gho", + "license": "MIT", "dependencies": { "@aave/aave-token": "^1.0.4", "@aave/core-v3": "^1.17.2", "@aave/deploy-v3": "^1.55.3", - "@aave/periphery-v3": "^2.0.0", + "@aave/periphery-v3": "^2.0.1", "@aave/safety-module": "^1.0.3", "@openzeppelin/contracts": "^4.5.0" }, @@ -79,9 +80,9 @@ } }, "node_modules/@aave/periphery-v3": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@aave/periphery-v3/-/periphery-v3-2.0.0.tgz", - "integrity": "sha512-OhPSQdTIhPtU3chLjN07xayhHIifF0Q7AmN7MFl7SGX+ZmAX+L1nG4fpQyOJrd9OsfBext9hR5f7ZyF1ce+DRw==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@aave/periphery-v3/-/periphery-v3-2.0.1.tgz", + "integrity": "sha512-7vOo0jFFD/zG+zosmX9fwBTE0M77R9O6Bwer/CIBxwwcvZaAuQUU9ego/mJdNVuuofQPr9cfDfRMzoc0p3OSTQ==", "dependencies": { "@aave/core-v3": "1.17.0" } @@ -10542,9 +10543,9 @@ } }, "@aave/periphery-v3": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@aave/periphery-v3/-/periphery-v3-2.0.0.tgz", - "integrity": "sha512-OhPSQdTIhPtU3chLjN07xayhHIifF0Q7AmN7MFl7SGX+ZmAX+L1nG4fpQyOJrd9OsfBext9hR5f7ZyF1ce+DRw==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@aave/periphery-v3/-/periphery-v3-2.0.1.tgz", + "integrity": "sha512-7vOo0jFFD/zG+zosmX9fwBTE0M77R9O6Bwer/CIBxwwcvZaAuQUU9ego/mJdNVuuofQPr9cfDfRMzoc0p3OSTQ==", "requires": { "@aave/core-v3": "1.17.0" }, diff --git a/package.json b/package.json index 6720fa77..367dab8d 100644 --- a/package.json +++ b/package.json @@ -25,8 +25,8 @@ "prepare": "husky install", "compile": "rm -rf ./artifacts ./cache ./types && SKIP_LOAD=true hardhat compile", "test": ". ./setup-test-env.sh && hardhat test ./src/test/*.ts ./src/test/**/*.ts", - "test-goerli:fork": "FORK=goerli npm run test", - "test-goerli:fork:skip-deploy": "FORK=goerli SKIP_DEPLOY=true npm run test", + "test-goerli:fork": ". ./setup-test-env.sh && FORK=goerli npm run test --no-compile", + "test-goerli:fork:skip-deploy": ". ./setup-test-env.sh && FORK=goerli SKIP_DEPLOY=true npm run test", "test:stkAave": ". ./setup-test-env.sh && hardhat test ./src/test/__setup.test.ts ./src/test/stkAave-upgrade.test.ts", "test-unit": ". ./setup-test-env.sh && hardhat test ./src/test/unitTests/*.ts", "coverage": ". ./setup-test-env.sh && hardhat coverage", @@ -71,7 +71,7 @@ "@aave/aave-token": "^1.0.4", "@aave/core-v3": "^1.17.2", "@aave/deploy-v3": "^1.55.3", - "@aave/periphery-v3": "^2.0.0", + "@aave/periphery-v3": "^2.0.1", "@aave/safety-module": "^1.0.3", "@openzeppelin/contracts": "^4.5.0" }, diff --git a/setup-test-env.sh b/setup-test-env.sh index 6cedec55..305bbc28 100644 --- a/setup-test-env.sh +++ b/setup-test-env.sh @@ -2,15 +2,8 @@ #!/bin/bash # @dev -# This bash script setups the needed artifacts to use -# the @aave/deploy-v3 package as source of deployment -# scripts for testing or coverage purposes. -# -# A separate artifacts directory was created -# due at running tests all external artifacts -# located at /artifacts are deleted, causing -# the deploy library to not find the external -# artifacts. +# This bash script ensures a clean repository +# and loads environment variables for testing and deploying GHO source code. echo "[BASH] Setting up testnet enviroment" @@ -24,30 +17,6 @@ else echo "[BASH] Skipping compilation to keep coverage artifacts" fi -# Copy artifacts into separate directory to allow -# the hardhat-deploy library load all artifacts without duplicates -mkdir -p temp-artifacts -cp -r artifacts/@openzeppelin temp-artifacts/ -cp -r artifacts/build-info temp-artifacts/ -cp -r artifacts/src temp-artifacts/ - -# Import external @aave/safety-module artifacts -mkdir -p temp-artifacts/safety-module -cp -r 'node_modules/@aave/deploy-v3/artifacts/@aave/safety-module/contracts/stake' temp-artifacts/safety-module -cp -r 'node_modules/@aave/deploy-v3/artifacts/@aave/safety-module/contracts/proposals' temp-artifacts/safety-module - -# Import external @aave/periphery artifacts -mkdir -p temp-artifacts/periphery -cp -r node_modules/@aave/periphery-v3/artifacts/contracts/* temp-artifacts/periphery - -# Import external @aave/core artifacts -mkdir -p temp-artifacts/core-v3 -cp -r node_modules/@aave/core-v3/artifacts/contracts/* temp-artifacts/core-v3 - -# Import external @aave/deploy artifacts -mkdir -p temp-artifacts/deploy -cp -r node_modules/@aave/deploy-v3/artifacts/contracts/* temp-artifacts/deploy - # Export MARKET_NAME variable to use Aave market as testnet deployment setup export MARKET_NAME="Test"