Skip to content

Commit

Permalink
fix: Add metadata field to deployment artifacts (#309)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
kartojal authored Mar 15, 2023
1 parent 1cf882b commit 8221d44
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 48 deletions.
59 changes: 54 additions & 5 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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: {
Expand Down
15 changes: 8 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"
},
Expand Down
35 changes: 2 additions & 33 deletions setup-test-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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"

Expand Down

0 comments on commit 8221d44

Please sign in to comment.