-
Notifications
You must be signed in to change notification settings - Fork 17
/
index.ts
39 lines (33 loc) · 1.17 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
import nodeFetch from 'node-fetch';
import { BaseProvider } from '@ethersproject/providers';
import { downloadContractsBlob, ContractsBlob } from '@generationsoftware/pt-v5-utils-js';
import {
getProvider,
loadPrizeClaimerEnvVars,
instantiateRelayerAccount,
runPrizeClaimer,
PrizeClaimerEnvVars,
PrizeClaimerConfig,
RelayerAccount,
} from '@generationsoftware/pt-v5-autotasks-library';
const main = async () =>{
const envVars: PrizeClaimerEnvVars = loadPrizeClaimerEnvVars();
const provider: BaseProvider = getProvider(envVars);
const relayerAccount: RelayerAccount = await instantiateRelayerAccount(
provider,
envVars.CUSTOM_RELAYER_PRIVATE_KEY,
);
const config: PrizeClaimerConfig = {
...relayerAccount,
provider,
chainId: envVars.CHAIN_ID,
rewardRecipient: envVars.REWARD_RECIPIENT,
minProfitThresholdUsd: Number(envVars.MIN_PROFIT_THRESHOLD_USD),
covalentApiKey: envVars.COVALENT_API_KEY,
contractJsonUrl: envVars.CONTRACT_JSON_URL,
subgraphUrl: envVars.SUBGRAPH_URL,
};
const contracts: ContractsBlob = await downloadContractsBlob(config.contractJsonUrl, nodeFetch);
await runPrizeClaimer(contracts, config);
}
main()