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

fix: collateral share restriction works during partial price outages #1812

Merged
merged 4 commits into from
Feb 14, 2023

Conversation

toteki
Copy link
Member

@toteki toteki commented Feb 13, 2023

When some token prices are missing from the oracle, it becomes impossible to calculate a token's collateral share.

However, if the collateralized token's price is known, and enough other token prices are known to prove that it cannot possibly be over its MaxCollateralShare, then we can let MsgSupplyCollateral or MsgCollateralize succeed anyway.

@toteki toteki marked this pull request as ready for review February 13, 2023 17:25
@toteki toteki requested review from a team as code owners February 13, 2023 17:25
@codecov-commenter
Copy link

codecov-commenter commented Feb 13, 2023

Codecov Report

Merging #1812 (ef3c42c) into main (c67510e) will increase coverage by 0.12%.
The diff coverage is 88.88%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1812      +/-   ##
==========================================
+ Coverage   57.79%   57.92%   +0.12%     
==========================================
  Files          78       78              
  Lines        8026     8049      +23     
==========================================
+ Hits         4639     4662      +23     
  Misses       3049     3049              
  Partials      338      338              
Impacted Files Coverage Δ
x/leverage/keeper/collateral.go 69.76% <88.88%> (+3.72%) ⬆️
x/leverage/keeper/oracle.go 64.34% <0.00%> (+2.32%) ⬆️

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.

pre-approving.

x/leverage/keeper/collateral.go Show resolved Hide resolved
x/leverage/keeper/collateral.go Show resolved Hide resolved
@toteki toteki merged commit e23e4fc into main Feb 14, 2023
@toteki toteki deleted the adam/outages branch February 14, 2023 03:55
mergify bot pushed a commit that referenced this pull request Feb 14, 2023
…1812)

* fix: collateral share restriction works during partial price outages

* cl++

* add info logs

---------

Co-authored-by: Robert Zaremba <robert@zaremba.ch>
(cherry picked from commit e23e4fc)

# Conflicts:
#	CHANGELOG.md
#	x/leverage/keeper/msg_server_test.go
toteki pushed a commit that referenced this pull request Feb 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants