diff --git a/docker-compose.test.yml b/docker-compose.test.yml index ceb59e73..d71c1956 100644 --- a/docker-compose.test.yml +++ b/docker-compose.test.yml @@ -7,4 +7,3 @@ services: environment: - MNEMONIC - ALCHEMY_KEY - - TENDERLY_FORK_ID diff --git a/docker-compose.yml b/docker-compose.yml index 5500aac7..7c94bcb3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -20,3 +20,4 @@ services: TENDERLY_USERNAME: ${TENDERLY_USERNAME} ALCHEMY_KEY: ${ALCHEMY_KEY} TENDERLY_FORK_ID: ${TENDERLY_FORK_ID} + TENDERLY_HEAD_ID: ${TENDERLY_HEAD_ID} diff --git a/hardhat.config.ts b/hardhat.config.ts index 47c26680..0c6fa1e1 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -5,8 +5,8 @@ import { HardhatUserConfig } from 'hardhat/types'; import { accounts } from './test-wallets.js'; import { eEthereumNetwork, eNetwork, ePolygonNetwork, eXDaiNetwork } from './helpers/types'; import { BUIDLEREVM_CHAINID, COVERAGE_CHAINID } from './helpers/buidler-constants'; -import { NETWORKS_RPC_URL, NETWORKS_DEFAULT_GASĀ } from './helper-hardhat-config'; - +import { NETWORKS_RPC_URL, NETWORKS_DEFAULT_GAS } from './helper-hardhat-config'; + require('dotenv').config(); import '@nomiclabs/hardhat-ethers'; @@ -94,7 +94,7 @@ const buidlerConfig: HardhatUserConfig = { kovan: getCommonNetworkConfig(eEthereumNetwork.kovan, 42), ropsten: getCommonNetworkConfig(eEthereumNetwork.ropsten, 3), main: getCommonNetworkConfig(eEthereumNetwork.main, 1), - tenderlyMain: getCommonNetworkConfig(eEthereumNetwork.main, 1), + tenderlyMain: getCommonNetworkConfig(eEthereumNetwork.tenderlyMain, 3030), matic: getCommonNetworkConfig(ePolygonNetwork.matic, 137), mumbai: getCommonNetworkConfig(ePolygonNetwork.mumbai, 80001), xdai: getCommonNetworkConfig(eXDaiNetwork.xdai, 100), diff --git a/package.json b/package.json index c2214791..4532f6fa 100644 --- a/package.json +++ b/package.json @@ -89,7 +89,7 @@ "@nomiclabs/hardhat-ethers": "^2.0.0", "@nomiclabs/hardhat-waffle": "^2.0.0", "@openzeppelin/contracts": "3.1.0", - "@tenderly/hardhat-tenderly": "^1.1.0-beta.3", + "@tenderly/hardhat-tenderly": "^1.1.0-beta.4", "@typechain/ethers-v4": "1.0.0", "@typechain/ethers-v5": "^2.0.0", "@typechain/truffle-v4": "2.0.2", diff --git a/tasks/migrations/aave.mainnet.ts b/tasks/migrations/aave.mainnet.ts index 19649262..184f6e47 100644 --- a/tasks/migrations/aave.mainnet.ts +++ b/tasks/migrations/aave.mainnet.ts @@ -46,7 +46,10 @@ task('aave:mainnet', 'Deploy development enviroment') if (usingTenderly()) { const postDeployHead = DRE.tenderlyRPC.getHead(); - console.log('Tenderly UUID', postDeployHead); + const postDeployFork = DRE.tenderlyRPC.getFork(); + console.log('Tenderly Info'); + console.log('- Head', postDeployHead); + console.log('- Fork', postDeployFork); } console.log('\nFinished migrations'); printContracts(); diff --git a/tasks/migrations/amm.mainnet.ts b/tasks/migrations/amm.mainnet.ts index 3d0e6c8b..e496fc82 100644 --- a/tasks/migrations/amm.mainnet.ts +++ b/tasks/migrations/amm.mainnet.ts @@ -46,7 +46,10 @@ task('amm:mainnet', 'Deploy development enviroment') if (usingTenderly()) { const postDeployHead = DRE.tenderlyRPC.getHead(); - console.log('Tenderly UUID', postDeployHead); + const postDeployFork = DRE.tenderlyRPC.getFork(); + console.log('Tenderly Info'); + console.log('- Head', postDeployHead); + console.log('- Fork', postDeployFork); } console.log('\nFinished migrations'); printContracts(); diff --git a/tasks/migrations/matic.mainnet.ts b/tasks/migrations/matic.mainnet.ts index 970fbfc9..5c2f7f09 100644 --- a/tasks/migrations/matic.mainnet.ts +++ b/tasks/migrations/matic.mainnet.ts @@ -21,7 +21,7 @@ task('matic:mainnet', 'Deploy development enviroment') await DRE.run('full:deploy-address-provider', { pool: POOL_NAME }); console.log('2. Deploy lending pool'); - await DRE.run('full:deploy-lending-pool', { pool: POOL_NAME}); + await DRE.run('full:deploy-lending-pool', { pool: POOL_NAME }); console.log('3. Deploy oracles'); await DRE.run('full:deploy-oracles', { pool: POOL_NAME }); @@ -43,7 +43,10 @@ task('matic:mainnet', 'Deploy development enviroment') if (usingTenderly()) { const postDeployHead = DRE.tenderlyRPC.getHead(); - console.log('Tenderly UUID', postDeployHead); + const postDeployFork = DRE.tenderlyRPC.getFork(); + console.log('Tenderly Info'); + console.log('- Head', postDeployHead); + console.log('- Fork', postDeployFork); } console.log('\nFinished migrations'); printContracts(); diff --git a/tasks/misc/set-bre.ts b/tasks/misc/set-bre.ts index e2aeba12..63721451 100644 --- a/tasks/misc/set-bre.ts +++ b/tasks/misc/set-bre.ts @@ -3,6 +3,8 @@ import { DRE, setDRE } from '../../helpers/misc-utils'; import { EthereumNetworkNames } from '../../helpers/types'; import { usingTenderly } from '../../helpers/tenderly-utils'; import { HardhatRuntimeEnvironment } from 'hardhat/types'; +import { getFirstSigner } from '../../helpers/contracts-getters'; +import { formatEther } from 'ethers/lib/utils'; task(`set-DRE`, `Inits the DRE, to have access to all the plugins' objects`).setAction( async (_, _DRE) => { @@ -14,10 +16,24 @@ task(`set-DRE`, `Inits the DRE, to have access to all the plugins' objects`).set process.env.TENDERLY === 'true' ) { console.log('- Setting up Tenderly provider'); - await _DRE.tenderlyRPC.initializeFork(); - console.log('- Initialized Tenderly fork'); + if (process.env.TENDERLY_FORK_ID && process.env.TENDERLY_HEAD_ID) { + console.log('- Connecting to a Tenderly Fork'); + _DRE.tenderlyRPC.setFork(process.env.TENDERLY_FORK_ID); + _DRE.tenderlyRPC.setHead(process.env.TENDERLY_HEAD_ID); + } else { + console.log('- Creating a new Tenderly Fork'); + await _DRE.tenderlyRPC.initializeFork(); + } const provider = new _DRE.ethers.providers.Web3Provider(_DRE.tenderlyRPC as any); _DRE.ethers.provider = provider; + console.log('- Initialized Tenderly fork:'); + console.log(' - Fork: ', _DRE.tenderlyRPC.getFork()); + console.log(' - Head: ', _DRE.tenderlyRPC.getHead()); + console.log(' - First account:', await (await _DRE.ethers.getSigners())[0].getAddress()); + console.log( + ' - Balance:', + formatEther(await (await _DRE.ethers.getSigners())[0].getBalance()) + ); } setDRE(_DRE);