-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
46 lines (41 loc) · 1.37 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
43
44
45
46
import nodeFetch from "node-fetch";
import { BaseProvider } from "@ethersproject/providers";
import {
downloadContractsBlob,
ContractsBlob,
} from "@generationsoftware/pt-v5-utils-js";
import {
getProvider,
instantiateRelayerAccount,
loadDrawAuctionEnvVars,
runDrawAuction,
DrawAuctionEnvVars,
DrawAuctionConfig,
RelayerAccount,
} from "@generationsoftware/pt-v5-autotasks-library";
const main = async () => {
const envVars: DrawAuctionEnvVars = loadDrawAuctionEnvVars();
const provider: BaseProvider = getProvider(envVars);
const relayerAccount: RelayerAccount = await instantiateRelayerAccount(
provider,
envVars.CUSTOM_RELAYER_PRIVATE_KEY
);
const drawAuctionConfig: DrawAuctionConfig = {
chainId: Number(envVars.CHAIN_ID),
provider,
covalentApiKey: envVars.COVALENT_API_KEY,
rewardRecipient: envVars.REWARD_RECIPIENT,
minProfitThresholdUsd: Number(envVars.MIN_PROFIT_THRESHOLD_USD),
signer: relayerAccount.signer,
wallet: relayerAccount.wallet,
relayerAddress: relayerAccount.relayerAddress,
contractJsonUrl: envVars.CONTRACT_JSON_URL,
errorStateMaxGasCostThresholdUsd: envVars.ERROR_STATE_MAX_GAS_COST_THRESHOLD_USD,
};
const rngContracts: ContractsBlob = await downloadContractsBlob(
drawAuctionConfig.contractJsonUrl,
nodeFetch
);
await runDrawAuction(rngContracts, drawAuctionConfig);
};
main();