fix: Fix @tenderly/hardhat-tenderly to 1.1.0-beta.5

This commit is contained in:
miguelmtzinf 2021-05-18 09:59:05 +02:00 committed by Hadrien Charlanes
parent 7da7c1a9ce
commit bf5762776a
2 changed files with 10 additions and 18 deletions

View File

@ -100,7 +100,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.4",
"@tenderly/hardhat-tenderly": "1.1.0-beta.5",
"@typechain/ethers-v4": "1.0.0",
"@typechain/ethers-v5": "^2.0.0",
"@typechain/truffle-v4": "2.0.2",

View File

@ -1,12 +1,6 @@
import { task } from 'hardhat/config';
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';
import { fork } from 'child_process';
import { env } from 'process';
task(`set-DRE`, `Inits the DRE, to have access to all the plugins' objects`).setAction(
async (_, _DRE) => {
@ -18,24 +12,21 @@ 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');
const net = _DRE.tenderly.network();
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);
await net.setFork(process.env.TENDERLY_FORK_ID);
await net.setHead(process.env.TENDERLY_HEAD_ID);
} else {
console.log('- Creating a new Tenderly Fork');
await _DRE.tenderlyRPC.initializeFork();
await net.initializeFork();
}
const provider = new _DRE.ethers.providers.Web3Provider(_DRE.tenderlyRPC as any);
const provider = new _DRE.ethers.providers.Web3Provider(net);
_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())
);
console.log(' - Fork: ', net.getFork());
console.log(' - Head: ', net.getHead());
}
console.log('- Enviroment');
@ -50,6 +41,7 @@ task(`set-DRE`, `Inits the DRE, to have access to all the plugins' objects`).set
}
}
console.log(' - Network :', _DRE.network.name);
setDRE(_DRE);
return _DRE;
}