-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhardhat.config.ts
81 lines (71 loc) · 2.35 KB
/
hardhat.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import {HardhatUserConfig, task} from "hardhat/config";
import "@nomicfoundation/hardhat-toolbox";
import "@nomicfoundation/hardhat-ledger";
import "hardhat-gas-reporter"
import "hardhat-abi-exporter"
const RMX_PROD_CONTRACT_DEPLOYER = `0xF16F1201aECae83778458A39Af2605c9D0C61b1E`;
const config: HardhatUserConfig = {
solidity: {
version: "0.8.19",
settings: {
viaIR: true,
optimizer: {
enabled: true,
runs: 9000,
},
},
},
gasReporter: {
enabled: (process.env.REPORT_GAS) ? true : false,
currency: 'USD',
coinmarketcap: process.env.COINMARKETCAP_API_KEY,
token: 'MATIC',
gasPriceApi: 'https://api.polygonscan.com/api?module=proxy&action=eth_gasPrice'
},
networks: {
hardhat: {},
mumbai: {
url: "https://polygon-mumbai.blockpi.network/v1/rpc/public",
accounts: [
`0x${process.env.RMXHACKS_PRIVATE_KEY}`,
],
},
polygon: {
url: `https://polygon.llamarpc.com`,
ledgerAccounts: [
RMX_PROD_CONTRACT_DEPLOYER
],
}
},
abiExporter: {
path: './frontend/src/abi',
clear: true,
runOnCompile: true,
flat: true,
spacing: 2,
format: 'json'
},
etherscan: {
apiKey: {
polygonMumbai: `${process.env.POLYGONSCAN_API_KEY}`,
polygon: `${process.env.POLYGONSCAN_API_KEY}`
}
}
};
export default config;
task('rmx-deploy', 'Deploys a specified contract, remember to flag which network')
.addParam('contract', 'the name of the smart contract to deploy')
.setAction(async (taskArgs, hre) => {
async function deploy() {
console.log(`deploying to ${hre.network.name}`);
const contract = await hre.ethers.deployContract(taskArgs.contract)
console.log(`deploying to ${hre.network.name} with target:`, contract.target);
await contract.waitForDeployment()
console.log("deployed to address:", await contract.getAddress());
console.log("deployed in transaction:", contract.deploymentTransaction());
}
await deploy().catch((error) => {
console.error(error);
process.exitCode = 1;
});
})