-
Notifications
You must be signed in to change notification settings - Fork 103
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
refactor(x/ecocredit): update credit to basket conversion and docs #1559
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #1559 +/- ##
==========================================
- Coverage 78.68% 78.68% -0.01%
==========================================
Files 251 251
Lines 18850 18849 -1
==========================================
- Hits 14833 14832 -1
Misses 3153 3153
Partials 864 864
|
|
||
// creditAmountToBasketCoin calculates the coins to mint to the credit depositor using the following formula: | ||
// coinAmount = creditAmt * (1 * 10^exp) | ||
func creditAmountToBasketCoin(creditAmt math.Dec, exp uint32, denom string) (sdk.Coin, error) { |
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.
simplified this to 1 Coin
, since we never returned more than one
@@ -87,6 +89,58 @@ func TestGetBasketBalances(t *testing.T) { | |||
require.Equal(t, IDToBalance[2], amtToDeposit) | |||
} | |||
|
|||
func FuzzCreditAmountToBasketCoin(f *testing.F) { |
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.
added a fuzz test to ensure we are properly converting credit decimal amounts to basket token integers.
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.
Lgtm
Should we break this out into separate pull requests? Or at least update the title? |
no preference here, i updated title to something more generic, can break apart if that makes more sense |
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.
Oof. Forgot to submit my review comments. A couple small suggestions / questions.
Also, chore
should only be used when updating non-production code.
- https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json#L39-L42
- https://github.com/regen-network/regen-ledger/blob/main/CONTRIBUTING.md#using-semantic-commits
If we are making doc updates, adding a test, and refactoring production code in the same pull request, the title should probably favor the production code changes. This is a blend of docs, test, and refactor so maybe refactor would make the most sense?
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.
Pre-approving. Just a couple more minor comments/suggestions.
Co-authored-by: Ryan Christoffersen <12519942+ryanchristo@users.noreply.github.com>
Description
ref: #1456
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
to the type prefix if API or client breaking changeCHANGELOG.md
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
!
in the type prefix if API or client breaking change