Skip to content
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: basis points math package #2155

Merged
merged 9 commits into from
Jul 19, 2023
Merged

feat: basis points math package #2155

merged 9 commits into from
Jul 19, 2023

Conversation

robert-zaremba
Copy link
Member

Description

New package to optimize arithmetic computation when we need to deal with fraction number of basis points.
There is no precision lost for operations like a * b where a or b is basis points, and the other variable is Int.

@robert-zaremba robert-zaremba requested a review from a team as a code owner July 19, 2023 09:26
@codecov
Copy link

codecov bot commented Jul 19, 2023

Codecov Report

Merging #2155 (ce62625) into main (7f05ad4) will decrease coverage by 0.68%.
The diff coverage is 77.87%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2155      +/-   ##
==========================================
- Coverage   75.38%   74.71%   -0.68%     
==========================================
  Files         100      129      +29     
  Lines        8025    10002    +1977     
==========================================
+ Hits         6050     7473    +1423     
- Misses       1589     2025     +436     
- Partials      386      504     +118     
Impacted Files Coverage Δ
ante/spam_prevention.go 75.92% <ø> (ø)
x/incentive/codec.go 47.82% <ø> (+9.89%) ⬆️
x/incentive/keeper/invariants.go 0.00% <0.00%> (ø)
x/incentive/msgs.go 77.41% <ø> (-0.81%) ⬇️
x/incentive/params.go 89.28% <ø> (-10.72%) ⬇️
x/leverage/client/tests/suite.go 100.00% <ø> (ø)
x/leverage/client/tests/tests.go 100.00% <ø> (ø)
x/leverage/keeper/borrows.go 75.93% <ø> (-2.64%) ⬇️
x/leverage/keeper/collateral.go 72.72% <ø> (-0.16%) ⬇️
x/leverage/keeper/errors.go 100.00% <ø> (ø)
... and 57 more

... and 34 files with indirect coverage changes

util/bpmath/bp.go Outdated Show resolved Hide resolved
util/bpmath/fixed_bp.go Outdated Show resolved Hide resolved
util/bpmath/types.go Outdated Show resolved Hide resolved
util/bpmath/types.go Outdated Show resolved Hide resolved
robert-zaremba and others added 2 commits July 19, 2023 12:02
Co-authored-by: Adam Moser <63419657+toteki@users.noreply.github.com>
@robert-zaremba robert-zaremba requested a review from toteki July 19, 2023 10:04
util/bpmath/bp.go Outdated Show resolved Hide resolved
@robert-zaremba robert-zaremba added this pull request to the merge queue Jul 19, 2023
Merged via the queue into main with commit b52a3b7 Jul 19, 2023
@robert-zaremba robert-zaremba deleted the robert/basis-points branch July 19, 2023 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants