-
Notifications
You must be signed in to change notification settings - Fork 1
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
Ready: monitor the funding account of vortex #277
base: polygon-prototype-staging
Are you sure you want to change the base?
Ready: monitor the funding account of vortex #277
Conversation
✅ Deploy Preview for pendulum-pay ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@Sharqiewicz can you please merge or rebase the latest |
…-account-of-vortex
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.
Looks good overall, though I would appreciate if we add some mechanism that limits the number of duplicate messages emitted to one per .. 6 hours maybe? So we avoid spamming the channel. Each type of warning should have its own timer though.
|
||
// ensure we have at the very least 10 XLM in the account | ||
if (Number(stellarBalance.balance) < STELLAR_FUNDING_AMOUNT_UNITS) { | ||
slackNotifier.sendMessage({ | ||
text: `Current balance of funding account is ${stellarBalance.balance} XLM please charge this account ${FUNDING_PUBLIC_KEY}.`, |
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.
text: `Current balance of funding account is ${stellarBalance.balance} XLM please charge this account ${FUNDING_PUBLIC_KEY}.`, | |
text: `Current balance of funding account is ${stellarBalance.balance} XLM, please charge the account ${FUNDING_PUBLIC_KEY}.`, |
text: `Current balance of funding account is ${divideByPowerOfTen( | ||
nativeBalance, | ||
).toString()} PEN please charge this account ${fundingAccountKeypair.address}.`, |
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.
text: `Current balance of funding account is ${divideByPowerOfTen( | |
nativeBalance, | |
).toString()} PEN please charge this account ${fundingAccountKeypair.address}.`, | |
text: `Current balance of funding account is ${divideByPowerOfTen( | |
nativeBalance, | |
).toString()} PEN, please charge the account ${fundingAccountKeypair.address}.`, |
text: `Current balance of funding account is ${nativeToDecimal( | ||
remainingMaxSubsidiesAvailable, | ||
).toString()} ${token} please charge this account ${fundingAccountKeypair.address}.`, |
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.
text: `Current balance of funding account is ${nativeToDecimal( | |
remainingMaxSubsidiesAvailable, | |
).toString()} ${token} please charge this account ${fundingAccountKeypair.address}.`, | |
text: `Current balance of funding account is ${nativeToDecimal( | |
remainingMaxSubsidiesAvailable, | |
).toString()} ${token}, please charge the account ${fundingAccountKeypair.address}.`, |
|
||
if (balance < minimumBalance) { | ||
slackService.sendMessage({ | ||
text: `Current balance of funding account is ${balance} GLMR please charge this account ${moonbeamExecutorAccount.address}.`, |
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.
text: `Current balance of funding account is ${balance} GLMR please charge this account ${moonbeamExecutorAccount.address}.`, | |
text: `Current balance of funding account is ${balance} GLMR, please charge the account ${moonbeamExecutorAccount.address}.`, |
|
||
if (balance < minimumBalance) { | ||
slackService.sendMessage({ | ||
text: `Current balance of funding account is ${balance} GLMR please charge this account ${moonbeamExecutorAccount.address}.`, |
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.
balance
is the raw amount, not the unit amount, correct? In that case can we write
text: `Current balance of funding account is ${balance} GLMR please charge this account ${moonbeamExecutorAccount.address}.`, | |
text: `Current balance of funding account is ${balance.div(Big(10).pow(18)).toFixed(2,0)} GLMR please charge this account ${moonbeamExecutorAccount.address}.`, |
|
||
slackNotifier.sendMessage({ | ||
text: `Current balance of funding account is ${nativeToDecimal( | ||
remainingMaxSubsidiesAvailable, |
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.
remainingMaxSubsidiesAvailable
is actually not a currency amount but just a number counting how many subsidies are still possible with the remaining funds, assuming that every subsidy requires the maximum amount. Therefore nativeToDecimal
does not make sense here.
Or you use tokenBalance
instead of remainingMaxSubsidiesAvailable
.
if (nativeBalance.gte(minimumBalanceFundingAccount) && isTokensSufficient) { | ||
return { status: true, public: fundingAccountKeypair.address }; | ||
} | ||
slackNotifier.sendMessage({ |
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.
It could be that we reach this point just because isTokensSufficient
is false – in that case we already sent an error message above.
We only need to send this message if nativeBalance.gte(minimumBalanceFundingAccount)
.
Furthermore, don't forget the second argument apiData.decimals
for divideByPowerOfTen
.
🦈 🟢 PR
@slack/web-api
SLACK_WEB_HOOK_TOKEN
env variablemoonbeam
(GLMR),pendulum
(EUR, USDC.axl, PEN),stellar
(XLM)