-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
42 lines (37 loc) · 1.13 KB
/
index.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
import { BaseProvider } from "@ethersproject/providers";
import {
downloadContractsBlob,
ContractsBlob,
} from "@generationsoftware/pt-v5-utils-js";
import {
getProvider,
instantiateRelayerAccount,
loadLiquidatorEnvVars,
runLiquidator,
LiquidatorEnvVars,
LiquidatorConfig,
RelayerAccount,
} from "@generationsoftware/pt-v5-autotasks-library";
const main = async () => {
const envVars: LiquidatorEnvVars = loadLiquidatorEnvVars();
const provider: BaseProvider = getProvider(envVars);
const relayerAccount: RelayerAccount = await instantiateRelayerAccount(
provider,
envVars.CUSTOM_RELAYER_PRIVATE_KEY
);
const config: LiquidatorConfig = {
...relayerAccount,
provider,
covalentApiKey: envVars.COVALENT_API_KEY,
chainId: envVars.CHAIN_ID,
swapRecipient: envVars.SWAP_RECIPIENT,
minProfitThresholdUsd: Number(envVars.MIN_PROFIT_THRESHOLD_USD),
envTokenAllowList: envVars.ENV_TOKEN_ALLOW_LIST,
contractJsonUrl: envVars.CONTRACT_JSON_URL,
};
const contracts: ContractsBlob = await downloadContractsBlob(
config.contractJsonUrl
);
await runLiquidator(contracts, config);
};
main();