aave / aave-v3-deploy Goto Github PK
View Code? Open in Web Editor NEWLicense: Other
License: Other
It seems goerli
is the convention.
Adjust scripts for aave/aave-v3-periphery#123 changes
Install new version of paraswap adapters (aave/aave-v3-periphery#176)
When deploying L2 such as arbitrum-goerli running deploy fails. When trying to deploy again it will fail saying it has already been initialized.
Error: ERROR processing /Users/code/aave/deploy-v3/deploy/02_market/01b_l2_pool_implementation.ts:
Error: cannot estimate gas; transaction may fail or may require manual gas limit [ See: https://links.ethers.org/v5-errors-UNPREDICTABLE_GAS_LIMIT ] (reason="execution reverted: Contract instance has already been initialized", method="estimateGas", transaction={"from":"0xfA0e305E0f46AB04f00ae6b5f4560d61a2183E00","to":"0x48424f2779be0f03cDF6F02E17A591A9BF7AF89f","data":"0xc4d66de8000000000000000000000000b1effe2ecd929ef28ebb7897233b26a1a9b42bff","accessList":null}, error={"name":"ProviderError","_stack":"ProviderError: HttpProviderError\n at HttpProvid
``
Commenting out
// const pool = await getPool(poolArtifact.address);
// await waitForTx(await pool.initialize(addressesProviderAddress));
// console.log("Initialized L2Pool Implementation");
will make it work - need to investigate why it fails on the first attempt
Added here
npm ERR! notsup Required: {"node":"^14.0.0 || ^16.0.0 || ^18.0.0"}
npm ERR! notsup Actual: {"npm":"10.2.3","node":"v20.10.0"}
Node version of 20 is not supported
There seems to be a typing error in helpers/index.ts, line 17.
I believe the correct path is "../tasks/market-registry/market-registry_add"
instead of "../tasks/market-registry/market-registry:add"
. Changing this allowed me to continue with building.
The corresponding pull request is #48.
I would like to include aave-v3-deploy in my project in order to integrate with the aave-v3 contracts.
I followed the steps in the README: How to integrate in your Hardhat project
Reproduction steps
------------
bash
------------
mkdir test-ts
cd test-ts/
npm init
npx hardhat init
✔ What do you want to do? · Create a TypeScript project
✔ Hardhat project root: · /Users/john/dev/github/temp/test-ts
✔ Do you want to add a .gitignore? (Y/n) · y
✔ Do you want to install this sample project's dependencies with npm (hardhat @nomicfoundation/hardhat-toolbox)? (Y/n) · n
-------------
.env
-------------
# Name of the Market to deploy. If you want to deploy a custom market, it must be included at `loadPoolConfig` function at ./helpers/market-config-helpers.ts:65
MARKET_NAME=Aave
# Alchemy RPC api key
ALCHEMY_KEY="Valid Key"
# Seed phrase
MNEMONIC="Valid Mnemonic"
# Etherscan API key to verify contracts
ETHERSCAN_KEY=
# Toggle Permissioned Faucet
PERMISSIONED_FAUCET=false
--------------
#package.json
--------------
{
"name": "test-ts",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"@aave/deploy-v3": "^1.55.3",
"@aave/core-v3": "^1.19.0",
"@aave/periphery-v3": "^2.4.1",
"@nomicfoundation/hardhat-toolbox": "^2.0.0",
"hardhat": "^2.17.0",
"hardhat-deploy": "^0.11.34"
},
"dependencies": {
"bluebird": "^3.7.2",
"dotenv": "^16.3.1",
"ethers": "^5.7.2",
"jsondiffpatch": "^0.4.1"
}
}
--------------
hardhat.config.ts
--------------
import dotenv from "dotenv";
dotenv.config();
import { HardhatUserConfig } from "hardhat/config";
import "@nomicfoundation/hardhat-toolbox";
import "hardhat-deploy";
import { DEFAULT_NAMED_ACCOUNTS, hardhatNetworkSettings } from "@aave/deploy-v3";
const autoOrNumberOrUndefined = (value?: "auto" | string | number) => {
if (value === undefined) return value;
if (value === "auto") return value;
if (typeof value === "number") return value;
return parseFloat(value);
}
const numberOrUndefined = (value?: string | number) => {
if (value === undefined) return value;
if (typeof value === "number") return value;
return parseFloat(value);
}
const config: HardhatUserConfig = {
solidity: "0.8.18",
networks: {
hardhat: {
...hardhatNetworkSettings,
gasPrice: autoOrNumberOrUndefined(hardhatNetworkSettings.gasPrice),
initialBaseFeePerGas: numberOrUndefined(hardhatNetworkSettings.initialBaseFeePerGas),
},
},
namedAccounts: {
...DEFAULT_NAMED_ACCOUNTS
},
external: {
contracts: [
{
artifacts: "node_modules/@aave/deploy-v3/artifacts",
deploy: "node_modules/@aave/deploy-v3/dist/deploy"
}
]
}
};
export default config;
--------------
bash
--------------
npm i
npx hardhat deploy
# you eventually get this error:
=== Post deployment hook ===
- Enable stable borrow in selected assets
- Checking reserve DAI , normalized symbol DAI
- Reserve DAI Borrow Stable Rate follows the expected configuration
- Checking reserve LINK , normalized symbol LINK
- Reserve LINK Borrow Stable Rate follows the expected configuration
- Checking reserve USDC , normalized symbol USDC
- Reserve USDC Borrow Stable Rate follows the expected configuration
- Checking reserve WBTC , normalized symbol WBTC
- Reserve WBTC Borrow Stable Rate follows the expected configuration
- Checking reserve WETH , normalized symbol WETH
- Reserve WETH Borrow Stable Rate follows the expected configuration
- Checking reserve USDT , normalized symbol USDT
- Reserve USDT Borrow Stable Rate follows the expected configuration
- Checking reserve AAVE , normalized symbol AAVE
- Reserve AAVE Borrow Stable Rate follows the expected configuration
- Checking reserve EURS , normalized symbol EURS
- Reserve EURS Borrow Stable Rate follows the expected configuration
- Review rate strategies
- Checking reserve DAI , normalized symbol DAI
An unexpected error occurred:
Error: ERROR processing /Users/john/dev/github/temp/test-ts/node_modules/@aave/deploy-v3/dist/deploy/01-after-deploy.js:
HardhatError: HH700: Artifact for contract "DefaultReserveInterestRateStrategy" not found.
at Artifacts._handleWrongArtifactForContractName (/Users/john/dev/github/temp/test-ts/node_modules/hardhat/src/internal/artifacts.ts:700:11)
at Artifacts._getArtifactPathFromFiles (/Users/john/dev/github/temp/test-ts/node_modules/hardhat/src/internal/artifacts.ts:825:19)
at Artifacts._getArtifactPath (/Users/john/dev/github/temp/test-ts/node_modules/hardhat/src/internal/artifacts.ts:505:21)
at async Artifacts.readArtifact (/Users/john/dev/github/temp/test-ts/node_modules/hardhat/src/internal/artifacts.ts:71:26)
at async getContractAt (/Users/john/dev/github/temp/test-ts/node_modules/@nomiclabs/hardhat-ethers/src/internal/helpers.ts:303:22)
at async SimpleTaskDefinition.action (/Users/john/dev/github/temp/test-ts/node_modules/@aave/deploy-v3/dist/tasks/misc/review-rate-strategies.js:49:34)
at async Environment._runTaskDefinition (/Users/john/dev/github/temp/test-ts/node_modules/hardhat/src/internal/core/runtime-environment.ts:333:14)
at async Object.Environment.run (/Users/john/dev/github/temp/test-ts/node_modules/hardhat/src/internal/core/runtime-environment.ts:166:14)
at async Object.func (/Users/john/dev/github/temp/test-ts/node_modules/@aave/deploy-v3/dist/deploy/01-after-deploy.js:15:5)
at async DeploymentsManager.executeDeployScripts (/Users/john/dev/github/temp/test-ts/node_modules/hardhat-deploy/src/DeploymentsManager.ts:1226:22)
at async DeploymentsManager.runDeploy (/Users/john/dev/github/temp/test-ts/node_modules/hardhat-deploy/src/DeploymentsManager.ts:1049:13)
at async SimpleTaskDefinition.action (/Users/john/dev/github/temp/test-ts/node_modules/hardhat-deploy/src/index.ts:438:5)
at async Environment._runTaskDefinition (/Users/john/dev/github/temp/test-ts/node_modules/hardhat/src/internal/core/runtime-environment.ts:333:14)
at async Environment.run (/Users/john/dev/github/temp/test-ts/node_modules/hardhat/src/internal/core/runtime-environment.ts:166:14)
at async SimpleTaskDefinition.action (/Users/john/dev/github/temp/test-ts/node_modules/hardhat-deploy/src/index.ts:584:32)
at async Environment._runTaskDefinition (/Users/john/dev/github/temp/test-ts/node_modules/hardhat/src/internal/core/runtime-environment.ts:333:14)
at DeploymentsManager.executeDeployScripts (/Users/john/dev/github/temp/test-ts/node_modules/hardhat-deploy/src/DeploymentsManager.ts:1229:19)
at async DeploymentsManager.runDeploy (/Users/john/dev/github/temp/test-ts/node_modules/hardhat-deploy/src/DeploymentsManager.ts:1049:13)
at async SimpleTaskDefinition.action (/Users/john/dev/github/temp/test-ts/node_modules/hardhat-deploy/src/index.ts:438:5)
at async Environment._runTaskDefinition (/Users/john/dev/github/temp/test-ts/node_modules/hardhat/src/internal/core/runtime-environment.ts:333:14)
at async Environment.run (/Users/john/dev/github/temp/test-ts/node_modules/hardhat/src/internal/core/runtime-environment.ts:166:14)
at async SimpleTaskDefinition.action (/Users/john/dev/github/temp/test-ts/node_modules/hardhat-deploy/src/index.ts:584:32)
at async Environment._runTaskDefinition (/Users/john/dev/github/temp/test-ts/node_modules/hardhat/src/internal/core/runtime-environment.ts:333:14)
at async Environment.run (/Users/john/dev/github/temp/test-ts/node_modules/hardhat/src/internal/core/runtime-environment.ts:166:14)
at async SimpleTaskDefinition.action (/Users/john/dev/github/temp/test-ts/node_modules/hardhat-deploy/src/index.ts:669:5)
at async Environment._runTaskDefinition (/Users/john/dev/github/temp/test-ts/node_modules/hardhat/src/internal/core/runtime-environment.ts:333:14)
at async Environment.run (/Users/john/dev/github/temp/test-ts/node_modules/hardhat/src/internal/core/runtime-environment.ts:166:14)
at async main (/Users/john/dev/github/temp/test-ts/node_modules/hardhat/src/internal/cli/cli.ts:280:7)
I have tried many things but am unable to get past this.
Would appreciate any assistance
first of all you guys rock for putting this repo together. i am trying to deploy aave on an ethereum blockchain via ganache and here is how far i got. i have tried deploying this to a dockerized ganache instance and on my windows host and both give the same error. Many thanks for the assistance.:
[WARNING] Using latest deployed Treasury proxy instead of ReserveFactorTreasuryAddress from configuration file
[WARNING] Using deployed Testnet tokens instead of ReserveAssets from configuration file
Strategy address for asset DAI: 0xC0Be9B403FB1a5c44ba827Cea7065A2a5A2C909a
Strategy address for asset LINK: 0x244f3105E140fF0938D0B1B3B3C312cCc098383D
Strategy address for asset USDC: 0x3398bc7D3dc5A7E4818F88F8BFc82dBe40b03BD5
Strategy address for asset WBTC: 0x244f3105E140fF0938D0B1B3B3C312cCc098383D
Strategy address for asset WETH: 0x244f3105E140fF0938D0B1B3B3C312cCc098383D
Strategy address for asset USDT: 0x3398bc7D3dc5A7E4818F88F8BFc82dBe40b03BD5
Strategy address for asset AAVE: 0x244f3105E140fF0938D0B1B3B3C312cCc098383D
Strategy address for asset EURS: 0x3398bc7D3dc5A7E4818F88F8BFc82dBe40b03BD5
Error: ERROR processing /mnt/c/Users/quark/OneDrive - KRCMAR/Desktop/Programming/LeverNet/supporting_apps/aave/deploy/02_market/09_init_reserves.ts:
ProviderError: HttpProviderError
at HttpProvider.request (/mnt/c/Users/quark/OneDrive - KRCMAR/Desktop/Programming/LeverNet/supporting_apps/aave/node_modules/hardhat/src/internal/core/providers/http.ts:78:19)
at AutomaticSenderProvider.request (/mnt/c/Users/quark/OneDrive - KRCMAR/Desktop/Programming/LeverNet/supporting_apps/aave/node_modules/hardhat/src/internal/core/providers/accounts.ts:344:34)
import {
DETERMINISTIC_DEPLOYMENT,
DETERMINISTIC_FACTORIES,
ETHERSCAN_KEY,
getCommonNetworkConfig,
hardhatNetworkSettings,
loadTasks,
} from "./helpers/hardhat-config-helpers";
import {
eArbitrumNetwork,
eAvalancheNetwork,
eEthereumNetwork,
eFantomNetwork,
eHarmonyNetwork,
eOptimismNetwork,
ePolygonNetwork,
eTenderly,
} from "./helpers/types";
import { DEFAULT_NAMED_ACCOUNTS } from "./helpers/constants";
import "@nomicfoundation/hardhat-toolbox";
import "hardhat-deploy";
import "hardhat-contract-sizer";
import "hardhat-dependency-compiler";
import "@nomicfoundation/hardhat-chai-matchers";
const SKIP_LOAD = process.env.SKIP_LOAD === "true";
const TASK_FOLDERS = ["misc", "market-registry"];
// Prevent to load tasks before compilation and typechain
if (!SKIP_LOAD) {
loadTasks(TASK_FOLDERS);
}
export default {
contractSizer: {
alphaSort: true,
runOnCompile: false,
disambiguatePaths: false,
},
solidity: {
compilers: [
{
version: "0.8.10",
settings: {
optimizer: { enabled: true, runs: 100_000 },
evmVersion: "berlin",
},
},
{
version: "0.7.5",
settings: {
optimizer: { enabled: true, runs: 100_000 },
},
},
],
},
typechain: {
outDir: "typechain",
target: "ethers-v5",
},
networks: {
hardhat: hardhatNetworkSettings,
localhost: {
url: "http://192.168.0.11:7545",
...hardhatNetworkSettings,
},
tenderly: getCommonNetworkConfig("tenderly", 3030),
main: getCommonNetworkConfig(eEthereumNetwork.main, 1),
kovan: getCommonNetworkConfig(eEthereumNetwork.kovan, 42),
rinkeby: getCommonNetworkConfig(eEthereumNetwork.rinkeby, 4),
ropsten: getCommonNetworkConfig(eEthereumNetwork.ropsten, 3),
[ePolygonNetwork.polygon]: getCommonNetworkConfig(
ePolygonNetwork.polygon,
137
),
[ePolygonNetwork.mumbai]: getCommonNetworkConfig(
ePolygonNetwork.mumbai,
80001
),
arbitrum: getCommonNetworkConfig(eArbitrumNetwork.arbitrum, 42161),
[eArbitrumNetwork.arbitrumTestnet]: getCommonNetworkConfig(
eArbitrumNetwork.arbitrumTestnet,
421611
),
[eHarmonyNetwork.main]: getCommonNetworkConfig(
eHarmonyNetwork.main,
1666600000
),
[eHarmonyNetwork.testnet]: getCommonNetworkConfig(
eHarmonyNetwork.testnet,
1666700000
),
[eAvalancheNetwork.avalanche]: getCommonNetworkConfig(
eAvalancheNetwork.avalanche,
43114
),
[eAvalancheNetwork.fuji]: getCommonNetworkConfig(
eAvalancheNetwork.fuji,
43113
),
[eFantomNetwork.main]: getCommonNetworkConfig(eFantomNetwork.main, 250),
[eFantomNetwork.testnet]: getCommonNetworkConfig(
eFantomNetwork.testnet,
4002
),
[eOptimismNetwork.testnet]: getCommonNetworkConfig(
eOptimismNetwork.testnet,
420
),
[eOptimismNetwork.main]: getCommonNetworkConfig(eOptimismNetwork.main, 10),
[eEthereumNetwork.goerli]: getCommonNetworkConfig(
eEthereumNetwork.goerli,
5
),
[eEthereumNetwork.sepolia]: getCommonNetworkConfig(
eEthereumNetwork.sepolia,
11155111
),
[eArbitrumNetwork.goerliNitro]: getCommonNetworkConfig(
eArbitrumNetwork.goerliNitro,
421613
),
},
namedAccounts: {
...DEFAULT_NAMED_ACCOUNTS,
},
mocha: {
timeout: 0,
},
dependencyCompiler: {
paths: [
"@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/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",
],
},
deterministicDeployment: DETERMINISTIC_DEPLOYMENT
? DETERMINISTIC_FACTORIES
: undefined,
etherscan: {
apiKey: ETHERSCAN_KEY,
},
};
import fs from "fs";
import path from "path";
import { HardhatNetworkForkingUserConfig } from "hardhat/types";
import {
iParamsPerNetwork,
eEthereumNetwork,
eNetwork,
ePolygonNetwork,
eArbitrumNetwork,
eHarmonyNetwork,
eAvalancheNetwork,
eFantomNetwork,
eOptimismNetwork,
} from "./types";
require("dotenv").config();
export const DEFAULT_BLOCK_GAS_LIMIT = 12450000;
export const DEFAULT_GAS_PRICE = 8000000000;
export const INFURA_KEY = process.env.INFURA_KEY || "";
export const ALCHEMY_KEY = process.env.ALCHEMY_KEY || "";
export const TENDERLY_FORK_ID = process.env.TENDERLY_FORK_ID || "";
export const FORK = (process.env.FORK || "") as eNetwork;
export const FORK_BLOCK_NUMBER = process.env.FORK_BLOCK_NUMBER
? parseInt(process.env.FORK_BLOCK_NUMBER)
: 0;
const MNEMONIC_PATH = "m/44'/60'/0'/0";
const MNEMONIC = process.env.MNEMONIC || "";
export const getAlchemyKey = (net: eNetwork) => {
switch (net) {
case eEthereumNetwork.kovan:
return process.env.KOVAN_ALCHEMY_KEY || ALCHEMY_KEY;
case eEthereumNetwork.main:
return process.env.MAIN_ALCHEMY_KEY || ALCHEMY_KEY;
case eOptimismNetwork.main:
return process.env.OPTIMISM_ALCHEMY_KEY || ALCHEMY_KEY;
case eOptimismNetwork.testnet:
return process.env.KOVAN_OPTIMISM_ALCHEMY_KEY || ALCHEMY_KEY;
case eEthereumNetwork.rinkeby:
return process.env.RINKEBY_ALCHEMY_KEY || ALCHEMY_KEY;
case ePolygonNetwork.mumbai:
return process.env.POLYGON_MUMBAI_ALCHEMY_KEY || ALCHEMY_KEY;
case ePolygonNetwork.polygon:
return process.env.POLYGON_ALCHEMY_KEY || ALCHEMY_KEY;
case eEthereumNetwork.goerli:
return process.env.GOERLI_ALCHEMY_KEY || ALCHEMY_KEY;
case eEthereumNetwork.sepolia:
return process.env.SEPOLIA_ALCHEMY_KEY || ALCHEMY_KEY;
default:
return ALCHEMY_KEY;
}
};
export const NETWORKS_RPC_URL: iParamsPerNetwork = {
[eEthereumNetwork.kovan]: https://eth-kovan.alchemyapi.io/v2/${getAlchemyKey( eEthereumNetwork.kovan )}
,
[eEthereumNetwork.main]: https://eth-mainnet.alchemyapi.io/v2/${getAlchemyKey( eEthereumNetwork.main )}
,
[eEthereumNetwork.coverage]: "http://localhost:8555",
[eEthereumNetwork.hardhat]: "http://localhost:8545",
[ePolygonNetwork.mumbai]: https://polygon-mumbai.g.alchemy.com/v2/${getAlchemyKey( ePolygonNetwork.mumbai )}
,
[ePolygonNetwork.polygon]: https://polygon-mainnet.g.alchemy.com/v2/${getAlchemyKey( ePolygonNetwork.polygon )}
,
[eArbitrumNetwork.arbitrum]: https://arb1.arbitrum.io/rpc
,
[eArbitrumNetwork.arbitrumTestnet]: https://rinkeby.arbitrum.io/rpc
,
[eEthereumNetwork.rinkeby]: https://eth-rinkeby.alchemyapi.io/v2/${getAlchemyKey( eEthereumNetwork.rinkeby )}
,
[eEthereumNetwork.ropsten]: https://eth-ropsten.alchemyapi.io/v2/${getAlchemyKey( eEthereumNetwork.ropsten )}
,
[eHarmonyNetwork.main]: https://a.api.s0.t.hmny.io/
,
[eHarmonyNetwork.testnet]: https://api.s0.b.hmny.io
,
[eAvalancheNetwork.avalanche]: "https://api.avax.network/ext/bc/C/rpc",
[eAvalancheNetwork.fuji]: "https://api.avax-test.network/ext/bc/C/rpc",
[eFantomNetwork.main]: "https://rpc.ftm.tools/",
[eFantomNetwork.testnet]: "https://rpc.testnet.fantom.network/",
[eOptimismNetwork.testnet]: https://opt-goerli.g.alchemy.com/v2/demo
,
[eOptimismNetwork.main]: https://mainnet.optimism.io
,
tenderly: https://rpc.tenderly.co/fork/${TENDERLY_FORK_ID}
,
[eEthereumNetwork.goerli]: https://eth-goerli.alchemyapi.io/v2/${getAlchemyKey( eEthereumNetwork.goerli )}
,
[eEthereumNetwork.sepolia]: https://eth-sepolia.g.alchemy.com/v2/${getAlchemyKey( eEthereumNetwork.sepolia )}
,
[eArbitrumNetwork.goerliNitro]: https://goerli-rollup.arbitrum.io/rpc
,
};
export const LIVE_NETWORKS: iParamsPerNetwork = {
[eEthereumNetwork.main]: true,
[ePolygonNetwork.polygon]: true,
[eArbitrumNetwork.arbitrum]: true,
[eHarmonyNetwork.main]: true,
[eAvalancheNetwork.avalanche]: true,
[eFantomNetwork.main]: true,
[eOptimismNetwork.main]: true,
};
const GAS_PRICE_PER_NET: iParamsPerNetwork<string | number> = {
[eArbitrumNetwork.goerliNitro]: 100000001,
};
export const buildForkConfig = ():
| HardhatNetworkForkingUserConfig
| undefined => {
let forkMode: HardhatNetworkForkingUserConfig | undefined;
if (FORK && NETWORKS_RPC_URL[FORK]) {
forkMode = {
url: NETWORKS_RPC_URL[FORK] as string,
};
if (FORK_BLOCK_NUMBER) {
forkMode.blockNumber = FORK_BLOCK_NUMBER;
}
}
return forkMode;
};
export const loadTasks = (taskFolders: string[]): void =>
taskFolders.forEach((folder) => {
const tasksPath = path.join(__dirname, "../tasks", folder);
fs.readdirSync(tasksPath)
.filter((pth) => pth.includes(".ts") || pth.includes(".js"))
.forEach((task) => {
require(${tasksPath}/${task}
);
});
});
export const getCommonNetworkConfig = (
networkName: eNetwork,
chainId?: number
) => ({
url: NETWORKS_RPC_URL[networkName] || "",
blockGasLimit: DEFAULT_BLOCK_GAS_LIMIT,
chainId,
gasPrice: GAS_PRICE_PER_NET[networkName] || undefined,
...((!!MNEMONICS[networkName] || !!MNEMONIC) && {
accounts: {
mnemonic: MNEMONICS[networkName] || MNEMONIC,
path: MNEMONIC_PATH,
initialIndex: 0,
count: 10,
},
}),
live: LIVE_NETWORKS[networkName] || false,
});
const MNEMONICS: iParamsPerNetwork = {
[eAvalancheNetwork.fuji]: process.env.FUJI_MNEMONIC,
[eFantomNetwork.testnet]: process.env.FANTOM_MNEMONIC,
[eHarmonyNetwork.testnet]: process.env.HARMONY_MNEMONIC,
[eArbitrumNetwork.arbitrumTestnet]: process.env.ARBITRUM_MNEMONIC,
[ePolygonNetwork.mumbai]: process.env.POLYGON_MUMBAI_MNEMONIC,
[ePolygonNetwork.polygon]: process.env.POLYGON_MNEMONIC,
};
export const hardhatNetworkSettings = {
gasPrice: "auto",
initialBaseFeePerGas: "0",
blockGasLimit: DEFAULT_BLOCK_GAS_LIMIT,
throwOnTransactionFailures: true,
throwOnCallFailures: true,
chainId: 1337,
forking: buildForkConfig(),
saveDeployments: true,
allowUnlimitedContractSize: true,
tags: ["local"],
accounts:
FORK && !!MNEMONIC
? {
mnemonic: MNEMONIC,
path: MNEMONIC_PATH,
initialIndex: 0,
count: 10,
}
: undefined,
};
export const DETERMINISTIC_FACTORIES = {
"1": {
funding: "2500000000000000",
deployer: "0xAE0b890a625A87C23A1fccDEFb4C26A798719f17",
factory: "0x2401ae9bBeF67458362710f90302Eb52b5Ce835a",
signedTx:
"0xf8a5808505d21dba00830186a08080b853604580600e600039806000f350fe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf325a0efde12f74fb41030a44b3fd8df0f454770dfb43f6662ade8d2cfff27d33b7583a06d9897209d00096273b45caf45fd2b5f810f9532d6725833d7eeb330d906cee5",
},
"10": {
funding: "100000000000",
deployer: "0xAE0b890a625A87C23A1fccDEFb4C26A798719f17",
factory: "0x2401ae9bBeF67458362710f90302Eb52b5Ce835a",
signedTx:
"0xf8a380830f4240830186a08080b853604580600e600039806000f350fe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf337a06b48dc85053031af9928fefeb04df16535baf75bf329dcde39b0626de9334891a0319974b3e9f246138213887ffbdf06fa5e6210696055cafe7f4e2811d9850ad8",
},
"137": {
funding: "7000000000000000",
deployer: "0xAE0b890a625A87C23A1fccDEFb4C26A798719f17",
factory: "0x2401ae9bBeF67458362710f90302Eb52b5Ce835a",
signedTx:
"0xf8a78085104c533c00830186a08080b853604580600e600039806000f350fe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf3820135a0b930ddeea99c27453b75662cc1d0ca48024d3ba2f430b0bb2a072b41c6e9be18a01983c4ca8005197daa1664cc2111267e1c2898ec830055f0c8031b669beabb75",
},
"250": {
funding: "150000000000000000",
deployer: "0xAE0b890a625A87C23A1fccDEFb4C26A798719f17",
factory: "0x2401ae9bBeF67458362710f90302Eb52b5Ce835a",
signedTx:
"0xf8a88086015d3ef79800830186a08080b853604580600e600039806000f350fe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf3820217a0ca245f126ca3c4052a76c4a562d96f5290bfbe07dc110d1a072907bada8cda17a014a9d1fa421f5f7d4c51c01f11538a2dd641fa48dbb2b1eb3ca11a446a990c1e",
},
"31337": {
funding: "100000000000000",
deployer: "0xAE0b890a625A87C23A1fccDEFb4C26A798719f17",
factory: "0x2401ae9bBeF67458362710f90302Eb52b5Ce835a",
signedTx:
"0xf8a680843b9aca00830186a08080b853604580600e600039806000f350fe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf382f4f6a0a306cd60a84b884af0d1040e7f00e694fba8e3d250d978422b8a3dccd40886b1a03a35469d022c4612457e7dc583cbaf698aa82d2e624e43e51deb2a3cb4612df1",
},
"42161": {
funding: "1000000000000000",
deployer: "0xAE0b890a625A87C23A1fccDEFb4C26A798719f17",
factory: "0x2401ae9bBeF67458362710f90302Eb52b5Ce835a",
signedTx:
"0xf8a780843b9aca00830f42408080b853604580600e600039806000f350fe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf383014986a0a5e077f50f504d7f7b0770794dcab9f6cc0aac35923e612029b635d64b4d1d11a06e3b5b0e20f0b1478d53c7e9cb961787d4ca96a9d1b973c9b8424163c2ba66b9",
},
"43114": {
funding: "3500000000000000",
deployer: "0xAE0b890a625A87C23A1fccDEFb4C26A798719f17",
factory: "0x2401ae9bBeF67458362710f90302Eb52b5Ce835a",
signedTx:
"0xf8a880850826299e00830186a08080b853604580600e600039806000f350fe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf3830150f8a02fb12e72c3e25d707bc13df978921914d1e603da746d9251d65fa6e7457b15aaa06993c43ab3f581882dc5849489f6232c40c47210320e31f54263989f9e6ab180",
},
"1666600000": {
funding: "3000000000000000",
deployer: "0xAE0b890a625A87C23A1fccDEFb4C26A798719f17",
factory: "0x2401ae9bBeF67458362710f90302Eb52b5Ce835a",
signedTx:
"0xf8a9808506fc23ac00830186a08080b853604580600e600039806000f350fe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf384c6ac98a3a04ccc5a1ad667b68cdf1b43b3a5b82a25df1a4ac3c8fbac09950f888174c422bda0746ee83b93a6d1663b17829e4b817e92108985d0f58f781bcda7acdbe7b6b079",
},
};
export const DETERMINISTIC_DEPLOYMENT = process.env.DETERMINISTIC_DEPLOYMENT
? process.env.DETERMINISTIC_DEPLOYMENT === "true"
: null;
export const ETHERSCAN_KEY = process.env.ETHERSCAN_KEY || "";
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.