mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
Support fork connection.
This commit is contained in:
parent
befb447148
commit
d9026b7122
|
@ -7,4 +7,3 @@ services:
|
||||||
environment:
|
environment:
|
||||||
- MNEMONIC
|
- MNEMONIC
|
||||||
- ALCHEMY_KEY
|
- ALCHEMY_KEY
|
||||||
- TENDERLY_FORK_ID
|
|
||||||
|
|
|
@ -20,3 +20,4 @@ services:
|
||||||
TENDERLY_USERNAME: ${TENDERLY_USERNAME}
|
TENDERLY_USERNAME: ${TENDERLY_USERNAME}
|
||||||
ALCHEMY_KEY: ${ALCHEMY_KEY}
|
ALCHEMY_KEY: ${ALCHEMY_KEY}
|
||||||
TENDERLY_FORK_ID: ${TENDERLY_FORK_ID}
|
TENDERLY_FORK_ID: ${TENDERLY_FORK_ID}
|
||||||
|
TENDERLY_HEAD_ID: ${TENDERLY_HEAD_ID}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { HardhatUserConfig } from 'hardhat/types';
|
||||||
import { accounts } from './test-wallets.js';
|
import { accounts } from './test-wallets.js';
|
||||||
import { eEthereumNetwork, eNetwork, ePolygonNetwork, eXDaiNetwork } from './helpers/types';
|
import { eEthereumNetwork, eNetwork, ePolygonNetwork, eXDaiNetwork } from './helpers/types';
|
||||||
import { BUIDLEREVM_CHAINID, COVERAGE_CHAINID } from './helpers/buidler-constants';
|
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();
|
require('dotenv').config();
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ const buidlerConfig: HardhatUserConfig = {
|
||||||
kovan: getCommonNetworkConfig(eEthereumNetwork.kovan, 42),
|
kovan: getCommonNetworkConfig(eEthereumNetwork.kovan, 42),
|
||||||
ropsten: getCommonNetworkConfig(eEthereumNetwork.ropsten, 3),
|
ropsten: getCommonNetworkConfig(eEthereumNetwork.ropsten, 3),
|
||||||
main: getCommonNetworkConfig(eEthereumNetwork.main, 1),
|
main: getCommonNetworkConfig(eEthereumNetwork.main, 1),
|
||||||
tenderlyMain: getCommonNetworkConfig(eEthereumNetwork.main, 1),
|
tenderlyMain: getCommonNetworkConfig(eEthereumNetwork.tenderlyMain, 3030),
|
||||||
matic: getCommonNetworkConfig(ePolygonNetwork.matic, 137),
|
matic: getCommonNetworkConfig(ePolygonNetwork.matic, 137),
|
||||||
mumbai: getCommonNetworkConfig(ePolygonNetwork.mumbai, 80001),
|
mumbai: getCommonNetworkConfig(ePolygonNetwork.mumbai, 80001),
|
||||||
xdai: getCommonNetworkConfig(eXDaiNetwork.xdai, 100),
|
xdai: getCommonNetworkConfig(eXDaiNetwork.xdai, 100),
|
||||||
|
|
|
@ -89,7 +89,7 @@
|
||||||
"@nomiclabs/hardhat-ethers": "^2.0.0",
|
"@nomiclabs/hardhat-ethers": "^2.0.0",
|
||||||
"@nomiclabs/hardhat-waffle": "^2.0.0",
|
"@nomiclabs/hardhat-waffle": "^2.0.0",
|
||||||
"@openzeppelin/contracts": "3.1.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-v4": "1.0.0",
|
||||||
"@typechain/ethers-v5": "^2.0.0",
|
"@typechain/ethers-v5": "^2.0.0",
|
||||||
"@typechain/truffle-v4": "2.0.2",
|
"@typechain/truffle-v4": "2.0.2",
|
||||||
|
|
|
@ -46,7 +46,10 @@ task('aave:mainnet', 'Deploy development enviroment')
|
||||||
|
|
||||||
if (usingTenderly()) {
|
if (usingTenderly()) {
|
||||||
const postDeployHead = DRE.tenderlyRPC.getHead();
|
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');
|
console.log('\nFinished migrations');
|
||||||
printContracts();
|
printContracts();
|
||||||
|
|
|
@ -46,7 +46,10 @@ task('amm:mainnet', 'Deploy development enviroment')
|
||||||
|
|
||||||
if (usingTenderly()) {
|
if (usingTenderly()) {
|
||||||
const postDeployHead = DRE.tenderlyRPC.getHead();
|
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');
|
console.log('\nFinished migrations');
|
||||||
printContracts();
|
printContracts();
|
||||||
|
|
|
@ -21,7 +21,7 @@ task('matic:mainnet', 'Deploy development enviroment')
|
||||||
await DRE.run('full:deploy-address-provider', { pool: POOL_NAME });
|
await DRE.run('full:deploy-address-provider', { pool: POOL_NAME });
|
||||||
|
|
||||||
console.log('2. Deploy lending pool');
|
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');
|
console.log('3. Deploy oracles');
|
||||||
await DRE.run('full:deploy-oracles', { pool: POOL_NAME });
|
await DRE.run('full:deploy-oracles', { pool: POOL_NAME });
|
||||||
|
@ -43,7 +43,10 @@ task('matic:mainnet', 'Deploy development enviroment')
|
||||||
|
|
||||||
if (usingTenderly()) {
|
if (usingTenderly()) {
|
||||||
const postDeployHead = DRE.tenderlyRPC.getHead();
|
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');
|
console.log('\nFinished migrations');
|
||||||
printContracts();
|
printContracts();
|
||||||
|
|
|
@ -3,6 +3,8 @@ import { DRE, setDRE } from '../../helpers/misc-utils';
|
||||||
import { EthereumNetworkNames } from '../../helpers/types';
|
import { EthereumNetworkNames } from '../../helpers/types';
|
||||||
import { usingTenderly } from '../../helpers/tenderly-utils';
|
import { usingTenderly } from '../../helpers/tenderly-utils';
|
||||||
import { HardhatRuntimeEnvironment } from 'hardhat/types';
|
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(
|
task(`set-DRE`, `Inits the DRE, to have access to all the plugins' objects`).setAction(
|
||||||
async (_, _DRE) => {
|
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'
|
process.env.TENDERLY === 'true'
|
||||||
) {
|
) {
|
||||||
console.log('- Setting up Tenderly provider');
|
console.log('- Setting up Tenderly provider');
|
||||||
await _DRE.tenderlyRPC.initializeFork();
|
if (process.env.TENDERLY_FORK_ID && process.env.TENDERLY_HEAD_ID) {
|
||||||
console.log('- Initialized Tenderly fork');
|
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);
|
const provider = new _DRE.ethers.providers.Web3Provider(_DRE.tenderlyRPC as any);
|
||||||
_DRE.ethers.provider = provider;
|
_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);
|
setDRE(_DRE);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user