-
-
Notifications
You must be signed in to change notification settings - Fork 256
feat: add token minimum balance calculation and response type #7269
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
feat: add token minimum balance calculation and response type #7269
Conversation
|
@metamaskbot publish-preview |
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
| this.#getSubscriptionBalanceAmount(price), | ||
| ); | ||
|
|
||
| const tokenDecimal = new BigNumber(10).pow(tokenPaymentInfo.decimals); |
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.
using tokenDecimal name is not correct here, normally tokenDecimal is 6 or 9 or 18
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 one is for calculating token amount so it use token decimal, price unit decimal is used in #getSubscriptionBalanceAmount (same as getTokenApproveAmount)
Explanation
This PR
minBillingCyclesForBalancetoProductPricetypegetTokenMinimumBalanceAmountmethod toSubscriptionControllerReferences
Checklist
Note
Add
minBillingCyclesForBalanceandgetTokenMinimumBalanceAmountto compute minimum token balance, with tests and minor docs updates.#getSubscriptionBalanceAmount(price)and publicgetTokenMinimumBalanceAmount(price, tokenPaymentInfo)to compute minimum token balance using conversion rates; throws on missing rate.#getSubscriptionPriceAmount.ProductPricewithminBillingCyclesForBalance.minBillingCyclesForBalance.getTokenMinimumBalanceAmount, including error on missing conversion rate.Written by Cursor Bugbot for commit 6e482ee. This will update automatically on new commits. Configure here.