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: add borrow factor #2114

Merged
merged 26 commits into from
Jun 28, 2023
Merged

feat: add borrow factor #2114

merged 26 commits into from
Jun 28, 2023

Conversation

toteki
Copy link
Member

@toteki toteki commented Jun 26, 2023

PR will hold borrow factor logic and altered (and new) test cases

@toteki toteki changed the title cl++ feat: add borrow factor Jun 26, 2023
@codecov
Copy link

codecov bot commented Jun 26, 2023

Codecov Report

Merging #2114 (b499261) into main (7f05ad4) will decrease coverage by 0.75%.
The diff coverage is 77.57%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2114      +/-   ##
==========================================
- Coverage   75.38%   74.64%   -0.75%     
==========================================
  Files         100      127      +27     
  Lines        8025     9881    +1856     
==========================================
+ Hits         6050     7376    +1326     
- Misses       1589     2003     +414     
- Partials      386      502     +116     
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/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% <ø> (ø)
x/leverage/keeper/exchange_rate.go 72.72% <ø> (ø)
x/leverage/keeper/genesis.go 87.23% <ø> (ø)
... and 63 more

... and 25 files with indirect coverage changes

@toteki toteki marked this pull request as ready for review June 26, 2023 22:49
@toteki toteki requested review from a team as code owners June 26, 2023 22:49
Copy link
Member

@robert-zaremba robert-zaremba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Please update the README to specify the borrow factor and how does it impact borrowing
  • why borrow_factor this is capped to 2?
  • I think w should update the VisibleBorrowLimit function

x/leverage/keeper/borrows.go Outdated Show resolved Hide resolved
x/leverage/keeper/oracle.go Outdated Show resolved Hide resolved
x/leverage/types/token.go Show resolved Hide resolved
x/leverage/types/token.go Outdated Show resolved Hide resolved
x/leverage/keeper/oracle.go Outdated Show resolved Hide resolved
x/leverage/keeper/oracle.go Show resolved Hide resolved
x/leverage/keeper/limits.go Show resolved Hide resolved
x/leverage/keeper/borrows.go Show resolved Hide resolved
Copy link
Member

@robert-zaremba robert-zaremba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

x/leverage/README.md Outdated Show resolved Hide resolved
x/leverage/README.md Outdated Show resolved Hide resolved
x/leverage/types/token.go Show resolved Hide resolved
@toteki toteki enabled auto-merge June 28, 2023 01:16
@toteki toteki added this pull request to the merge queue Jun 28, 2023
Merged via the queue into main with commit 426d498 Jun 28, 2023
@toteki toteki deleted the adam/bofactor branch June 28, 2023 01:31
robert-zaremba added a commit that referenced this pull request Jun 28, 2023
* cl++

* cl++

* rephrase test - sign changes based on cpu architecture so strict equal avoided

* implement borrow factor restriction

* fix new uToken calc

* Update x/leverage/keeper/oracle.go

* Update x/leverage/types/token.go

* revert

* revert

* implement borrow factor in userMaxBorrow

* implement userMaxBorrow + cause failing wasm test

* lint

* add denom to test suite registry

* max withdaw test

* withdraw and max withdraw tests

* borrow and maxborrow tests

* renaming suggestion

* halfDec

* rename

* README

* Update x/leverage/README.md

Co-authored-by: Robert Zaremba <robert@zaremba.ch>

* readme suggestions

---------

Co-authored-by: Robert Zaremba <robert@zaremba.ch>
github-merge-queue bot pushed a commit that referenced this pull request Jun 28, 2023
* perf: remove unnecessary null byte

* Apply suggestions from code review

Co-authored-by: Adam Moser <63419657+toteki@users.noreply.github.com>

* feat: add borrow factor (#2114)

* cl++

* cl++

* rephrase test - sign changes based on cpu architecture so strict equal avoided

* implement borrow factor restriction

* fix new uToken calc

* Update x/leverage/keeper/oracle.go

* Update x/leverage/types/token.go

* revert

* revert

* implement borrow factor in userMaxBorrow

* implement userMaxBorrow + cause failing wasm test

* lint

* add denom to test suite registry

* max withdaw test

* withdraw and max withdraw tests

* borrow and maxborrow tests

* renaming suggestion

* halfDec

* rename

* README

* Update x/leverage/README.md

Co-authored-by: Robert Zaremba <robert@zaremba.ch>

* readme suggestions

---------

Co-authored-by: Robert Zaremba <robert@zaremba.ch>

* tests: remove gb from e2e tests (#2119)

* tests: remove gb from e2e tests

* go.mod tidy

---------

Co-authored-by: Adam Moser <63419657+toteki@users.noreply.github.com>
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.

2 participants