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!: allow amount-specific control of collateral #1029

Merged
merged 37 commits into from
Jul 4, 2022
Merged

Conversation

toteki
Copy link
Member

@toteki toteki commented Jun 16, 2022

Description

Removes true/false collateral settings.

Instead, users add or remove exact amounts of uTokens as collateral.

This will allow more fine-grained control, helping advanced users as well as possibly preparing us for more advanced liquidity pool design.

Closes #904


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...

  • included the correct type prefix in the PR title
  • added appropriate labels to the PR
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

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...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@toteki
Copy link
Member Author

toteki commented Jun 16, 2022

Couple tweaks to the sim tests still needed

@codecov-commenter
Copy link

codecov-commenter commented Jun 27, 2022

Codecov Report

Merging #1029 (165bf5c) into main (1401e8d) will increase coverage by 0.40%.
The diff coverage is 39.48%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1029      +/-   ##
==========================================
+ Coverage   43.31%   43.72%   +0.40%     
==========================================
  Files          65       65              
  Lines        8381     8298      -83     
==========================================
- Hits         3630     3628       -2     
+ Misses       4502     4421      -81     
  Partials      249      249              
Impacted Files Coverage Δ
x/leverage/client/cli/query.go 0.00% <ø> (ø)
x/leverage/client/cli/tx.go 0.00% <0.00%> (ø)
x/leverage/keeper/genesis.go 2.58% <ø> (+0.42%) ⬆️
x/leverage/keeper/grpc_query.go 5.91% <ø> (+0.31%) ⬆️
x/leverage/keeper/msg_server.go 0.84% <0.00%> (-0.12%) ⬇️
x/leverage/keeper/store.go 70.52% <ø> (+1.43%) ⬆️
x/leverage/simulation/decoder.go 0.00% <ø> (ø)
x/leverage/simulation/genesis.go 0.00% <ø> (ø)
x/leverage/types/genesis.go 9.19% <0.00%> (+1.19%) ⬆️
x/leverage/types/keys.go 52.38% <ø> (+1.83%) ⬆️
... and 11 more

@toteki toteki marked this pull request as ready for review June 27, 2022 23:40
@toteki toteki requested review from a team as code owners June 27, 2022 23:40
@RafilxTenfen
Copy link
Contributor

The protobuf / breakage is expected to fail?

@toteki
Copy link
Member Author

toteki commented Jun 28, 2022

The protobuf / breakage is expected to fail?

Yeah, this breaks the API of Set -> Add/Remove Collateral

@RafilxTenfen
Copy link
Contributor

RafilxTenfen commented Jun 28, 2022

So, right now if someone has already supplied 1k token and set 1k as collateral
if they add more supply like 2k, they will need to add more 2k as collateral?

@toteki
Copy link
Member Author

toteki commented Jun 28, 2022

So, right now if someone has already supplied 1k token and set 1k as collateral if they add more supply like 2k, they will need to add more 2k as collateral?

Yeah, if this merges they'll need to do an additional AddCollateral(2k).
In current main branch, it would be done automatically.

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 add more details to the changelog
  • overall good work, nice to see general code reduction (diff is negative) 👍

proto/umee/leverage/v1/query.proto Show resolved Hide resolved
proto/umee/leverage/v1/tx.proto Show resolved Hide resolved
proto/umee/leverage/v1/tx.proto Outdated Show resolved Hide resolved
x/leverage/client/cli/tx.go Outdated Show resolved Hide resolved
x/leverage/client/cli/tx.go Outdated Show resolved Hide resolved
x/leverage/client/cli/tx.go Outdated Show resolved Hide resolved
x/leverage/keeper/keeper.go Outdated Show resolved Hide resolved
x/leverage/keeper/keeper.go Show resolved Hide resolved
x/leverage/simulation/operations_test.go Show resolved Hide resolved
CHANGELOG.md Outdated 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.

utACK

  1. please add few comments to the proto
  2. this PR can't be backported to v2.x - it's breaking

proto/umee/leverage/v1/tx.proto Show resolved Hide resolved
proto/umee/leverage/v1/tx.proto Show resolved Hide resolved
@toteki toteki merged commit 644dcc1 into main Jul 4, 2022
@toteki toteki deleted the adam/collateral branch July 4, 2022 15:44
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.

x/leverage: Improve MsgSetCollateral
4 participants