forked from ubiquity/ubiquibot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpayout.ts
More file actions
36 lines (33 loc) · 1.26 KB
/
Copy pathpayout.ts
File metadata and controls
36 lines (33 loc) · 1.26 KB
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
/**
* Helper functions for payout config
*
* We support payouts (permit2 + gnosis chain) for 2 networks:
* - ethereum mainnet
* - gnosis chain
*
* To support a new chain add RPC URL and payment token to the "getPayoutConfigByChainId()" method.
* Notice that chain should be compatible with gelato network, i.e.:
* 1. Gelato network should support the added chain (https://docs.gelato.network/developer-services/relay/api#oracles)
* 2. Gelato network should support the added payment token (https://docs.gelato.network/developer-services/relay/api#oracles-chainid-paymenttokens)
*/
// available tokens for payouts
const PAYMENT_TOKEN_PER_NETWORK: Record<string, { rpc: string; token: string }> = {
"1": {
rpc: "https://rpc-bot.ubq.fi/v1/mainnet",
token: "0x6B175474E89094C44Da98b954EedeAC495271d0F", // DAI
},
"100": {
rpc: "https://rpc.gnosischain.com",
token: "0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d", // WXDAI
},
};
export function getPayoutConfigByNetworkId(evmNetworkId: number) {
const paymentToken = PAYMENT_TOKEN_PER_NETWORK[evmNetworkId.toString()];
if (!paymentToken) {
throw new Error(`No config setup for evmNetworkId: ${evmNetworkId}`);
}
return {
rpc: paymentToken.rpc,
paymentToken: paymentToken.token,
};
}