@render-foundation/utils 0.0.182 → 0.0.183

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -579,7 +579,7 @@ const pgClient = (config) => {
579
579
  let qb = db
580
580
  .selectFrom(exports.EPOCH_TABLE)
581
581
  .selectAll(exports.EPOCH_TABLE)
582
- .where('ui', '>', f.startEpochId.id.toString())
582
+ .where('ui', '=', f.startEpochId.id.toString())
583
583
  .where('channel', 'in', f.channels);
584
584
  if (f.startEpochId.savedAtNotNull) {
585
585
  qb = qb.where('saved_at', 'is not', null);
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addressToLabel = exports.polygonUpgradeEscrow = exports.usdcMint = exports.renderMint = exports.bridgeEscrowAddress = exports.bridgeEscrow = exports.otherSquadsVault = exports.panamaSquadsVault = exports.caymanSquadsVault = exports.upgradeRewardsCircuitBreaker = exports.upgradeRewardsEscrow = exports.polyBridgeEscrow = exports.burnRewardsEscrow = exports.computeClientEscrow = exports.availabilityEscrow = exports.nodeOperatorEscrow = exports.passthruEscrow = exports.buyAndBurnEscrow = exports.otherVault = exports.masterSquadsVault = exports.devsSquadsVault = exports.v3SquadsVault = void 0;
3
+ exports.addressToLabel = exports.polygonUpgradeEscrow = exports.usdcMint = exports.renderMint = exports.bridgeEscrowAddress = exports.bridgeEscrow = exports.otherSquadsVault = exports.panamaSquadsVault = exports.caymanSquadsVault = exports.upgradeRewardsCircuitBreaker = exports.upgradeRewardsEscrow = exports.renderComputeNetworkEscrow = exports.polyBridgeEscrow = exports.burnRewardsEscrow = exports.computeClientEscrow = exports.availabilityEscrow = exports.nodeOperatorEscrow = exports.passthruEscrow = exports.buyAndBurnEscrow = exports.otherVault = exports.masterSquadsVault = exports.devsSquadsVault = exports.v3SquadsVault = void 0;
4
4
  exports.v3SquadsVault = '7dTswSjBVjfLb6V7Rf2HzDQxFhPH33Ad8nxwG8XjN11z';
5
5
  exports.devsSquadsVault = '7CVt936gVDXfKeXdRs5xcWVkrEaYGMTV3HA2K7j4Bqa7';
6
6
  exports.masterSquadsVault = 'G6uch1NBTQoTVExxHvk714NJ4gNe7Gm9Qqos3QS71x2Y';
@@ -12,6 +12,7 @@ exports.availabilityEscrow = 'rav3GKV8KXg4AvswaqT9HWJ4ErxU5csUwTKj549aHUH';
12
12
  exports.computeClientEscrow = 'rcc3mGdgTtwac2AizPMUWabHwanB3NyrDshQD8LW7Pc';
13
13
  exports.burnRewardsEscrow = '7VFA2ZKVq8EJMQESJrAzvgDZqZ3VeER6b4pAx8SgpAPJ';
14
14
  exports.polyBridgeEscrow = '9GtbVQnPVqK8329EsUHUz7nEi3GoZhSykxnByMtKXdgi';
15
+ exports.renderComputeNetworkEscrow = 'rcnPP2dUSZHhJMod97tHDEJQoqdJxpymungYXm7QCdU';
15
16
  exports.upgradeRewardsEscrow = 'dRp9vpi2q3QswzL7p96EYezUkQaPm8TiMtnWoShVjXG';
16
17
  // circuit-breaker
17
18
  exports.upgradeRewardsCircuitBreaker = 'C3E5bGdEZ9SzAbN7Ef45czDGbkDdGBGBcXtXV3cWuQgz';
@@ -30,6 +31,7 @@ exports.addressToLabel = {
30
31
  [exports.buyAndBurnEscrow]: 'buy-burn',
31
32
  [exports.passthruEscrow]: 'rscr-passthru',
32
33
  [exports.upgradeRewardsEscrow]: 'upgrade-rewards',
34
+ [exports.renderComputeNetworkEscrow]: 'render-compute-network',
33
35
  // circuit-breaker
34
36
  [exports.upgradeRewardsCircuitBreaker]: 'upgrade-rewards',
35
37
  [exports.caymanSquadsVault]: 'cayman-vault',
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,aAAa,GAAG,8CAA8C,CAAA;AAC9D,QAAA,eAAe,GAAG,8CAA8C,CAAA;AAChE,QAAA,iBAAiB,GAAG,8CAA8C,CAAA;AAElE,QAAA,UAAU,GA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A8C,CAAA;AAEzD,QAAA,oBAAoB,GAC/B,8CAA8C,CAAA;AAEnC,QAAA,cAAc,GAAG;IAC5B,CAAC,qBAAa,CAAC,EAAE,UAAU;IAC3B,CAAC,uBAAe,CAAC,EAAE,YAAY;IAC/B,CAAC,yBAAiB,CAAC,EAAE,cAAc;IACnC,CAAC,wBAAgB,CAAC,EAAE,UAAU;IAC9B,CAAC,sBAAc,CAAC,EAAE,eAAe;IACjC,CAAC,4BAAoB,CAAC,EAAE,iBAAiB;IACzC,CAAC,kCAA0B,CAAC,EAAE,wBAAwB;IACtD,kBAAkB;IAClB,CAAC,oCAA4B,CAAC,EAAE,iBAAiB;IACjD,CAAC,yBAAiB,CAAC,EAAE,cAAc;IACnC,CAAC,yBAAiB,CAAC,EAAE,cAAc;IACnC,CAAC,wBAAgB,CAAC,EAAE,aAAa;IACjC,CAAC,oBAAY,CAAC,EAAE,cAAc;IAC9B,CAAC,kBAAU,CAAC,EAAE,MAAM;IACpB,CAAC,0BAAkB,CAAC,EAAE,eAAe;IACrC,CAAC,0BAAkB,CAAC,EAAE,cAAc;IACpC,CAAC,2BAAmB,CAAC,EAAE,gBAAgB;IACvC,CAAC,yBAAiB,CAAC,EAAE,cAAc;IACnC,CAAC,4BAAoB,CAAC,EAAE,wBAAwB;CACjD,CAAA"}
@@ -1,13 +1,13 @@
1
- import { PublicKey } from '@solana/web3.js';
2
- import { renderMint, buyAndBurnEscrow, passthruEscrow, v3SquadsVault, upgradeRewardsEscrow, upgradeRewardsCircuitBreaker, usdcMint, devsSquadsVault, masterSquadsVault, bridgeEscrow, polyBridgeEscrow, } from './constants';
3
- import { pgClient } from './client/pg/v2Client';
4
- import { emissionDistributorKey, emissionDistributorV1Key, } from '@render-foundation/emission-distributor-sdk';
5
- import { Helius } from 'helius-sdk';
1
+ import { PublicKey } from "@solana/web3.js";
2
+ import { renderMint, buyAndBurnEscrow, passthruEscrow, v3SquadsVault, upgradeRewardsEscrow, upgradeRewardsCircuitBreaker, usdcMint, devsSquadsVault, masterSquadsVault, bridgeEscrow, polyBridgeEscrow, renderComputeNetworkEscrow, } from "./constants";
3
+ import { pgClient } from "./client/pg/v2Client";
4
+ import { emissionDistributorKey, emissionDistributorV1Key } from "@render-foundation/emission-distributor-sdk";
5
+ import { Helius } from "helius-sdk";
6
6
  export const solscanProClient = (apiKey) => {
7
7
  const headers = {
8
8
  token: apiKey,
9
9
  };
10
- const baseUrl = 'https://pro-api.solscan.io/v2.0';
10
+ const baseUrl = "https://pro-api.solscan.io/v2.0";
11
11
  return {
12
12
  async getSignaturesForAddress(addr, options) {
13
13
  const allSignatures = [];
@@ -19,7 +19,7 @@ export const solscanProClient = (apiKey) => {
19
19
  limit: limit.toString(),
20
20
  });
21
21
  if (before) {
22
- params.append('before', before);
22
+ params.append("before", before);
23
23
  }
24
24
  const endpoint = `${baseUrl}/account/transactions?${params}`;
25
25
  const response = await fetch(endpoint, { headers });
@@ -31,18 +31,15 @@ export const solscanProClient = (apiKey) => {
31
31
  const transformedSigs = signatures.map((tx) => ({
32
32
  signature: tx.txHash || tx.signature,
33
33
  blockTime: tx.blockTime || tx.block_time || 0,
34
- err: tx.status !== 'Success' ? { err: tx.status } : null,
34
+ err: tx.status !== "Success" ? { err: tx.status } : null,
35
35
  }));
36
36
  allSignatures.push(...transformedSigs);
37
- if (signatures.length < limit ||
38
- (options?.limit && allSignatures.length >= options.limit)) {
37
+ if (signatures.length < limit || (options?.limit && allSignatures.length >= options.limit)) {
39
38
  break;
40
39
  }
41
40
  // Set before to the last signature for next page
42
41
  if (signatures.length > 0) {
43
- before =
44
- signatures[signatures.length - 1].txHash ||
45
- signatures[signatures.length - 1].signature;
42
+ before = signatures[signatures.length - 1].txHash || signatures[signatures.length - 1].signature;
46
43
  }
47
44
  }
48
45
  return allSignatures.slice(0, options?.limit);
@@ -56,14 +53,14 @@ export const solscanProClient = (apiKey) => {
56
53
  const data = await response.json();
57
54
  return {
58
55
  meta: {
59
- err: data.status !== 'Success' ? { err: data.status } : null,
56
+ err: data.status !== "Success" ? { err: data.status } : null,
60
57
  logMessages: data.logMessages || [],
61
58
  preTokenBalances: data.inputAccount || [],
62
59
  postTokenBalances: data.outputAccount || [],
63
60
  },
64
61
  blockTime: data.blockTime || data.block_time || 0,
65
62
  status: data.status,
66
- err: data.status !== 'Success' ? { err: data.status } : null,
63
+ err: data.status !== "Success" ? { err: data.status } : null,
67
64
  tokenBalances: data.tokenBalances || [],
68
65
  preTokenBalances: data.inputAccount || [],
69
66
  postTokenBalances: data.outputAccount || [],
@@ -81,18 +78,18 @@ export const solscanProClient = (apiKey) => {
81
78
  page_size: pageSize.toString(),
82
79
  });
83
80
  if (f.mint) {
84
- params.append('token', f.mint.toString());
81
+ params.append("token", f.mint.toString());
85
82
  }
86
83
  if (f.flow) {
87
- params.append('flow', f.flow);
84
+ params.append("flow", f.flow);
88
85
  }
89
86
  if (f.tokenAccount) {
90
- params.append('token_account', f.tokenAccount.toString());
87
+ params.append("token_account", f.tokenAccount.toString());
91
88
  }
92
89
  const endpoint = `${baseUrl}/account/balance_change?${params}`;
93
90
  const response = await fetch(endpoint, { headers });
94
91
  if (f.tokenAccount.toString() === polyBridgeEscrow) {
95
- console.log('Poly solscan response: ', JSON.stringify(response));
92
+ console.log("Poly solscan response: ", JSON.stringify(response));
96
93
  }
97
94
  if (!response.ok) {
98
95
  console.error(`Failed to fetch balance changes: ${response.statusText}`);
@@ -101,10 +98,10 @@ export const solscanProClient = (apiKey) => {
101
98
  const body = await response.json();
102
99
  const transfers = [];
103
100
  if (f.tokenAccount.toString() === polyBridgeEscrow) {
104
- console.log('poly solscan data: ', JSON.stringify(body));
101
+ console.log("poly solscan data: ", JSON.stringify(body));
105
102
  }
106
103
  for (const item of body.data || []) {
107
- if (item.change_type === (f.flow === 'in' ? 'inc' : 'dec')) {
104
+ if (item.change_type === (f.flow === "in" ? "inc" : "dec")) {
108
105
  transfers.push({
109
106
  amount: Math.abs(item.amount || 0),
110
107
  tokenDecimals: item.token_decimals || 0,
@@ -122,7 +119,7 @@ export const solscanProClient = (apiKey) => {
122
119
  return allTransfers.filter((t) => t.amount !== 0);
123
120
  }
124
121
  catch (error) {
125
- console.error('Error in getBalanceChange:', error);
122
+ console.error("Error in getBalanceChange:", error);
126
123
  return [];
127
124
  }
128
125
  },
@@ -150,12 +147,8 @@ export const solscanProClient = (apiKey) => {
150
147
  transfers.push({
151
148
  amount: item.amount || 0,
152
149
  tokenDecimals: item.token_decimals || 0,
153
- fromAddress: item.from_address
154
- ? new PublicKey(item.from_address)
155
- : undefined,
156
- toAddress: item.to_address
157
- ? new PublicKey(item.to_address)
158
- : undefined,
150
+ fromAddress: item.from_address ? new PublicKey(item.from_address) : undefined,
151
+ toAddress: item.to_address ? new PublicKey(item.to_address) : undefined,
159
152
  sig: item.trans_id,
160
153
  blockTime: item.block_time || 0,
161
154
  });
@@ -169,14 +162,14 @@ export const solscanProClient = (apiKey) => {
169
162
  return allTransfers.filter((t) => t.amount !== 0);
170
163
  }
171
164
  catch (error) {
172
- console.error('Error in getTransfers:', error);
165
+ console.error("Error in getTransfers:", error);
173
166
  throw new Error(`Failed to get transfers: ${error}`);
174
167
  }
175
168
  },
176
169
  };
177
170
  };
178
171
  export const heliusClient = (apiKey) => {
179
- const helius = new Helius(apiKey, 'mainnet-beta');
172
+ const helius = new Helius(apiKey, "mainnet-beta");
180
173
  return {
181
174
  async getSignaturesForAddress(addr, options) {
182
175
  return helius.connection.getSignaturesForAddress(addr, {
@@ -218,8 +211,7 @@ export const heliusClient = (apiKey) => {
218
211
  const change = postAmount - preAmount;
219
212
  if (change !== 0) {
220
213
  const isInflow = change > 0;
221
- if ((f.flow === 'in' && isInflow) ||
222
- (f.flow === 'out' && !isInflow)) {
214
+ if ((f.flow === "in" && isInflow) || (f.flow === "out" && !isInflow)) {
223
215
  transfers.push({
224
216
  amount: Math.abs(change),
225
217
  tokenDecimals: postBalance.uiTokenAmount?.decimals || 0,
@@ -237,7 +229,7 @@ export const heliusClient = (apiKey) => {
237
229
  return transfers.filter((t) => t.amount !== 0);
238
230
  }
239
231
  catch (error) {
240
- console.error('Error in getBalanceChange:', error);
232
+ console.error("Error in getBalanceChange:", error);
241
233
  return [];
242
234
  }
243
235
  },
@@ -278,12 +270,9 @@ export const heliusClient = (apiKey) => {
278
270
  }
279
271
  // Find transfers involving the target address
280
272
  for (const [accountIndex, balanceChange] of balanceChanges) {
281
- const isFromTarget = balanceChange.owner === f.addr.toString() &&
282
- balanceChange.change < 0;
283
- const isToTarget = balanceChange.owner === f.addr.toString() &&
284
- balanceChange.change > 0;
285
- if ((f.flow === 'out' && isFromTarget) ||
286
- (f.flow === 'in' && isToTarget)) {
273
+ const isFromTarget = balanceChange.owner === f.addr.toString() && balanceChange.change < 0;
274
+ const isToTarget = balanceChange.owner === f.addr.toString() && balanceChange.change > 0;
275
+ if ((f.flow === "out" && isFromTarget) || (f.flow === "in" && isToTarget)) {
287
276
  // Find the counterpart transfer
288
277
  let fromAddress;
289
278
  let toAddress;
@@ -291,8 +280,7 @@ export const heliusClient = (apiKey) => {
291
280
  fromAddress = f.addr;
292
281
  // Find who received the tokens
293
282
  for (const [_, otherChange] of balanceChanges) {
294
- if (otherChange.owner !== f.addr.toString() &&
295
- otherChange.change > 0) {
283
+ if (otherChange.owner !== f.addr.toString() && otherChange.change > 0) {
296
284
  toAddress = new PublicKey(otherChange.owner);
297
285
  break;
298
286
  }
@@ -302,8 +290,7 @@ export const heliusClient = (apiKey) => {
302
290
  toAddress = f.addr;
303
291
  // Find who sent the tokens
304
292
  for (const [_, otherChange] of balanceChanges) {
305
- if (otherChange.owner !== f.addr.toString() &&
306
- otherChange.change < 0) {
293
+ if (otherChange.owner !== f.addr.toString() && otherChange.change < 0) {
307
294
  fromAddress = new PublicKey(otherChange.owner);
308
295
  break;
309
296
  }
@@ -327,7 +314,7 @@ export const heliusClient = (apiKey) => {
327
314
  return transfers.filter((t) => t.amount !== 0);
328
315
  }
329
316
  catch (error) {
330
- console.error('Error in getTransfers:', error);
317
+ console.error("Error in getTransfers:", error);
331
318
  throw new Error(`Failed to get transfers: ${error}`);
332
319
  }
333
320
  },
@@ -349,23 +336,31 @@ export class Backfiller {
349
336
  this.isDryRun = isDryRun;
350
337
  }
351
338
  emit() {
352
- this._types['emit'] = {};
339
+ this._types["emit"] = {};
353
340
  return this;
354
341
  }
355
342
  loans() {
356
- this._types['loan'] = {};
343
+ this._types["loan"] = {};
357
344
  return this;
358
345
  }
359
346
  buyBurnUSDCInflow() {
360
- this._types['buyBurnUSDCInflow'] = {};
347
+ this._types["buyBurnUSDCInflow"] = {};
361
348
  return this;
362
349
  }
363
350
  manualMint() {
364
- this._types['manualMint'] = {};
351
+ this._types["manualMint"] = {};
352
+ return this;
353
+ }
354
+ renderComputeNetwork() {
355
+ this._types["renderComputeNetwork"] = {};
356
+ return this;
357
+ }
358
+ burnRENDERInflow() {
359
+ this._types["burnRENDERInflow"] = {};
365
360
  return this;
366
361
  }
367
362
  vaultOutflows(p) {
368
- this._types['vaultOutflows'] = {};
363
+ this._types["vaultOutflows"] = {};
369
364
  this.solscan.pageSize = p.pageSize || 100;
370
365
  return this;
371
366
  }
@@ -373,7 +368,7 @@ export class Backfiller {
373
368
  this._txs.push(...sigs);
374
369
  }
375
370
  formatAmount(amount, decimals = 8) {
376
- const amt = typeof amount === 'bigint' ? Number(amount) : amount;
371
+ const amt = typeof amount === "bigint" ? Number(amount) : amount;
377
372
  return (amt / Math.pow(10, decimals)).toLocaleString(undefined, {
378
373
  maximumFractionDigits: 8,
379
374
  minimumFractionDigits: 0,
@@ -386,67 +381,67 @@ export class Backfiller {
386
381
  const trs = [
387
382
  {
388
383
  transfer: {
389
- toSolKey: '2P2gisXpbsYEUsTDQKdcDKSg1UZvx7qxfLTkvJGZdeJC',
384
+ toSolKey: "2P2gisXpbsYEUsTDQKdcDKSg1UZvx7qxfLTkvJGZdeJC",
390
385
  fromSolKey: v3SquadsVault,
391
- solTx: '3oC8BybX5YrkfPyvV8rAE1tnJr6egtZFHLghqHuLi3eaT4aWm87qZPJFrjFRn6nwVemd2ponsew85tBs6VVQzTJv',
392
- executedAt: new Date('December 22, 2023 04:13:58 UTC'),
393
- symbol: 'RENDER',
394
- channel: 'loan',
386
+ solTx: "3oC8BybX5YrkfPyvV8rAE1tnJr6egtZFHLghqHuLi3eaT4aWm87qZPJFrjFRn6nwVemd2ponsew85tBs6VVQzTJv",
387
+ executedAt: new Date("December 22, 2023 04:13:58 UTC"),
388
+ symbol: "RENDER",
389
+ channel: "loan",
395
390
  amountPayed: BigInt(44999 * Math.pow(10, 8)),
396
391
  },
397
392
  },
398
393
  {
399
394
  transfer: {
400
- toSolKey: '2P2gisXpbsYEUsTDQKdcDKSg1UZvx7qxfLTkvJGZdeJC',
395
+ toSolKey: "2P2gisXpbsYEUsTDQKdcDKSg1UZvx7qxfLTkvJGZdeJC",
401
396
  fromSolKey: v3SquadsVault,
402
- channel: 'loan',
403
- solTx: '2f5sEBHcP8wpF79voUEUiP8pryDt7FvqrTXQrEpXzAxbzyFYPkavZGtJc5N8CXhfbJav8hQTr9YcENKseiouaWzc',
404
- executedAt: new Date('December 22, 2023 02:39:53 UTC'),
405
- symbol: 'RENDER',
397
+ channel: "loan",
398
+ solTx: "2f5sEBHcP8wpF79voUEUiP8pryDt7FvqrTXQrEpXzAxbzyFYPkavZGtJc5N8CXhfbJav8hQTr9YcENKseiouaWzc",
399
+ executedAt: new Date("December 22, 2023 02:39:53 UTC"),
400
+ symbol: "RENDER",
406
401
  amountPayed: BigInt(1 * Math.pow(10, 8)),
407
402
  },
408
403
  },
409
404
  {
410
405
  transfer: {
411
- toSolKey: '5DGbogKUo8haEYC9Tt4FTHE5ue55bjLC4DpSgE1g6yT1',
406
+ toSolKey: "5DGbogKUo8haEYC9Tt4FTHE5ue55bjLC4DpSgE1g6yT1",
412
407
  fromSolKey: v3SquadsVault,
413
- channel: 'loan',
414
- solTx: '42n55BZcKVBCSZQoaneBQLn57v7zZGZorGe3uBLheGu4BQtpaTChdT1z3vHwgU4MHghJw3wJ72rFLkib761ewJCj',
415
- executedAt: new Date('January 12, 2024 00:17:02 UTC'),
416
- symbol: 'RENDER',
408
+ channel: "loan",
409
+ solTx: "42n55BZcKVBCSZQoaneBQLn57v7zZGZorGe3uBLheGu4BQtpaTChdT1z3vHwgU4MHghJw3wJ72rFLkib761ewJCj",
410
+ executedAt: new Date("January 12, 2024 00:17:02 UTC"),
411
+ symbol: "RENDER",
417
412
  amountPayed: BigInt(1 * Math.pow(10, 8)),
418
413
  },
419
414
  },
420
415
  {
421
416
  transfer: {
422
- toSolKey: '5DGbogKUo8haEYC9Tt4FTHE5ue55bjLC4DpSgE1g6yT1',
417
+ toSolKey: "5DGbogKUo8haEYC9Tt4FTHE5ue55bjLC4DpSgE1g6yT1",
423
418
  fromSolKey: v3SquadsVault,
424
- channel: 'loan',
425
- solTx: 'THJLvA1UTqH22hNP7Ecnfn4iY736VJAZ8scgSUjrDDaGpSQJmGYKJYXGtDu6TB96fKo6mJBtUBZvLb4ors17JUR',
426
- executedAt: new Date('January 17, 2024 22:09:58 UTC'),
427
- symbol: 'RENDER',
419
+ channel: "loan",
420
+ solTx: "THJLvA1UTqH22hNP7Ecnfn4iY736VJAZ8scgSUjrDDaGpSQJmGYKJYXGtDu6TB96fKo6mJBtUBZvLb4ors17JUR",
421
+ executedAt: new Date("January 17, 2024 22:09:58 UTC"),
422
+ symbol: "RENDER",
428
423
  amountPayed: BigInt(49999 * Math.pow(10, 8)),
429
424
  },
430
425
  },
431
426
  {
432
427
  transfer: {
433
- toSolKey: '5DGbogKUo8haEYC9Tt4FTHE5ue55bjLC4DpSgE1g6yT1',
428
+ toSolKey: "5DGbogKUo8haEYC9Tt4FTHE5ue55bjLC4DpSgE1g6yT1",
434
429
  fromSolKey: devsSquadsVault,
435
- channel: 'loan',
436
- solTx: '5BcxrMExq34jtMB5c3bH3A8TN4pCp9sxjC5HMcS7Mh8pig3r2eQhvRnJeE1RBTyQ4JDXyANWmDU9SKdYFyT2wDoq',
437
- executedAt: new Date('February 28, 2024 22:43:21 UTC'),
438
- symbol: 'RENDER',
430
+ channel: "loan",
431
+ solTx: "5BcxrMExq34jtMB5c3bH3A8TN4pCp9sxjC5HMcS7Mh8pig3r2eQhvRnJeE1RBTyQ4JDXyANWmDU9SKdYFyT2wDoq",
432
+ executedAt: new Date("February 28, 2024 22:43:21 UTC"),
433
+ symbol: "RENDER",
439
434
  amountPayed: BigInt(1 * Math.pow(10, 8)),
440
435
  },
441
436
  },
442
437
  {
443
438
  transfer: {
444
- toSolKey: '5DGbogKUo8haEYC9Tt4FTHE5ue55bjLC4DpSgE1g6yT1',
439
+ toSolKey: "5DGbogKUo8haEYC9Tt4FTHE5ue55bjLC4DpSgE1g6yT1",
445
440
  fromSolKey: devsSquadsVault,
446
- channel: 'loan',
447
- solTx: '5E4E35CT4e3fhbMAwcKdfAvJL4uUHR8hHE8REmKnDCEsFZ6mxaE1YyeYK8Sbg5AJqBJxsZkcYSohY8T14YLC5pXs',
448
- executedAt: new Date('February 29, 2024 01:17:51 UTC'),
449
- symbol: 'RENDER',
441
+ channel: "loan",
442
+ solTx: "5E4E35CT4e3fhbMAwcKdfAvJL4uUHR8hHE8REmKnDCEsFZ6mxaE1YyeYK8Sbg5AJqBJxsZkcYSohY8T14YLC5pXs",
443
+ executedAt: new Date("February 29, 2024 01:17:51 UTC"),
444
+ symbol: "RENDER",
450
445
  amountPayed: BigInt(199999 * Math.pow(10, 8)),
451
446
  },
452
447
  },
@@ -778,9 +773,44 @@ export class Backfiller {
778
773
  }
779
774
  }
780
775
  }
781
- else if (t == 'loan') {
776
+ else if (t == "loan") {
782
777
  await this.indexLoans();
783
778
  }
779
+ else if (t == "renderComputeNetwork") {
780
+ const trs = await this.solscanClient.getTransfers({
781
+ mint: new PublicKey(renderMint),
782
+ flow: "in",
783
+ addr: new PublicKey(renderComputeNetworkEscrow),
784
+ });
785
+ for (const t of trs) {
786
+ if (!this.isDryRun) {
787
+ console.log(`renderComputeNetwork: ${JSON.stringify(t)}`);
788
+ }
789
+ const { stop } = await this.indexTransfers({ [renderComputeNetworkEscrow]: { mint: renderMint, amt: t.amount } }, { blockTime: t.blockTime, sig: t.sig }, t.fromAddress.toString(), "internal");
790
+ if (stop) {
791
+ break;
792
+ }
793
+ }
794
+ }
795
+ else if (t == "burnRENDERInflow") {
796
+ const trs = await this.solscanClient.getTransfers({
797
+ mint: new PublicKey(renderMint),
798
+ flow: "out",
799
+ addr: new PublicKey(devsSquadsVault),
800
+ });
801
+ for (const t of trs) {
802
+ if (t.toAddress?.toString() !== buyAndBurnEscrow) {
803
+ continue;
804
+ }
805
+ if (!this.isDryRun) {
806
+ console.log(`burnRENDERInflow: ${JSON.stringify(t)}`);
807
+ }
808
+ const { stop } = await this.indexTransfers({ [buyAndBurnEscrow]: { mint: renderMint, amt: t.amount } }, { blockTime: t.blockTime, sig: t.sig }, t.fromAddress.toString(), "internal");
809
+ if (stop) {
810
+ break;
811
+ }
812
+ }
813
+ }
784
814
  }
785
815
  }
786
816
  }
@@ -788,29 +818,27 @@ async function main() {
788
818
  const args = process.argv.slice(2);
789
819
  const getArgValue = (argName) => {
790
820
  const argIndex = args.indexOf(`--${argName}`);
791
- return argIndex !== -1 && argIndex + 1 < args.length
792
- ? args[argIndex + 1]
793
- : undefined;
821
+ return argIndex !== -1 && argIndex + 1 < args.length ? args[argIndex + 1] : undefined;
794
822
  };
795
823
  const hasFlag = (flagName) => {
796
824
  return args.includes(`--${flagName}`);
797
825
  };
798
- const solscanApiKey = getArgValue('solscanApiKey');
826
+ const solscanApiKey = getArgValue("solscanApiKey");
799
827
  if (!solscanApiKey) {
800
- console.error('Error: --solscanApiKey is required');
828
+ console.error("Error: --solscanApiKey is required");
801
829
  process.exit(1);
802
830
  }
803
- const heliusApiKey = getArgValue('heliusApiKey');
831
+ const heliusApiKey = getArgValue("heliusApiKey");
804
832
  if (!heliusApiKey) {
805
- console.error('Error: --heliusApiKey is required');
833
+ console.error("Error: --heliusApiKey is required");
806
834
  process.exit(1);
807
835
  }
808
- const isDryRun = hasFlag('dryRun');
836
+ const isDryRun = hasFlag("dryRun");
809
837
  let pg;
810
838
  if (!isDryRun) {
811
- const pgUrl = getArgValue('pgUrl');
839
+ const pgUrl = getArgValue("pgUrl");
812
840
  if (!pgUrl) {
813
- console.error('Error: --pgUrl is required (unless using --dryRun)');
841
+ console.error("Error: --pgUrl is required (unless using --dryRun)");
814
842
  process.exit(1);
815
843
  }
816
844
  pg = pgClient({
@@ -818,30 +846,38 @@ async function main() {
818
846
  });
819
847
  }
820
848
  const backfiller = new Backfiller(solscanApiKey, heliusApiKey, pg, isDryRun);
821
- if (hasFlag('loans')) {
849
+ if (hasFlag("loans")) {
822
850
  backfiller.loans();
823
851
  }
824
- if (hasFlag('vaultOutflows')) {
852
+ if (hasFlag("vaultOutflows")) {
825
853
  backfiller.vaultOutflows({});
826
854
  }
827
- if (hasFlag('emissions')) {
855
+ if (hasFlag("emissions")) {
828
856
  backfiller.emit();
829
857
  }
830
- if (hasFlag('buyBurnUSDCInflow')) {
858
+ if (hasFlag("buyBurnUSDCInflow")) {
831
859
  backfiller.buyBurnUSDCInflow();
832
860
  }
833
- if (hasFlag('manualMints')) {
861
+ if (hasFlag("manualMints")) {
834
862
  backfiller.manualMint();
835
863
  }
836
- if (hasFlag('loans') ||
837
- hasFlag('vaultOutflows') ||
838
- hasFlag('emissions') ||
839
- hasFlag('buyBurnUSDCInflow') ||
840
- hasFlag('manualMints')) {
864
+ if (hasFlag("renderComputeNetwork")) {
865
+ backfiller.renderComputeNetwork();
866
+ }
867
+ if (hasFlag("burnRENDERInflow")) {
868
+ backfiller.burnRENDERInflow();
869
+ }
870
+ if (hasFlag("loans") ||
871
+ hasFlag("vaultOutflows") ||
872
+ hasFlag("emissions") ||
873
+ hasFlag("buyBurnUSDCInflow") ||
874
+ hasFlag("manualMints") ||
875
+ hasFlag("renderComputeNetwork") ||
876
+ hasFlag("burnRENDERInflow")) {
841
877
  await backfiller.run();
842
878
  }
843
879
  else {
844
- console.log('No operations specified. Available flags: --loans, --vaultOutflows, --emissions, --buyBurnUSDCInflow, --manualMints, --dryRun');
880
+ console.log("No operations specified. Available flags: --loans, --vaultOutflows, --emissions, --buyBurnUSDCInflow, --manualMints, --renderComputeNetwork, --burnRENDERInflow, --dryRun");
845
881
  }
846
882
  }
847
883
  if (require.main === module) {