-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathhardhat.config.ts
119 lines (112 loc) · 3.41 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
import * as dotenv from "dotenv";
dotenv.config();
import { HardhatUserConfig, task } from "hardhat/config";
import "@nomicfoundation/hardhat-toolbox";
import "@nomicfoundation/hardhat-ethers";
import "hardhat-deploy";
import "hardhat-deploy-ethers";
import "hardhat-deploy-tenderly";
import '@openzeppelin/hardhat-upgrades';
import "@nomicfoundation/hardhat-foundry";
//import * as tdly from "./tenderly-hardhat/src";
//tdly.setup();
import "./tasks/accounts";
import "./tasks/sampleTask";
import "./tasks/balance";
import "./tasks/deployLock";
import "./tasks/setupRelay";
import "./tasks/sendPing";
import "./tasks/mockCrossChain";
import { getSingletonFactoryInfo } from "@safe-global/safe-singleton-factory";
import { DeterministicDeploymentInfo } from "hardhat-deploy/types";
import { BigNumber } from "@ethersproject/bignumber";
function getAccount(networkName: string) {
console.log('using network: ', networkName)
if (networkName) {
const pk = process.env[networkName.toUpperCase() + "_PRIVATE_KEY"]
if (pk && pk !== '') {
return [pk]
}
}
return { mnemonic: 'test test test test test test test test test test test junk' }
}
const deterministicDeployment = (network: string): DeterministicDeploymentInfo => {
const info = getSingletonFactoryInfo(parseInt(network));
if (!info) {
throw new Error(`
Safe factory not found for network ${network}. You can request a new deployment at https://github.com/safe-global/safe-singleton-factory.
For more information, see https://github.com/safe-global/safe-contracts#replay-protection-eip-155
`);
}
console.log(`Using deterministic deployment for network ${network}`);
console.log(`Factory address: ${info.address}`);
console.log(`Deployer address: ${info.signerAddress}`);
console.log(`Funding: ${BigNumber.from(info.gasLimit).mul(BigNumber.from(info.gasPrice)).toString()}`);
console.log(`Signed tx: ${info.transaction}`);
return {
factory: info.address,
deployer: info.signerAddress,
funding: BigNumber.from(info.gasLimit).mul(BigNumber.from(info.gasPrice)).toString(),
signedTx: info.transaction,
};
};
function getRpcUrl(networkName: string) {
if (networkName) {
const url = process.env["RPC_URL_" + networkName.toUpperCase()];
if (url && url !== '') {
return url
} else {
throw new Error('RPC_URL_' + networkName.toUpperCase() + ' not found');
}
}
}
const config: HardhatUserConfig = {
solidity: {
version: "0.8.18",
settings: {
optimizer: {
enabled: true,
runs: 200,
}
}
},
networks: {
ethereum: {
url: getRpcUrl('ethereum'),
chainId: 1,
accounts: getAccount('ethereum'),
},
bsc: {
url: getRpcUrl('bsc'),
chainId: 56,
accounts: getAccount('bsc'),
},
fuji: {
url: getRpcUrl('fuji'),
chainId: 43113,
saveDeployments: true,
accounts: getAccount('fuji'),
},
orderly: {
url: getRpcUrl('orderly'),
chainId: 986532,
accounts: getAccount('orderly'),
},
orderlyop: {
url: getRpcUrl('orderlyop'),
chainId: 4460,
accounts: getAccount('orderlyop'),
},
arbitrumgoerli: {
url: getRpcUrl('arbitrumgoerli'),
chainId: 421613,
accounts: getAccount('arbitrumgoerli'),
}
},
deterministicDeployment,
tenderly: {
project: 'project',
username: 'Lulu',
}
};
export default config;