-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconfiguration.ts
72 lines (58 loc) · 2.24 KB
/
configuration.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
import config from "deployment-configs.json";
import { zeroAddress } from "viem";
const deploymentConfig: any = config;
export const populateChainConfigs = () => {
try {
let config: any = {};
if (!deploymentConfig?.generated?.config) {
console.log("using default chains");
config.chainId = deploymentConfig.default.config.network.chainId;
config.name = deploymentConfig.default.config.network.name;
config.rpc = deploymentConfig.default.config.network.rpc;
config.nativeCurrency =
deploymentConfig.default.config.network.nativeCurrency;
config.explorerLink =
deploymentConfig.default.config.network.explorerLink;
} else {
// read generated configs
config.chainId = deploymentConfig.generated.config.network.chainId;
config.name = deploymentConfig.generated.config.network.name;
config.rpc = deploymentConfig.generated.config.network.rpc;
config.nativeCurrency =
deploymentConfig.generated.config.network.nativeCurrency;
config.explorerLink =
deploymentConfig.generated.config.network.explorerLink;
}
console.log({ config });
return config;
} catch (error) {
console.log("Failed to read deploye contracts file", error);
return {};
}
};
export const populateAssetIcon = (symbol: string): string => {
return "/images/logo-icon.svg";
};
export const populateMarket = () => {
let contracts;
if (!deploymentConfig?.generated?.["deployed-contracts"]) {
console.log("using default contracts");
contracts = deploymentConfig.default?.["deployed-contracts"];
} else {
console.log("using cli contracts");
// read config from cli
contracts = deploymentConfig?.generated?.["deployed-contracts"];
}
const market = {
POOL_ADDRESSES_PROVIDER:
contracts?.LendingPoolAddressesProvider?.custom?.address,
POOL: contracts?.LendingPool?.custom?.address,
WETH_GATEWAY: contracts?.WETHGateway?.custom?.address,
FAUCET: zeroAddress,
WALLET_BALANCE_PROVIDER: contracts?.WalletBalanceProvider?.custom?.address,
UI_POOL_DATA_PROVIDER: contracts?.UiPoolDataProvider?.custom?.address,
UI_INCENTIVE_DATA_PROVIDER:
contracts?.UiIncentiveDataProviderV2V3?.custom?.address,
};
return market;
};