Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # 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 4 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 @@ -57,6 +57,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_supply` to the x/leverage token registry.

### Improvements

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_borrow set to false. Such tokens can be safely removed from the
// oracle and price feeder as well.
bool blacklist = 14;

// Maximum allowed collateral supply specifies how much of the token can
// be provided in total as a collateral in the system.
// Value is provided in pre cent, 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_supply = 15 [
(gogoproto.moretags) = "yaml:\"max_collateral_supply\""
];
}
147 changes: 96 additions & 51 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.MaxCollateralSupply > 100 {
return sdkerrors.ErrInvalidRequest.Wrap("Token.MaxCollateralSupply must be in [0; 100] range")
}

return nil
}

Expand Down
Loading