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(token registry): proto max collateral share #1096

Merged
merged 22 commits into from
Jul 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
- [913](https://github.com/umee-network/umee/pull/913) Changed update registry gov proposal to add and update tokens, but never delete them.
- [918](https://github.com/umee-network/umee/pull/918) Add MarketSummary query to CLI.
- [1068](https://github.com/umee-network/umee/pull/1068) Add a cache layer for token registry.
- [1096](https://github.com/umee-network/umee/pull/1096) Add `max_collateral_share` to the x/leverage token registry.
- [1094](https://github.com/umee-network/umee/pull/1094) Added TotalCollateral query.
- [1099](https://github.com/umee-network/umee/pull/1099) Added TotalBorrowed query.

Expand Down
9 changes: 9 additions & 0 deletions proto/umee/leverage/v1/leverage.proto
Original file line number Diff line number Diff line change
Expand Up @@ -139,4 +139,13 @@ message Token {
// and enable_msg_borrow set to false. Such tokens can be safely removed from the
// oracle and price feeder as well.
bool blacklist = 14;

// Maximum collateral share specifies how much of the
// system's overall collateral be provided by a single token.
// Value is a percent; allowed values are in [0, 100] range.
// 100 means that the token has no restriction. 10 means maximum 10% of total
// collateral value can provided by this token.
uint32 max_collateral_share = 15 [
(gogoproto.moretags) = "yaml:\"max_collateral_share\""
];
}
1 change: 1 addition & 0 deletions x/leverage/spec/02_state.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,6 @@ type Token struct {
EnableMsgSupply bool
EnableMsgBorrow bool
Blacklist bool
MaxCollateralShare uint32
}
```
143 changes: 94 additions & 49 deletions x/leverage/types/leverage.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions x/leverage/types/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ func (t Token) Validate() error {
}
}

if t.MaxCollateralShare > 100 {
return sdkerrors.ErrInvalidRequest.Wrap("Token.MaxCollateralShare must be in [0; 100] range")
}

return nil
}

Expand Down
Loading