-
Notifications
You must be signed in to change notification settings - Fork 295
feat: add script for fetching TRX balance that can be consolidated #6517
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
5b6481b
to
7d42b9b
Compare
@@ -0,0 +1,51 @@ | |||
/** | |||
* Copyright 2024, BitGo, Inc. All Rights Reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: 2025
console.log('TRX balance: ', spendableBalanceString); | ||
|
||
if (usdtBalance > 0 && spendableBalanceString > 36000000) { | ||
const data = `${address}, USDT balance: ${usdtBalance}, TRX balance: ${spendableBalanceString}, V1: ${needsConsolidation}, V2: ${tokenConsolidationState['trx']}\n`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
V2: ${tokenConsolidationState['trx']
why console v2 flag related to trx and not token, trying to understand the reason
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we're only printing the flag states for TRX because we're finding the TRX balance that can be consolidated
if incase there's some TRX that can be consolidated but V2 flag is false, we need to reset, hence TRX
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, my only concern is that if client is having some other supported token, then this won't be able to fetch the correct addresses as more amount will be blocked
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, this was written for a specific case, but we can tweak this to work on any token; can do that as a followup
fs.appendFileSync('addresses-with-usdt-balance-and-trx-greater-than-36.txt', data); | ||
} | ||
|
||
if ((!usdtBalance || usdtBalance <= 0) && spendableBalanceString > 1000000) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what list of addresses are you trying to get here? Should we check addresses having no tokens and spendable greater than 1000000?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is for addresses which don't have USDT (this code is specific to a client usecase who had only USDT and TRX, hence we only have these 2 conditions, but can be adapted to other tokens or multiple tokens as well) but TRX
we want this because, we've already checked the addresses which have both USDT and TRX prior
Ticket: COIN-00000