forked from debridge-finance/dln-taker
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsample.config.ts
267 lines (225 loc) · 9.35 KB
/
sample.config.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
/* eslint-disable import/no-default-export, @typescript-eslint/no-unused-vars -- Allowed to simplify configuration file */
import {
ChainId,
configurator,
ExecutorLaunchConfig,
filters,
WsNextOrder,
CURRENT_ENVIRONMENT as environment,
} from '@debridge-finance/dln-taker';
const config: ExecutorLaunchConfig = {
orderFeed: new WsNextOrder(environment.WSS, {
headers: {
Authorization: `Bearer ${process.env.WS_API_KEY}`,
},
} as any),
jupiterConfig: {
maxAccounts: 16,
},
oneInchConfig: {
// MANDATORY
apiToken: `${process.env.ONEINCH_API_V5_TOKEN}`, // obtain one at https://portal.1inch.dev
disablePMMProtocols: true,
disabledProtocols: [],
},
buckets: [
//
// Setting the USDC bucket (all tokens are emitted by Circle Inc on every DLN supported chain)
//
{
[ChainId.Arbitrum]: '0xff970a61a04b1ca14834a43f5de4533ebddb5cc8',
[ChainId.Avalanche]: '0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E',
[ChainId.BSC]: '0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d',
[ChainId.Base]: ['0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca'],
[ChainId.Ethereum]: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
[ChainId.Linea]: '0x176211869cA2b568f2A7D4EE941E073a821EE1ff',
[ChainId.Optimism]: '0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85',
[ChainId.Polygon]: '0x2791bca1f2de4661ed88a30c99a7a9449aa84174',
[ChainId.Solana]: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
},
//
// Setting the ETH/wETH bucket
//
{
[ChainId.Arbitrum]: '0x0000000000000000000000000000000000000000',
[ChainId.Avalanche]: '0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB',
[ChainId.Base]: '0x0000000000000000000000000000000000000000',
[ChainId.BSC]: '0x2170Ed0880ac9A755fd29B2688956BD959F933F8',
[ChainId.Ethereum]: '0x0000000000000000000000000000000000000000',
[ChainId.Linea]: '0x0000000000000000000000000000000000000000',
[ChainId.Optimism]: '0x0000000000000000000000000000000000000000',
[ChainId.Polygon]: '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619',
},
],
/*
Example:
subsidizationRules: [{
giveChainIds: [ChainId.BSC],
takeChainIds: "any",
notTakeChainIds: [ChainId.Solana],
ranges: [
{
range: {
minUsdOrderValue: 1,
maxUsdOrderValue: 100,
},
usdSubsidy: 1,
},
{
range: {
minUsdOrderValue: 101,
maxUsdOrderValue: 1000,
},
usdSubsidy: 2,
}
]
}],
*/
subsidizationRules: [],
allowSubsidy: false,
tokenPriceService: configurator.tokenPriceService({
coingeckoApiKey: process?.env?.COINGECKO_API_KEY,
// mapping: {}
}),
srcConstraints: {
// desired profitability. Setting a higher value would prevent dln-taker from fulfilling most orders because
// the deBridge app and the API suggest users placing orders with as much margin as 4bps
minProfitabilityBps: 4,
// Number of orders (per every chain where orders are coming from and to) to accumulate to unlock them in batches
// Min: 1; max: 10, default: 10.
// This means that dln-taker would accumulate orders (that were fulfilled successfully) rather then unlock
// them on the go, and would send a batch of unlock commands every time enough orders were fulfilled, dramatically
// reducing the cost of the unlock command execution.
// You can set a lesser value to unlock orders more frequently, however please note that this value directly
// affects order profitability because the deBridge app and the API reserves the cost of unlock in the order's margin,
// assuming that the order would be unlocked in a batch of size=10. Reducing the batch size to a lower value increases
// your unlock costs and thus reduces order profitability, making them unprofitable most of the time.
batchUnlockSize: 10,
},
chains: [
{
chain: ChainId.Solana,
chainRpc: `${process.env.SOLANA_RPC}`,
// Defines constraints imposed on all orders coming from this chain
constraints: {},
// if the order is created on Solana and fulfilled on another chain (e.g. Ethereum),
// unlocked funds will be sent to this Solana address
beneficiary: `${process.env.SOLANA_BENEFICIARY}`,
// if the order is created on another chain (e.g. Ethereum), dln-taker would attempt to fulfill
// this order on behalf of this address
// Warn! base58 representation of a private key.
// Warn! For security reasons, put it to the .env file
takerPrivateKey: `${process.env.SOLANA_TAKER_PRIVATE_KEY}`,
// Warn! base58 representation of a private key.
// Warn! For security reasons, put it to the .env file
unlockAuthorityPrivateKey: `${process.env.SOLANA_UNLOCK_AUTHORITY_PRIVATE_KEY}`,
},
{
chain: ChainId.Arbitrum,
chainRpc: `${process.env.ARBITRUM_RPC}`,
// Defines constraints imposed on all orders coming from this chain
constraints: {
// Defines necessary and sufficient block confirmation thresholds per worth of order expressed in dollars.
requiredConfirmationsThresholds: [
// worth <$100: 1+ block confirmation
// {thresholdAmountInUSD: 100, minBlockConfirmations: 1},
// worth >$100: guaranteed block confirmations (15)
],
},
// if the order is created on Ethereum and fulfilled on another chain (e.g. Solana),
// unlocked funds will be sent to this Ethereum address
beneficiary: `${process.env.ARBITRUM_BENEFICIARY}`,
// if the order is created on another chain (e.g. Solana), dln-taker would attempt to fulfill
// this order on behalf of this address
// Warn! base64 representation of a private key.
// Warn! For security reasons, put it to the .env file
takerPrivateKey: `${process.env.ARBITRUM_TAKER_PRIVATE_KEY}`,
// if the order is created on another chain (e.g. Solana), dln-taker would unlock it
// after successful fulfillment on behalf of this address
// Warn! base64 representation of a private key.
// Warn! For security reasons, put it to the .env file
unlockAuthorityPrivateKey: `${process.env.ARBITRUM_UNLOCK_AUTHORITY_PRIVATE_KEY}`,
},
{
chain: ChainId.Avalanche,
chainRpc: `${process.env.AVALANCHE_RPC}`,
constraints: {
requiredConfirmationsThresholds: [
// worth <$100: 1+ block confirmation
// {thresholdAmountInUSD: 100, minBlockConfirmations: 1},
// worth >$100: guaranteed block confirmations (15)
],
},
beneficiary: `${process.env.AVALANCHE_BENEFICIARY}`,
takerPrivateKey: `${process.env.AVALANCHE_TAKER_PRIVATE_KEY}`,
unlockAuthorityPrivateKey: `${process.env.AVALANCHE_UNLOCK_AUTHORITY_PRIVATE_KEY}`,
},
{
chain: ChainId.BSC,
chainRpc: `${process.env.BNB_RPC}`,
constraints: {
requiredConfirmationsThresholds: [
// worth <$100: 1+ block confirmation
// {thresholdAmountInUSD: 100, minBlockConfirmations: 1},
// worth >$100: guaranteed block confirmations (15)
],
},
beneficiary: `${process.env.BNB_BENEFICIARY}`,
takerPrivateKey: `${process.env.BNB_TAKER_PRIVATE_KEY}`,
unlockAuthorityPrivateKey: `${process.env.BNB_UNLOCK_AUTHORITY_PRIVATE_KEY}`,
},
{
chain: ChainId.Ethereum,
chainRpc: `${process.env.ETHEREUM_RPC}`,
constraints: {
requiredConfirmationsThresholds: [
// worth <$100: 1+ block confirmation
// {thresholdAmountInUSD: 100, minBlockConfirmations: 1},
// worth >$100: guaranteed block confirmations (15)
],
},
beneficiary: `${process.env.ETHEREUM_BENEFICIARY}`,
takerPrivateKey: `${process.env.ETHEREUM_TAKER_PRIVATE_KEY}`,
unlockAuthorityPrivateKey: `${process.env.ETHEREUM_UNLOCK_AUTHORITY_PRIVATE_KEY}`,
},
{
chain: ChainId.Polygon,
chainRpc: `${process.env.POLYGON_RPC}`,
constraints: {
requiredConfirmationsThresholds: [
// worth <$100: 32+ block confirmation
// {thresholdAmountInUSD: 100, minBlockConfirmations: 1},
// worth >$100: guaranteed block confirmations (256)
],
},
beneficiary: `${process.env.POLYGON_BENEFICIARY}`,
takerPrivateKey: `${process.env.POLYGON_TAKER_PRIVATE_KEY}`,
unlockAuthorityPrivateKey: `${process.env.POLYGON_UNLOCK_AUTHORITY_PRIVATE_KEY}`,
},
{
chain: ChainId.Linea,
chainRpc: `${process.env.LINEA_RPC}`,
constraints: {},
beneficiary: `${process.env.LINEA_BENEFICIARY}`,
takerPrivateKey: `${process.env.LINEA_TAKER_PRIVATE_KEY}`,
unlockAuthorityPrivateKey: `${process.env.LINEA_UNLOCK_AUTHORITY_PRIVATE_KEY}`,
},
{
chain: ChainId.Base,
chainRpc: `${process.env.BASE_RPC}`,
constraints: {},
beneficiary: `${process.env.BASE_BENEFICIARY}`,
takerPrivateKey: `${process.env.BASE_TAKER_PRIVATE_KEY}`,
unlockAuthorityPrivateKey: `${process.env.BASE_UNLOCK_AUTHORITY_PRIVATE_KEY}`,
},
{
chain: ChainId.Optimism,
chainRpc: `${process.env.OPTIMISM_RPC}`,
constraints: {},
beneficiary: `${process.env.OPTIMISM_BENEFICIARY}`,
takerPrivateKey: `${process.env.OPTIMISM_TAKER_PRIVATE_KEY}`,
unlockAuthorityPrivateKey: `${process.env.OPTIMISM_UNLOCK_AUTHORITY_PRIVATE_KEY}`,
},
],
};
export default config;