Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/go_modules/github.com/rs/zerolog-…
Browse files Browse the repository at this point in the history
…1.30.0
  • Loading branch information
gsk967 authored Aug 1, 2023
2 parents 25096f2 + ea52e22 commit 2a84d09
Show file tree
Hide file tree
Showing 26 changed files with 2,598 additions and 337 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
- [2129](https://github.com/umee-network/umee/pull/2129) Emergency Group x/ugov proto.
- [2146](https://github.com/umee-network/umee/pull/2146) Add store `GetTimeMs` and `SetTimeMs`.
- [2157](https://github.com/umee-network/umee/pull/2157) Add `x/metoken` module.
- [2150](https://github.com/umee-network/umee/pull/2150) Add gov message to create Special Asset Pairs
- [2145](https://github.com/umee-network/umee/pull/2145) Add New `Inflation Parms` to x/ugov proto and added `inflation rate` change logic to umint
- [2159](https://github.com/umee-network/umee/pull/2159) Add hard market cap for token emission.
- [2155](https://github.com/umee-network/umee/pull/2155) `bpmath`: basis points math package.
Expand Down
1 change: 1 addition & 0 deletions proto/umee/leverage/v1/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ message GenesisState {
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
];
repeated SpecialAssetPair special_pairs = 10 [(gogoproto.nullable) = false];
}

// AdjustedBorrow is a borrow struct used in the leverage module's genesis
Expand Down
55 changes: 55 additions & 0 deletions proto/umee/leverage/v1/leverage.proto
Original file line number Diff line number Diff line change
Expand Up @@ -249,3 +249,58 @@ message Token {
(gogoproto.moretags) = "yaml:\"historic_medians\""
];
}

// SpecialAssetPair defines a special (increased) CollateralWeight used when a specified Collateral is used
// to collateralize a specified Borrow. This association is one-way (so it does not work in reverse).
message SpecialAssetPair {
option (gogoproto.equal) = true;

// Collateral base token denom.
string collateral = 1;

// Borrow base token denom.
string borrow = 2;

// Collateral Weight defines what portion of the total value of the asset
// can contribute to a users borrowing power. For special asset pairs, this
// also overrides the borrowed asset's collateral weight when evaluating borrow
// factor. Valid values: 0-1.
string collateral_weight = 3 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];

// Liquidation threshold defines what portion of the total value of the assets
// can contribute to a users liquidation threshold, when borrowing within the pair.
// Valid values in range [collateral_weight,1]
string liquidation_threshold = 4 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
}

// SpecialAssetSet defines a special (increased) CollateralWeight used when any of a set
// of assets are used to borrow each other (except for looping). It is used in gov proposals
// to create all the pairs that make up a set at once.
message SpecialAssetSet {
option (gogoproto.equal) = true;

// Collateral or borrowed base token denoms.
repeated string assets = 1;

// Collateral Weight defines what portion of the total value of the assets
// can contribute to a users borrowing power, when borrowing within the set.
// Valid values: 0-1.
string collateral_weight = 2 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];

// Liquidation threshold defines what portion of the total value of the assets
// can contribute to a users liquidation threshold, when borrowing within the set.
// Valid values in range [collateral_weight,1]
string liquidation_threshold = 3 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
}
19 changes: 19 additions & 0 deletions proto/umee/leverage/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ service Query {
option (google.api.http).get = "/umee/leverage/v1/registered_tokens";
}

// SpecialAssets queries for all special asset pairs.
rpc SpecialAssets(QuerySpecialAssets)
returns (QuerySpecialAssetsResponse) {
option (google.api.http).get = "/umee/leverage/v1/special_assets";
}

// MarketSummary queries a base asset's current borrowing and supplying conditions.
rpc MarketSummary(QueryMarketSummary)
returns (QueryMarketSummaryResponse) {
Expand Down Expand Up @@ -100,6 +106,19 @@ message QueryRegisteredTokensResponse {
repeated Token registry = 1 [(gogoproto.nullable) = false];
}

// QuerySpecialAssets defines the request structure for the SpecialAssets
// gRPC service handler.
message QuerySpecialAssets {
// denom can be used to query only pairs affecting a specific asset
string denom = 1;
}

// QuerySpecialAssetsResponse defines the response structure for the
// SpecialAssets gRPC service handler.
message QuerySpecialAssetsResponse {
repeated SpecialAssetPair pairs = 1 [(gogoproto.nullable) = false];
}

// QueryMarketSummary defines the request structure for the MarketSummary gRPC service handler.
message QueryMarketSummary {
string denom = 1;
Expand Down
33 changes: 33 additions & 0 deletions proto/umee/leverage/v1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ service Msg {
// GovUpdateRegistry adds new tokens to the token registry or
// updates existing tokens with new settings.
rpc GovUpdateRegistry(MsgGovUpdateRegistry) returns (MsgGovUpdateRegistryResponse);

// GovUpdateSpecialAssets adds, updates, or removes special asset pairs. Note that a special asset
// pair can be removed by setting its special collateral weight to negative one. Also allows for the creation
// of sets of assets, where each asset in the set forms a special asset pair with all of the others.
rpc GovUpdateSpecialAssets(MsgGovUpdateSpecialAssets) returns (MsgGovUpdateSpecialAssetsResponse);
}

// MsgSupply represents a user's request to supply assets to the module.
Expand Down Expand Up @@ -266,3 +271,31 @@ message MsgGovUpdateRegistry {

// MsgGovUpdateRegistryResponse defines the Msg/GovUpdateRegistry response type.
message MsgGovUpdateRegistryResponse {}

// MsgGovUpdateSpecialAssets defines the Msg/GovUpdateSpecialAssets request type.
message MsgGovUpdateSpecialAssets {
option (gogoproto.equal) = true;
option (gogoproto.goproto_getters) = false;
option (gogoproto.goproto_stringer) = false;
option (cosmos.msg.v1.signer) = "authority";

// authority is the address of the governance account.
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];

// sets are bidirectional groups of special asset pairs. Creating a special asset
// set causes all assets in the set to have a certain collateral weight when borrowing
// against each other (but not looping with themselves). Overrides any existing
// special asset pairs between assets in the set. Using both collateral weight
// and liquidation theshold of zero will clear all existing special pairs in the set instead.
repeated SpecialAssetSet sets = 2 [(gogoproto.nullable) = false];

// pairs are new or updated special asset pairs. Updating both a special asset pair's
// collateral weight and liquidation threshold to zero deletes the pair instead.
// These pairs will be applied after any sets above when passing a proposal,
// so they can be used to override certain set elements, set directional relationships,
// or set an asset's relation to itself (looping).
repeated SpecialAssetPair pairs = 3 [(gogoproto.nullable) = false];
}

// MsgGovUpdateSpecialAssetsResponse defines the Msg/GovUpdateSpecialAssets response type.
message MsgGovUpdateSpecialAssetsResponse {}
Loading

0 comments on commit 2a84d09

Please sign in to comment.