mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
Fix README.md steps for mainnet fork. Added console fork mode. Fix infura subdomain in mainnet fork mode.
This commit is contained in:
parent
eea6d38f24
commit
43df62a9c9
32
README.md
32
README.md
|
@ -106,28 +106,34 @@ npm run aave:kovan:full:migration
|
||||||
|
|
||||||
### Mainnet fork deployment
|
### Mainnet fork deployment
|
||||||
|
|
||||||
You can deploy Aave Protocol v2 in a forked Mainnet chain using Hardhat built-in feature:
|
You can deploy Aave Protocol v2 in a forked Mainnet chain using Hardhat built-in fork feature:
|
||||||
|
|
||||||
```
|
```
|
||||||
# In one terminal, run a hardhat note with mainnet fork enabled
|
docker-compose run contracts-env npm run aave:fork:main
|
||||||
MAINNET_FORK=true npx hardhat node
|
```
|
||||||
|
|
||||||
# In another terminal, run docker-compose
|
### Mainnet fork - Interact with Aave via Hardhat console
|
||||||
docker-compose up
|
|
||||||
|
|
||||||
# Open another tab or terminal
|
You can also deploy Aave into the Hardhat console in fork mode, to interact with the protocol inside the fork or for testing purposes.
|
||||||
docker-compose exec contracts-env bash
|
|
||||||
|
|
||||||
# A new Bash terminal is prompted, connected to the container
|
```
|
||||||
npm run aave:fork:main
|
# Run the console in fork mode
|
||||||
|
docker-compose run contracts-env npm run console:fork
|
||||||
|
|
||||||
# Contracts are now deployed at Hardhat node with Mainnet fork.
|
# Deploy the Aave protocol in fork mode
|
||||||
|
await run('aave:mainnet')
|
||||||
|
|
||||||
# You can interact with them via Hardhat console
|
|
||||||
MAINNET_FORK=true npx hardhat console
|
|
||||||
# Or your custom Hardhat task
|
# Or your custom Hardhat task
|
||||||
MAINNET_FORK=true npx hardhat your-custom-task
|
await run('your-custom-task');
|
||||||
|
|
||||||
|
# After you initialize the Signers via 'set-DRE' task, you can import any TS/JS file
|
||||||
|
await run('set-DRE'); // Initialize signers
|
||||||
|
|
||||||
|
# Import contract getters to retrieve an Ethers.js Contract instance
|
||||||
|
const contractGetters = require('./helpers/contracts-getters'); // Import a TS/JS file
|
||||||
|
|
||||||
|
# Lending pool instance
|
||||||
|
const lendingPool = await contractGetters.getLendingPool("LendingPool address from 'aave:mainnet' task");
|
||||||
```
|
```
|
||||||
|
|
||||||
### Mainnet fork - Run the check list
|
### Mainnet fork - Run the check list
|
||||||
|
|
|
@ -40,12 +40,11 @@ if (!SKIP_LOAD) {
|
||||||
require(`${path.join(__dirname, 'tasks/misc')}/set-bre.ts`);
|
require(`${path.join(__dirname, 'tasks/misc')}/set-bre.ts`);
|
||||||
|
|
||||||
const getCommonNetworkConfig = (networkName: eEthereumNetwork, networkId: number) => {
|
const getCommonNetworkConfig = (networkName: eEthereumNetwork, networkId: number) => {
|
||||||
|
const net = networkName === 'main' ? 'mainnet' : networkName;
|
||||||
return {
|
return {
|
||||||
url: ALCHEMY_KEY
|
url: ALCHEMY_KEY
|
||||||
? `https://eth-${
|
? `https://eth-${net}.alchemyapi.io/v2/${ALCHEMY_KEY}`
|
||||||
networkName === 'main' ? 'mainnet' : networkName
|
: `https://${net}.infura.io/v3/${INFURA_KEY}`,
|
||||||
}.alchemyapi.io/v2/${ALCHEMY_KEY}`
|
|
||||||
: `https://${networkName}.infura.io/v3/${INFURA_KEY}`,
|
|
||||||
hardfork: HARDFORK,
|
hardfork: HARDFORK,
|
||||||
blockGasLimit: DEFAULT_BLOCK_GAS_LIMIT,
|
blockGasLimit: DEFAULT_BLOCK_GAS_LIMIT,
|
||||||
gasMultiplier: DEFAULT_GAS_MUL,
|
gasMultiplier: DEFAULT_GAS_MUL,
|
||||||
|
@ -65,7 +64,7 @@ const mainnetFork = MAINNET_FORK
|
||||||
blockNumber: 11366117,
|
blockNumber: 11366117,
|
||||||
url: ALCHEMY_KEY
|
url: ALCHEMY_KEY
|
||||||
? `https://eth-mainnet.alchemyapi.io/v2/${ALCHEMY_KEY}`
|
? `https://eth-mainnet.alchemyapi.io/v2/${ALCHEMY_KEY}`
|
||||||
: `https://main.infura.io/v3/${INFURA_KEY}`,
|
: `https://mainnet.infura.io/v3/${INFURA_KEY}`,
|
||||||
}
|
}
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
|
|
4750
package-lock.json
generated
4750
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
|
@ -11,6 +11,7 @@
|
||||||
"hardhat:main": "hardhat --network main",
|
"hardhat:main": "hardhat --network main",
|
||||||
"hardhat:docker": "hardhat --network hardhatevm_docker",
|
"hardhat:docker": "hardhat --network hardhatevm_docker",
|
||||||
"compile": "SKIP_LOAD=true hardhat compile",
|
"compile": "SKIP_LOAD=true hardhat compile",
|
||||||
|
"console:fork": "MAINNET_FORK=true hardhat console",
|
||||||
"test": "TS_NODE_TRANSPILE_ONLY=1 hardhat test ./test/*.spec.ts",
|
"test": "TS_NODE_TRANSPILE_ONLY=1 hardhat test ./test/*.spec.ts",
|
||||||
"test-scenarios": "npm run test -- test/__setup.spec.ts test/scenario.spec.ts",
|
"test-scenarios": "npm run test -- test/__setup.spec.ts test/scenario.spec.ts",
|
||||||
"test-repay-with-collateral": "hardhat test test/__setup.spec.ts test/repay-with-collateral.spec.ts",
|
"test-repay-with-collateral": "hardhat test test/__setup.spec.ts test/repay-with-collateral.spec.ts",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user