diff --git a/CHANGELOG.md b/CHANGELOG.md index cb9f9e5907..e1df3ecc62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ - [1029](https://github.com/umee-network/umee/pull/1029) Removed MsgSetCollateral(addr,denom,bool), and replaced with MsgAddCollateral(addr,coin) and MsgRemoveCollateral(addr,coin) - [1023](https://github.com/umee-network/umee/pull/1023) Restrict MsgWithdraw to only uToken input (no base token auto-convert) +- [1106](https://github.com/umee-network/umee/pull/1106) Rename Lend to Supply, including MsgLendAsset, Token EnableLend, docs, and internal functions. Also QueryLoaned similar queries to QuerySupplied. ### Features diff --git a/app/test_helpers.go b/app/test_helpers.go index 54f06ef955..6084fdf229 100644 --- a/app/test_helpers.go +++ b/app/test_helpers.go @@ -118,7 +118,7 @@ func IntegrationTestNetworkConfig() network.Config { MaxBorrowRate: sdk.MustNewDecFromStr("1.50000000000000000"), KinkUtilization: sdk.MustNewDecFromStr("0.200000000000000000"), LiquidationIncentive: sdk.MustNewDecFromStr("0.180000000000000000"), - EnableMsgLend: true, + EnableMsgSupply: true, EnableMsgBorrow: true, Blacklist: false, }) diff --git a/docs/architecture/ADR-001-interest-stream.md b/docs/architecture/ADR-001-interest-stream.md index 1bbcd34518..bbfbd6e67d 100644 --- a/docs/architecture/ADR-001-interest-stream.md +++ b/docs/architecture/ADR-001-interest-stream.md @@ -52,11 +52,11 @@ As an alternative, transfer of uTokens via IBC could be forbidden or unsupported - Requirement: Umee chain stores uAsset <-> Asset exchange rate for each asset (not 1:1) -In this implementation, for each whitelisted Cosmos asset type, the Umee chain stores an "exchange rate" between the base asset and its associated uToken. The exchange rate starts equal to 1, and increases whenever interest would have been applied to uToken balances in the original implementation. Whenever a lender deposits or withdraws base assets for uToken, this exchange rate is used. +In this implementation, for each whitelisted Cosmos asset type, the Umee chain stores an "exchange rate" between the base asset and its associated uToken. The exchange rate starts equal to 1, and increases whenever interest would have been applied to uToken balances in the original implementation. Whenever a user supplies or withdraws base assets for uToken, this exchange rate is used. Example scenario: -> Two lenders Alice and Bob provide Atoms to the asset facility at different times and earn interest. Assume that for the duration of this scenario, the interest on deposited uAtoms is 0.1 percent per week (or 1 atom per week per 1000 deposited). +> Two users Alice and Bob supply Atoms to the asset facility at different times and earn interest. Assume that for the duration of this scenario, the interest on deposited uAtoms is 0.1 percent per week (or 1 atom per week per 1000 deposited). > > The asset facility starts with 0 atoms in custody and 0 uAtoms in circulation. The exchange rate of Atom:uAtom starts at 1. > diff --git a/docs/architecture/ADR-002-deposit-assets.md b/docs/architecture/ADR-002-deposit-assets.md index 117734bc9a..f72dd308d7 100644 --- a/docs/architecture/ADR-002-deposit-assets.md +++ b/docs/architecture/ADR-002-deposit-assets.md @@ -13,11 +13,11 @@ Accepted One of the base functions of the Umee universal capital facility is to allow liquidity providers to deposit assets, and earn interest on their deposits. -The associated feature “Lender deposits asset for uToken & redeems uToken for a single Cosmos asset type" was initially discussed as follows: +The associated feature “User supplies asset for uToken & redeems uToken for a single Cosmos asset type" was initially discussed as follows: -- Lender deposits (locks) a Cosmos asset (like Atoms or Umee) into asset facilities. +- User supplies (locks) a Cosmos asset (like Atoms or Umee) into asset facilities. - Facility mints and sends u-Assets in response (u-Atom, u-umee). -- Lender redeems u-Assets for the original assets. +- User redeems u-Assets for the original assets. - Asset facility knows its current balances of all asset types. - Asset facility knows the amount of all u-Asset types in circulation. @@ -71,21 +71,21 @@ The `sdk.Coins` type is a slice (ordered list) of `sdk.Coin` which contains a de Asset Facility deposit functionality is provided by the two following message types: ```go -// MsgLendAsset - a lender wishes to deposit assets and receive uAssets -type MsgLendAsset struct { - Lender sdk.AccAddress `json:"lender" yaml:"lender"` +// MsgSupply - a user wishes to deposit assets and receive uAssets +type MsgSupply struct { + Supplier sdk.AccAddress `json:"supplier" yaml:"supplier"` Amount sdk.Coin `json:"amount" yaml:"amount"` } // MsgWithdrawAsset - redeems uAsset for original assets type MsgWithdrawAsset struct { - // Lender is the owner of the uAsset - Lender sdk.AccAddress `json:"lender" yaml:"lender"` + // Supplier is the owner of the uAsset + Supplier sdk.AccAddress `json:"supplier" yaml:"supplier"` Amount sdk.Coin `json:"amount" yaml:"amount"` } ``` -This resembles the built-in MsgSend, but either ToAddress or FromAddress is removed because the module's address should be used automatically. The remaining address is that of the lender. +This resembles the built-in MsgSend, but either ToAddress or FromAddress is removed because the module's address should be used automatically. The remaining address is that of the supplier. MsgDepositAsset must use only allow-listed, non-uToken denominations. MsgWithdrawAsset must use only uToken denominations. @@ -93,11 +93,11 @@ These messages should trigger the appropriate reaction (disbursement of uTokens _Note: The `Coin` type seen in the `Amount` fields contains a single token denomination and amount._ -It is necessary that `MsgLendAsset` and `MsgWithdrawAsset` be signed by the lender's account. According to the [Transactions Page](https://docs.cosmos.network/master/core/transactions.html) +It is necessary that `MsgSupply` and `MsgWithdrawAsset` be signed by the supplier's account. According to the [Transactions Page](https://docs.cosmos.network/master/core/transactions.html) > Every message in a transaction must be signed by the addresses specified by its GetSigners. -Thus `MsgLendAsset.GetSigners` and `MsgWithdrawAsset.GetSigners` should return the `Lender` address. +Thus `MsgSupply.GetSigners` and `MsgWithdrawAsset.GetSigners` should return the `Supplier` address. ### API @@ -105,7 +105,7 @@ Both CLI and gRPC must be supported when sending the above message types, and al ### Testing -Assuming a placeholder token allow-list of one element (e.g. `umee`), and a uToken existing (e.g. `u-umee`), an end-to-end test can be created in which one user account sends a `MsgLendAsset` and a `MsgWithdrawAsset` of the appropriate token types. +Assuming a placeholder token allow-list of one element (e.g. `umee`), and a uToken existing (e.g. `u-umee`), an end-to-end test can be created in which one user account sends a `MsgSupply` and a `MsgWithdrawAsset` of the appropriate token types. ## Considerations diff --git a/docs/architecture/ADR-003-borrow-assets.md b/docs/architecture/ADR-003-borrow-assets.md index b5b150d792..056d526f16 100644 --- a/docs/architecture/ADR-003-borrow-assets.md +++ b/docs/architecture/ADR-003-borrow-assets.md @@ -65,14 +65,14 @@ collateral_utilization(tokenA) = total_collateral(tokenA) / available_supply(tok Note: system must not allow to have available_supply to equal zero. Intuition: we want collateral utilization to grow when there is less liquid tokenA available in the system to cover the liquidation. -Collateral utilization of tokenA is growing when lenders withdraw their tokenA collateral or when borrowers take a new loan of tokenA. +Collateral utilization of tokenA is growing when suppliers withdraw their tokenA collateral or when borrowers take a new loan of tokenA. If a `tokenA` is not used a collateral then it's _collateral utilization_ is zero. It is bigger than 1 when available supply is lower than the amount of `tokenA` used as a collateral. When it is `N`, it means that only `1/N` of the collateral is available for redemption (u/tokenA -> tokenA). #### Examples -Let's say we have 1000A (token A) provided to a system for lending. Below let's consider a state with total amount of A borrowed (B) and total amount of B used as a collateral (C) and computed collateral utilization (CU): +Let's say we have 1000A (token A) supplied to the system (for lending or collateral). Below let's consider a state with total amount of A borrowed (B) and total amount of B used as a collateral (C) and computed collateral utilization (CU): 1. B=0, C=0 → CU=0 1. B=0, C=500 → CU=0.5 @@ -88,7 +88,7 @@ Let's say we have 1000A (token A) provided to a system for lending. Below let's High collateral utilization is dangerous for the system: -- When collateral utilization is above 1, lenders may not be able to withdraw their the liquidated collateral. +- When collateral utilization is above 1, liquidators may not be able to withdraw their the liquidated collateral. - Liquidators, when liquidating a borrower, they get into position their _uToken_. In case of bad market conditions and magnified liquidations, liquidators will like to redeem the _uToken_ for the principle (the underlying token). However, when there are many `uToken` redeem operation, the collateral utilization is approaching to 1 and liquidators won't be able to get the principle and sell it to monetize their profits. @@ -96,12 +96,12 @@ This will dramatically increase the risk of getting a profit by liquidators and Let's draw the following scenario to picture the liquidators risk: -1. Alice is providing \$1.2M USD for lending. +1. Alice is providing \$1.2M USD supply. 2. Bob is providing \$1.5M in Luna as a collateral and borrows 1M USD from Alice. 3. Charlie provides \$2M in BTC as a collateral and borrows $1.4M in Luna from Bob. 4. Charlie predicts Luna collapse and sells the Luna. 5. Luna is sinking and Bob position has to be liquidated. However: - - Lenders can liquidate Bob, but they can only redeem up to 6.6% of `u/Luna` because the rest is not available (Charlie borrowed it). + - Suppliers can liquidate Bob, but they can only redeem up to 6.6% of `u/Luna` because the rest is not available (Charlie borrowed it). - Charlie will not pay off her borrow position - she will wait for the final collapse and buy Luna cheaply. - Liquidators will not take the risk of obtaining and holding `u/Luna` when there is a risk of Luna sinking deep. 6. In case of the big crash, liquidators won't perform a liquidation, Bob will run away with 1M USD, system will end up with a bad debt and obligation to pay Alice. @@ -184,7 +184,7 @@ In contrast, if we had put tokenDenom before borrower address, it would favor op ### Positive -- uTokens used as a collateral increase in base asset value in the same way that lends positions do. This counteracts borrow position interest. +- uTokens used as a collateral increase in base asset value in the same way that supply positions do. This counteracts borrow position interest. - UX of enabling/disabling token types as collateral is simpler than depositing specific amounts - `lengthPrefixed(borrowerAddress) | tokenDenom` key pattern facilitates getting open borrow and collateral positions by account address. diff --git a/docs/architecture/ADR-004-interest-and-reserves.md b/docs/architecture/ADR-004-interest-and-reserves.md index cf9ddbb03c..4ec022055a 100644 --- a/docs/architecture/ADR-004-interest-and-reserves.md +++ b/docs/architecture/ADR-004-interest-and-reserves.md @@ -13,9 +13,9 @@ Accepted ## Context Borrow positions on Umee accrue interest over time. -When interest accrues, the sum of all assets owed by all users increases for each borrowed token denomination. The amount of that increase serves to benefit lenders (by increasing the token:uToken exchange rate), and also to increase the amount of base assets the Umee system holds in reserve. +When interest accrues, the sum of all assets owed by all users increases for each borrowed token denomination. The amount of that increase serves to benefit suppliers (by increasing the token:uToken exchange rate), and also to increase the amount of base assets the Umee system holds in reserve. -The mechanism by which interest is calculated, and then split between incentivizing lenders as per [ADR-001](./ADR-001-interest-stream.md) and reserves as defined in this ADR, will follow. +The mechanism by which interest is calculated, and then split between incentivizing suppliers as per [ADR-001](./ADR-001-interest-stream.md) and reserves as defined in this ADR, will follow. ## Decision @@ -70,7 +70,7 @@ We modify the Compound formula to use collateral utilization rather than supply The `x/leverage` module keeper will contain a function which accrues interest on all open borrow positions at once, which is called when `EndBlock` detects that has elapsed. -The accrued interest is split between protocol reserves and lender profits as explained in the following sections. +The accrued interest is split between protocol reserves and supplier profits as explained in the following sections. ```go func (k Keeper) AccrueAllInterest(ctx sdk.Context) error { @@ -131,13 +131,13 @@ for _, coin := range newReserves { The token:uToken exchange rate, which would have previously been calculated by `(total tokens borrowed + module account balance) / uTokens in circulation` for a given token and associated uToken, must now be computed as `(total tokens borrowed + module account balance - reserved amount) / uTokens in circulation`. -Also, because Lend, Withdraw, Borrow, and Repay transactions don't affect the token:uToken exchange rate, it's enough to update the exchange rate during the EndBlocker `AccrueAllInterest`. +Also, because Supply, Withdraw, Borrow, and Repay transactions don't affect the token:uToken exchange rate, it's enough to update the exchange rate during the EndBlocker `AccrueAllInterest`. ### Modifications to Withdraw and Borrow Existing functionality will be modified: -- Asset withdrawal (by lenders) will not permit withdrawals that would reduce the module account's balance of a token to below the reserved amount of that token. +- Asset withdrawal (by suppliers) will not permit withdrawals that would reduce the module account's balance of a token to below the reserved amount of that token. - Asset borrowing (by borrowers) will not permit borrows that would do the same. ### Example Scenarios @@ -160,18 +160,18 @@ Note that the module "reserved amount" has increased, but not the actual balance Here is an additional example scenario, to illustrate that the module account balance of a given token _can_ become less than the reserved amount, when a token type is at or near 100% supply utilization: > Lending pool and reserve amount of `atom` both start at zero. -> Bob, lends 1000 `atom` to the lending pool. +> Bob, supplies 1000 `atom` to the lending pool. > Alice immediately borrows all 1000 `atom`. > > During the next `EndBlock`. Alice now owes 1000.001 `atom`. The amount of `uatom` the module is required to reserve increases from 0 to 50 (assuming the `ReserveFactor` parameter is 0.05 like in the previous example). > > The module account (lending pool + reserves) still contains 0 `uatom` due to the first two steps. Its `uatom` balance is therefore less than the required 50 `uatom` reserves. -The scenario above is not fatal to our model - Bob (lender) continues to gain value as the token:uToken exchange rate increases, and we are not storing any negative numbers in place of balances - but the next 50 `uatom` lent by a lender or repaid by a borrower will be blocked for the reserve requirements rather than being immediately available for borrowing or withdrawal. +The scenario above is not fatal to our model - Bob (supplier) continues to gain value as the token:uToken exchange rate increases, and we are not storing any negative numbers in place of balances - but the next 50 `uatom` supplied by a supplier or repaid by a borrower will be blocked for the reserve requirements rather than being immediately available for borrowing or withdrawal. The edge case above can only occur when the available lending pool (i.e. module account balance minus reserve requirements) for a specific token denomination, is less than `ReserveFactor` times the interest accrued on all open loans for that token in a single block. In practical terms, that means ~100% supply utilization. -This is not a threatening scenario, as it resolves as soon as either a sufficient `RepayAsset` or a `LendAsset` is made in the relevant asset type, both of which are **highly** incentivized by the extreme dynamic interest rates found near 100% utilization. +This is not a threatening scenario, as it resolves as soon as either a sufficient `RepayAsset` or a `MsgSupply` is made in the relevant asset type, both of which are **highly** incentivized by the extreme dynamic interest rates found near 100% utilization. ## Consequences diff --git a/docs/architecture/ADR-008-borrow-tracking.md b/docs/architecture/ADR-008-borrow-tracking.md index e83649b31e..1a8b9f71bf 100644 --- a/docs/architecture/ADR-008-borrow-tracking.md +++ b/docs/architecture/ADR-008-borrow-tracking.md @@ -35,7 +35,7 @@ This change in borrow storage will be opaque to other parts of the leverage modu As a result of efficiency gains, the parameter `InterestEpoch` will be removed, with periodic functions taking place every block. -Additionally, the values `BorrowAPY`, `LendAPY`, and `uTokenExchangeRate` will be removed from state, instead being efficiently calculated when needed. +Additionally, the values `BorrowAPY`, `SupplyAPY`, and `uTokenExchangeRate` will be removed from state, instead being efficiently calculated when needed. ## Detailed Design @@ -48,11 +48,11 @@ This decision mainly updates existing features, rather than adding new ones. The **State:** - Add `InterestScalar` and `TotalAdjustedBorrows` to state, and add `Get/Set` functions -- Remove `BorrowAPY`, `LendAPY`, and `uTokenExchangeRate` from state, and remove `Set` functions +- Remove `BorrowAPY`, `SupplyAPY`, and `uTokenExchangeRate` from state, and remove `Set` functions **Getters:** -- Modify `Get` functions for `BorrowAPY`, `LendAPY`, and `uTokenExchangeRate` to calculate values in real time. +- Modify `Get` functions for `BorrowAPY`, `SupplyAPY`, and `uTokenExchangeRate` to calculate values in real time. - Modify `GetBorrow(addr,denom)`, `GetBorrowerBorrows(addr)`, and `GetAllBorrows()` to use `InterestScalar` and `AdjustedBorrow` - Modify `GetTotalBorrows(denom)` to use `InterestScalar` and `TotalAdjustedBorrows` @@ -104,7 +104,7 @@ This design change should address our lingering tradeoff between performance and - Total borrows and supply utilization can be calculated in O(1) time instead of O(N) as N is the total number of borrow positions across all users - Periodic functions can now take place every block instead of every `InterestEpoch` blocks -- Quantities like uToken exchange rates and lend APYs now update instantly to new borrow and lend activity, even between multiple transactions within the same block. +- Quantities like uToken exchange rates and supply APYs now update instantly to new borrow and supply activity, even between multiple transactions within the same block. ### Negative diff --git a/docs/architecture/ADR-009-liquidity-mining.md b/docs/architecture/ADR-009-liquidity-mining.md index 30b33e5071..6192a99914 100644 --- a/docs/architecture/ADR-009-liquidity-mining.md +++ b/docs/architecture/ADR-009-liquidity-mining.md @@ -10,13 +10,13 @@ Proposed ## Abstract -Umee wishes to add support for liquidity mining incentives; i.e. additional rewards on top of the normal `x/leverage` lending APY for supplying base assets. +Umee wishes to add support for liquidity mining incentives; i.e. additional rewards on top of the normal `x/leverage` APY for supplying base assets. For example, a user might "lock" some of their `u/ATOM` collateral held in the leverage module for 14 days, earning an additional 12% APY of the collateral's value, received as `UMEE` tokens. Locked tokens will be unavailable for `x/leverage` withdrawal until unlocked, but will still be able to be liquidated. There will be 3 locking tiers, differing in unlocking duration. -Incentive programs will be created by governance proposals, get funded with tokens, then (from `StartDate` to `EndDate`) distribute those tokens to lenders of based on the lenders' locked value and lock tier. APY will vary as fixed reward amounts are divided amongst all participating lenders. +Incentive programs will be created by governance proposals, get funded with tokens, then (from `StartDate` to `EndDate`) distribute those tokens to suppliers of based on the suppliers' locked value and lock tier. APY will vary as fixed reward amounts are divided amongst all participating suppliers. A message type `MsgSponsor` will allow for internal (multisig account) or external (ordinary wallet) funding of incentive programs with the `RewardDenom` that was set by governance. This message type will not require special permissions to run, only control of the funds to be used. @@ -75,13 +75,13 @@ Locking of funds is independent of active incentive programs, and can even be do ```go type MsgLock struct { - Lender sdk.AccAddress + User sdk.AccAddress Amount sdk.Coin Tier uint32 } type MsgUnlock struct { - Lender sdk.AccAddress + User sdk.AccAddress Amount sdk.Coin Tier uint32 } @@ -92,8 +92,8 @@ Amounts are `uToken` balances, exact integers which will not experience rounding On receiving a `MsgLock`, the module must perform the following steps: - Validate tier and uToken amount -- Verify lender has sufficient unlocked uTokens -- Distribute the lender's current `x/incentive` rewards for the selected denom and tier, if any +- Verify user has sufficient unlocked uTokens +- Distribute the user's current `x/incentive` rewards for the selected denom and tier, if any - Record the new locked utoken amount for the selected denom and tier See later sections for reward mechanics - it is mathematically necessary to update pending rewards when updating locked amounts. @@ -101,13 +101,13 @@ See later sections for reward mechanics - it is mathematically necessary to upda On receiving a `MsgUnlock`, the module must perform the following steps: - Validate tier and uToken amount -- Verify lender has sufficient locked uTokens of the selected tier that are not currently unlocking -- Start an unlocking for the lender in question +- Verify user has sufficient locked uTokens of the selected tier that are not currently unlocking +- Start an unlocking for the user in question Unlockings are defined as a struct: ```go type CollateralUnlocking struct { - Lender sdk.AccAddress + User sdk.AccAddress Amount sdk.Coin Tier uint32 End uint64 @@ -130,7 +130,7 @@ MaxUnlockings uint32 When an unlocking period ends, the restrictions on withdrawing and disabling collateral release, but the `uTokens` remain in the `x/leverage` module account as collateral. Since no transfer occurs at the moment funds unlock, there is no need for any action in `EndBlock`. -Completed unlockings for an address are cleared from state the next time withdraw restrictions are calculated during a transaction - that is, during a `MsgLock`, `MsgUnlock`, `MsgWithdraw`, `MsgSetCollateral` sent by the lender, or a `MsgLiquidate` where the lender is being liquidated. +Completed unlockings for an address are cleared from state the next time withdraw restrictions are calculated during a transaction - that is, during a `MsgLock`, `MsgUnlock`, `MsgWithdraw`, `MsgSetCollateral` sent by the user, or a `MsgLiquidate` where the user is being liquidated. Any collateral can potentially be seized during `MsgLiquidate`, whether it is locked, unlocking, or unlocked. In the event that the target of liquidation has collateral in various such states, it will be liquidated in this order: 1) Unlocked collateral @@ -211,11 +211,11 @@ There will be a message type which manually claims rewards. ```go type MsgClaim struct { - Lender sdk.AccAddress + User sdk.AccAddress } ``` -This message type gathers `PendingRewards` by updating `RewardBasis` for each nonzero `Locked(addr,denom,tier)` associated with the lender's address, then claims all pending rewards. +This message type gathers `PendingRewards` by updating `RewardBasis` for each nonzero `Locked(addr,denom,tier)` associated with the user's address, then claims all pending rewards. ### Funding Programs diff --git a/proto/umee/leverage/v1/leverage.proto b/proto/umee/leverage/v1/leverage.proto index cbf9690a8d..264d3cad03 100644 --- a/proto/umee/leverage/v1/leverage.proto +++ b/proto/umee/leverage/v1/leverage.proto @@ -42,7 +42,7 @@ message Params { } // Token defines a token, along with its capital metadata, in the Umee capital -// facility that can be loaned and borrowed. +// facility that can be supplied and borrowed. message Token { option (gogoproto.equal) = true; @@ -120,10 +120,10 @@ message Token { string symbol_denom = 10 [(gogoproto.moretags) = "yaml:\"symbol_denom\""]; uint32 exponent = 11 [(gogoproto.moretags) = "yaml:\"exponent\""]; - // Allows lending and setting a collateral using this token. Note that - // withdrawing is always enabled. Disabling lending would be one step in + // Allows supplying for lending or collateral using this token. Note that + // withdrawing is always enabled. Disabling supplying would be one step in // phasing out an asset type. - bool enable_msg_lend = 12 [(gogoproto.moretags) = "yaml:\"enable_msg_lend\""]; + bool enable_msg_supply = 12 [(gogoproto.moretags) = "yaml:\"enable_msg_supply\""]; // Allows borrowing of this token. Note that repaying is always enabled. // Disabling borrowing would be one step in phasing out an asset type, but @@ -135,8 +135,8 @@ message Token { // This should only be used to eliminate an asset completely. A blacklisted // asset is treated as though its oracle price is zero, and thus ignored by // calculations such as collateral value and borrow limit. Can still be repaid - // or withdrawn, but not liquidated. A blacklisted token must have enable_lend - // and enable_borrow set to false. Such tokens can be safely removed from the + // or withdrawn, but not liquidated. A blacklisted token must have enable_msg_supply + // and enable_msg_borrow set to false. Such tokens can be safely removed from the // oracle and price feeder as well. bool blacklist = 14; } diff --git a/proto/umee/leverage/v1/query.proto b/proto/umee/leverage/v1/query.proto index faa5fc93da..481b6871cb 100644 --- a/proto/umee/leverage/v1/query.proto +++ b/proto/umee/leverage/v1/query.proto @@ -22,32 +22,32 @@ service Query { } // Borrowed queries for the borrowed amount of a user by token denomination. - // If the denomination is not supplied, the total for each borrowed token is + // If the denomination is not specified, the total for each borrowed token is // returned. rpc Borrowed(QueryBorrowedRequest) returns (QueryBorrowedResponse) { option (google.api.http).get = "/umee/leverage/v1/borrowed"; } // BorrowedValue queries for the usd value of the borrowed amount of a user - // by token denomination. If the denomination is not supplied, the sum across + // by token denomination. If the denomination is not specified, the sum across // all borrowed tokens is returned. rpc BorrowedValue(QueryBorrowedValueRequest) returns (QueryBorrowedValueResponse) { option (google.api.http).get = "/umee/leverage/v1/borrowed_value"; } - // Loaned queries for the amount of tokens loaned by a user by denomination. - // If the denomination is not supplied, the total for each loaned token is + // Supplied queries for the amount of tokens by a user by denomination. + // If the denomination is not specified, the total for each supplied token is // returned. - rpc Loaned(QueryLoanedRequest) returns (QueryLoanedResponse) { - option (google.api.http).get = "/umee/leverage/v1/loaned"; + rpc Supplied(QuerySuppliedRequest) returns (QuerySuppliedResponse) { + option (google.api.http).get = "/umee/leverage/v1/supplied"; } - // LoanedValue queries for the USD value loaned by a user by token - // denomination. If the denomination is not supplied, the sum across all - // loaned tokens is returned. - rpc LoanedValue(QueryLoanedValueRequest) returns (QueryLoanedValueResponse) { - option (google.api.http).get = "/umee/leverage/v1/loaned_value"; + // SuppliedValue queries for the USD value supplied by a user by token + // denomination. If the denomination is not specified, the sum across all + // supplied tokens is returned. + rpc SuppliedValue(QuerySuppliedValueRequest) returns (QuerySuppliedValueResponse) { + option (google.api.http).get = "/umee/leverage/v1/supplied_value"; } // AvailableBorrow queries for the available amount to borrow of a specified @@ -62,20 +62,20 @@ service Query { option (google.api.http).get = "/umee/leverage/v1/borrow_apy"; } - // LendAPY queries for the lend APY of a specified denomination. - rpc LendAPY(QueryLendAPYRequest) returns (QueryLendAPYResponse) { - option (google.api.http).get = "/umee/leverage/v1/lend_apy"; + // SupplyAPY queries for the supply APY of a specified denomination. + rpc SupplyAPY(QuerySupplyAPYRequest) returns (QuerySupplyAPYResponse) { + option (google.api.http).get = "/umee/leverage/v1/supply_apy"; } // MarketSize queries for the Market Size in USD of a specified denomination, - // which is the USD value of total tokens loaned by all users plus borrow + // which is the USD value of total tokens supplied by all users plus borrow // interest owed by all users. rpc MarketSize(QueryMarketSizeRequest) returns (QueryMarketSizeResponse) { option (google.api.http).get = "/umee/leverage/v1/market_size"; } // TokenMarketSize queries for the Market Size in base tokens of a specified - // denomination, which is the total tokens loaned by all users plus borrow + // denomination, which is the total tokens supplied by all users plus borrow // interest owed by all users. rpc TokenMarketSize(QueryTokenMarketSizeRequest) returns (QueryTokenMarketSizeResponse) { @@ -90,7 +90,7 @@ service Query { } // Collateral queries the collateral amount of a user by token denomination. - // If the denomination is not supplied, all of the user's collateral tokens + // If the denomination is not specified, all of the user's collateral tokens // are returned. rpc Collateral(QueryCollateralRequest) returns (QueryCollateralResponse) { option (google.api.http).get = "/umee/leverage/v1/collateral"; @@ -129,7 +129,7 @@ service Query { option (google.api.http).get = "/umee/leverage/v1/liquidation_targets"; } - // MarketSummary queries a base asset's current borrowing and lending + // MarketSummary queries a base asset's current borrowing and supplying // conditions. rpc MarketSummary(QueryMarketSummaryRequest) returns (QueryMarketSummaryResponse) { @@ -178,15 +178,15 @@ message QueryBorrowAPYResponse { ]; } -// QueryLendAPYRequest defines the request structure for the LendAPY +// QuerySupplyAPYRequest defines the request structure for the SupplyAPY // gRPC service handler. -message QueryLendAPYRequest { +message QuerySupplyAPYRequest { string denom = 1; } -// QueryLendAPYResponse defines the response structure for the LendAPY +// QuerySupplyAPYResponse defines the response structure for the SupplyAPY // gRPC service handler. -message QueryLendAPYResponse { +message QuerySupplyAPYResponse { string APY = 1 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false @@ -287,33 +287,33 @@ message QueryCollateralValueResponse { ]; } -// QueryLoanedRequest defines the request structure for the Loaned gRPC service +// QuerySuppliedRequest defines the request structure for the Supplied gRPC service // handler. -message QueryLoanedRequest { +message QuerySuppliedRequest { string address = 1; string denom = 2; } -// QueryLoanedResponse defines the response structure for the Loaned gRPC +// QuerySuppliedResponse defines the response structure for the Supplied gRPC // service handler. -message QueryLoanedResponse { - repeated cosmos.base.v1beta1.Coin loaned = 1 [ +message QuerySuppliedResponse { + repeated cosmos.base.v1beta1.Coin supplied = 1 [ (gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; } -// QueryLoanedValueRequest defines the request structure for the LoanedValue +// QuerySuppliedValueRequest defines the request structure for the SuppliedValue // gRPC service handler. -message QueryLoanedValueRequest { +message QuerySuppliedValueRequest { string address = 1; string denom = 2; } -// QueryLoanedValueResponse defines the response structure for the LoanedValue +// QuerySuppliedValueResponse defines the response structure for the SuppliedValue // gRPC service handler. -message QueryLoanedValueResponse { - string loaned_value = 1 [ +message QuerySuppliedValueResponse { + string supplied_value = 1 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; @@ -424,7 +424,7 @@ message QueryMarketSummaryResponse { (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; - string lend_APY = 5 [ + string supply_APY = 5 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; diff --git a/proto/umee/leverage/v1/tx.proto b/proto/umee/leverage/v1/tx.proto index 4a39e87bfb..b481623c1b 100644 --- a/proto/umee/leverage/v1/tx.proto +++ b/proto/umee/leverage/v1/tx.proto @@ -8,10 +8,10 @@ option go_package = "github.com/umee-network/umee/v2/x/leverage/types"; // Msg defines the x/leverage module's Msg service. service Msg { - // LendAsset defines a method for lending coins to the capital facility. - rpc LendAsset(MsgLendAsset) returns (MsgLendAssetResponse); + // Supply moves tokens from user balance to the module balance for lending or collateral. + rpc Supply(MsgSupply) returns (MsgSupplyResponse); - // WithdrawAsset defines a method for withdrawing previously loaned coins from + // WithdrawAsset defines a method for withdrawing previously supplied coins from // the capital facility. rpc WithdrawAsset(MsgWithdrawAsset) returns (MsgWithdrawAssetResponse); @@ -35,23 +35,22 @@ service Msg { rpc Liquidate(MsgLiquidate) returns (MsgLiquidateResponse); } -// MsgLendAsset represents a lender's request to lend a base asset type to the -// module. -message MsgLendAsset { - // Lender is the account address supplying assets and the signer of the message. - string lender = 1; +// MsgSupply is the request structure for the Supply RPC. +message MsgSupply { + // Supplier is the account address supplying assets and the signer of the message. + string supplier = 1; cosmos.base.v1beta1.Coin amount = 2 [(gogoproto.nullable) = false]; } -// MsgWithdrawAsset represents a lender's request to withdraw lent assets. +// MsgWithdrawAsset represents a user's request to withdraw supplied assets. // Amount must be a uToken. message MsgWithdrawAsset { - // Lender is the account address withdrawing assets and the signer of the message. - string lender = 1; + // Supplier is the account address withdrawing assets and the signer of the message. + string supplier = 1; cosmos.base.v1beta1.Coin amount = 2 [(gogoproto.nullable) = false]; } -// MsgAddCollateral represents a lender's request to enable selected +// MsgAddCollateral represents a user's request to enable selected // uTokens as collateral. message MsgAddCollateral { // Borrower is the account address adding collateral and the signer of the message. @@ -59,7 +58,7 @@ message MsgAddCollateral { cosmos.base.v1beta1.Coin coin = 2 [(gogoproto.nullable) = false]; } -// MsgRemoveCollateral represents a lender's request to disable selected +// MsgRemoveCollateral represents a user's request to disable selected // uTokens as collateral. message MsgRemoveCollateral { // Borrower is the account address removing collateral and the signer of the message. @@ -67,7 +66,7 @@ message MsgRemoveCollateral { cosmos.base.v1beta1.Coin coin = 2 [(gogoproto.nullable) = false]; } -// MsgBorrowAsset represents a lender's request to borrow a base asset type +// MsgBorrowAsset represents a user's request to borrow a base asset type // from the module. message MsgBorrowAsset { // Borrower is the account address taking a loan and the signer @@ -76,7 +75,7 @@ message MsgBorrowAsset { cosmos.base.v1beta1.Coin amount = 2 [(gogoproto.nullable) = false]; } -// MsgRepayAsset represents a lender's request to repay a borrowed base asset +// MsgRepayAsset represents a user's request to repay a borrowed base asset // type to the module. message MsgRepayAsset { // Borrower is the account address repaying a loan and the signer @@ -96,8 +95,8 @@ message MsgLiquidate { cosmos.base.v1beta1.Coin reward = 4 [(gogoproto.nullable) = false]; } -// MsgLendAssetResponse defines the Msg/LendAsset response type. -message MsgLendAssetResponse {} +// MsgSupplyResponse defines the Msg/Supply response type. +message MsgSupplyResponse {} // MsgWithdrawAssetResponse defines the Msg/WithdrawAsset response type. message MsgWithdrawAssetResponse {} diff --git a/tests/e2e/e2e_setup_test.go b/tests/e2e/e2e_setup_test.go index 2802cb6b53..4b5c1c4100 100644 --- a/tests/e2e/e2e_setup_test.go +++ b/tests/e2e/e2e_setup_test.go @@ -256,7 +256,7 @@ func (s *IntegrationTestSuite) initGenesis() { MaxBorrowRate: sdk.MustNewDecFromStr("1.50000000000000000"), KinkUtilization: sdk.MustNewDecFromStr("0.200000000000000000"), LiquidationIncentive: sdk.MustNewDecFromStr("0.180000000000000000"), - EnableMsgLend: true, + EnableMsgSupply: true, EnableMsgBorrow: true, Blacklist: false, }) diff --git a/x/leverage/client/cli/proposal_test.go b/x/leverage/client/cli/proposal_test.go index 195fe8a8ae..f3211cbb45 100644 --- a/x/leverage/client/cli/proposal_test.go +++ b/x/leverage/client/cli/proposal_test.go @@ -43,7 +43,7 @@ func TestParseUpdateRegistryProposal(t *testing.T) { "liquidation_incentive": "0.1", "symbol_denom": "UMEE", "exponent": 6, - "enable_msg_lend": true, + "enable_msg_supply": true, "enable_msg_borrow": true, "blacklist": false } diff --git a/x/leverage/client/cli/query.go b/x/leverage/client/cli/query.go index 6373421360..117d1643ff 100644 --- a/x/leverage/client/cli/query.go +++ b/x/leverage/client/cli/query.go @@ -30,13 +30,13 @@ func GetQueryCmd(queryRoute string) *cobra.Command { GetCmdQueryParams(), GetCmdQueryBorrowed(), GetCmdQueryBorrowedValue(), - GetCmdQueryLoaned(), - GetCmdQueryLoanedValue(), + GetCmdQuerySupplied(), + GetCmdQuerySuppliedValue(), GetCmdQueryReserveAmount(), GetCmdQueryCollateral(), GetCmdQueryCollateralValue(), GetCmdQueryExchangeRate(), - GetCmdQueryLendAPY(), + GetCmdQuerySupplyAPY(), GetCmdQueryBorrowAPY(), GetCmdQueryMarketSize(), GetCmdQueryTokenMarketSize(), @@ -182,13 +182,13 @@ func GetCmdQueryBorrowedValue() *cobra.Command { return cmd } -// GetCmdQueryLoaned creates a Cobra command to query for the amount of -// tokens loaned by a given address. -func GetCmdQueryLoaned() *cobra.Command { +// GetCmdQuerySupplied creates a Cobra command to query for the amount of +// tokens supplied by a given address. +func GetCmdQuerySupplied() *cobra.Command { cmd := &cobra.Command{ - Use: "loaned [addr]", + Use: "supplied [addr]", Args: cobra.ExactArgs(1), - Short: "Query for the total amount of tokens loaned by an address", + Short: "Query for the total amount of tokens supplied by an address", RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientQueryContext(cmd) if err != nil { @@ -197,14 +197,14 @@ func GetCmdQueryLoaned() *cobra.Command { queryClient := types.NewQueryClient(clientCtx) - req := &types.QueryLoanedRequest{ + req := &types.QuerySuppliedRequest{ Address: args[0], } if d, err := cmd.Flags().GetString(FlagDenom); len(d) > 0 && err == nil { req.Denom = d } - resp, err := queryClient.Loaned(cmd.Context(), req) + resp, err := queryClient.Supplied(cmd.Context(), req) if err != nil { return err } @@ -219,13 +219,13 @@ func GetCmdQueryLoaned() *cobra.Command { return cmd } -// GetCmdQueryLoanedValue creates a Cobra command to query for the USD value of -// total tokens loaned by a given address. -func GetCmdQueryLoanedValue() *cobra.Command { +// GetCmdQuerySuppliedValue creates a Cobra command to query for the USD value of +// total tokens supplied by a given address. +func GetCmdQuerySuppliedValue() *cobra.Command { cmd := &cobra.Command{ - Use: "loaned-value [addr]", + Use: "supplied-value [addr]", Args: cobra.ExactArgs(1), - Short: "Query for the USD value of tokens loaned by an address", + Short: "Query for the USD value of tokens supplied by an address", RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientQueryContext(cmd) if err != nil { @@ -234,14 +234,14 @@ func GetCmdQueryLoanedValue() *cobra.Command { queryClient := types.NewQueryClient(clientCtx) - req := &types.QueryLoanedValueRequest{ + req := &types.QuerySuppliedValueRequest{ Address: args[0], } if d, err := cmd.Flags().GetString(FlagDenom); len(d) > 0 && err == nil { req.Denom = d } - resp, err := queryClient.LoanedValue(cmd.Context(), req) + resp, err := queryClient.SuppliedValue(cmd.Context(), req) if err != nil { return err } @@ -429,13 +429,13 @@ func GetCmdQueryAvailableBorrow() *cobra.Command { return cmd } -// GetCmdQueryLendAPY creates a Cobra command to query for the -// lend APY of a specific uToken. -func GetCmdQueryLendAPY() *cobra.Command { +// GetCmdQuerySupplyAPY creates a Cobra command to query for the +// supply APY of a specific uToken. +func GetCmdQuerySupplyAPY() *cobra.Command { cmd := &cobra.Command{ - Use: "lend-apy [denom]", + Use: "supply-apy [denom]", Args: cobra.ExactArgs(1), - Short: "Query for the lend APY of a specified denomination", + Short: "Query for the supply APY of a specified denomination", RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientQueryContext(cmd) if err != nil { @@ -444,11 +444,11 @@ func GetCmdQueryLendAPY() *cobra.Command { queryClient := types.NewQueryClient(clientCtx) - req := &types.QueryLendAPYRequest{ + req := &types.QuerySupplyAPYRequest{ Denom: args[0], } - resp, err := queryClient.LendAPY(cmd.Context(), req) + resp, err := queryClient.SupplyAPY(cmd.Context(), req) if err != nil { return err } diff --git a/x/leverage/client/cli/tx.go b/x/leverage/client/cli/tx.go index d2a8038b93..500a3b6540 100644 --- a/x/leverage/client/cli/tx.go +++ b/x/leverage/client/cli/tx.go @@ -25,7 +25,7 @@ func GetTxCmd() *cobra.Command { } cmd.AddCommand( - GetCmdLendAsset(), + GetCmdSupply(), GetCmdWithdrawAsset(), GetCmdAddCollateral(), GetCmdRemoveCollateral(), @@ -37,13 +37,13 @@ func GetTxCmd() *cobra.Command { return cmd } -// GetCmdLendAsset creates a Cobra command to generate or broadcast a -// transaction with a MsgLendAsset message. -func GetCmdLendAsset() *cobra.Command { +// GetCmdSupply creates a Cobra command to generate or broadcast a +// transaction with a MsgSupply message. +func GetCmdSupply() *cobra.Command { cmd := &cobra.Command{ - Use: "lend-asset [lender] [amount]", + Use: "supply-asset [supplier] [amount]", Args: cobra.ExactArgs(2), - Short: "Lend a specified amount of a supported asset", + Short: "Supply a specified amount of a supported asset", RunE: func(cmd *cobra.Command, args []string) error { if err := cmd.Flags().Set(flags.FlagFrom, args[0]); err != nil { return err @@ -59,7 +59,7 @@ func GetCmdLendAsset() *cobra.Command { return err } - msg := types.NewMsgLendAsset(clientCtx.GetFromAddress(), asset) + msg := types.NewMsgSupply(clientCtx.GetFromAddress(), asset) return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, @@ -74,7 +74,7 @@ func GetCmdLendAsset() *cobra.Command { // transaction with a MsgWithdrawAsset message. func GetCmdWithdrawAsset() *cobra.Command { cmd := &cobra.Command{ - Use: "withdraw-asset [lender] [amount]", + Use: "withdraw-asset [supplier] [amount]", Args: cobra.ExactArgs(2), Short: "Withdraw a specified amount of a supplied asset", RunE: func(cmd *cobra.Command, args []string) error { @@ -316,7 +316,7 @@ Where proposal.json contains: "liquidation_incentive": "0.1", "symbol_denom": "UMEE", "exponent": 6, - "enable_msg_lend": true, + "enable_msg_supply": true, "enable_msg_borrow": true, "blacklist": false }, diff --git a/x/leverage/client/tests/tests.go b/x/leverage/client/tests/tests.go index 14fbe91cda..1e8b7ecf1a 100644 --- a/x/leverage/client/tests/tests.go +++ b/x/leverage/client/tests/tests.go @@ -65,8 +65,8 @@ func (s *IntegrationTestSuite) TestInvalidQueries() { nil, }, testQuery{ - "query lend APY - invalid denom", - cli.GetCmdQueryLendAPY(), + "query supply APY - invalid denom", + cli.GetCmdQuerySupplyAPY(), []string{ "abcd", }, @@ -85,8 +85,8 @@ func (s *IntegrationTestSuite) TestInvalidQueries() { nil, }, testQuery{ - "query loaned - invalid address", - cli.GetCmdQueryLoaned(), + "query supplied - invalid address", + cli.GetCmdQuerySupplied(), []string{ "xyz", }, @@ -95,8 +95,8 @@ func (s *IntegrationTestSuite) TestInvalidQueries() { nil, }, testQuery{ - "query loaned - invalid denom", - cli.GetCmdQueryLoaned(), + "query supplied - invalid denom", + cli.GetCmdQuerySupplied(), []string{ val.Address.String(), fmt.Sprintf("--%s=abcd", cli.FlagDenom), @@ -148,8 +148,8 @@ func (s *IntegrationTestSuite) TestInvalidQueries() { nil, }, testQuery{ - "query loaned value - invalid address", - cli.GetCmdQueryLoanedValue(), + "query supplied value - invalid address", + cli.GetCmdQuerySuppliedValue(), []string{ "xyz", }, @@ -158,8 +158,8 @@ func (s *IntegrationTestSuite) TestInvalidQueries() { nil, }, testQuery{ - "query loaned value - invalid denom", - cli.GetCmdQueryLoanedValue(), + "query supplied value - invalid denom", + cli.GetCmdQuerySuppliedValue(), []string{ val.Address.String(), fmt.Sprintf("--%s=abcd", cli.FlagDenom), @@ -271,7 +271,7 @@ func (s *IntegrationTestSuite) TestLeverageScenario() { MaxBorrowRate: sdk.MustNewDecFromStr("1.5"), KinkUtilization: sdk.MustNewDecFromStr("0.2"), LiquidationIncentive: sdk.MustNewDecFromStr("0.18"), - EnableMsgLend: true, + EnableMsgSupply: true, EnableMsgBorrow: true, Blacklist: false, }, @@ -303,16 +303,16 @@ func (s *IntegrationTestSuite) TestLeverageScenario() { }, }, testQuery{ - "query lend APY", - cli.GetCmdQueryLendAPY(), + "query supply APY", + cli.GetCmdQuerySupplyAPY(), []string{ umeeapp.BondDenom, }, false, - &types.QueryLendAPYResponse{}, + &types.QuerySupplyAPYResponse{}, // Borrow rate * (1 - ReserveFactor - OracleRewardFactor) // 1.50 * (1 - 0.10 - 0.01) = 0.89 * 1.5 = 1.335 - &types.QueryLendAPYResponse{APY: sdk.MustNewDecFromStr("1.335")}, + &types.QuerySupplyAPYResponse{APY: sdk.MustNewDecFromStr("1.335")}, }, testQuery{ "query borrow APY", @@ -329,9 +329,9 @@ func (s *IntegrationTestSuite) TestLeverageScenario() { }, } - lend := testTransaction{ - "lend", - cli.GetCmdLendAsset(), + supply := testTransaction{ + "supply", + cli.GetCmdSupply(), []string{ val.Address.String(), "1000uumee", @@ -443,30 +443,30 @@ func (s *IntegrationTestSuite) TestLeverageScenario() { &types.QueryMarketSizeResponse{MarketSizeUsd: sdk.MustNewDecFromStr("0.03424421")}, }, testQuery{ - "query loaned - all", - cli.GetCmdQueryLoaned(), + "query supplied - all", + cli.GetCmdQuerySupplied(), []string{ val.Address.String(), }, false, - &types.QueryLoanedResponse{}, - &types.QueryLoanedResponse{ - Loaned: sdk.NewCoins( + &types.QuerySuppliedResponse{}, + &types.QuerySuppliedResponse{ + Supplied: sdk.NewCoins( sdk.NewInt64Coin(umeeapp.BondDenom, 1001), ), }, }, testQuery{ - "query loaned - denom", - cli.GetCmdQueryLoaned(), + "query supplied - denom", + cli.GetCmdQuerySupplied(), []string{ val.Address.String(), fmt.Sprintf("--%s=uumee", cli.FlagDenom), }, false, - &types.QueryLoanedResponse{}, - &types.QueryLoanedResponse{ - Loaned: sdk.NewCoins( + &types.QuerySuppliedResponse{}, + &types.QuerySuppliedResponse{ + Supplied: sdk.NewCoins( sdk.NewInt64Coin(umeeapp.BondDenom, 1001), ), }, @@ -530,33 +530,33 @@ func (s *IntegrationTestSuite) TestLeverageScenario() { }, }, testQuery{ - "query loaned value - all", - cli.GetCmdQueryLoanedValue(), + "query supplied value - all", + cli.GetCmdQuerySuppliedValue(), []string{ val.Address.String(), }, false, - &types.QueryLoanedValueResponse{}, - &types.QueryLoanedValueResponse{ + &types.QuerySuppliedValueResponse{}, + &types.QuerySuppliedValueResponse{ // From app/test_helpers.go/IntegrationTestNetworkConfig // This result is umee's oracle exchange rate times the - // amount loaned. - LoanedValue: sdk.MustNewDecFromStr("0.03424421"), + // amount supplied. + SuppliedValue: sdk.MustNewDecFromStr("0.03424421"), // (1001 / 1000000) umee * 34.21 = 0.03424421 }, }, testQuery{ - "query loaned value - denom", - cli.GetCmdQueryLoanedValue(), + "query supplied value - denom", + cli.GetCmdQuerySuppliedValue(), []string{ val.Address.String(), fmt.Sprintf("--%s=uumee", cli.FlagDenom), }, false, - &types.QueryLoanedValueResponse{}, - &types.QueryLoanedValueResponse{ + &types.QuerySuppliedValueResponse{}, + &types.QuerySuppliedValueResponse{ // From app/test_helpers.go/IntegrationTestNetworkConfig - LoanedValue: sdk.MustNewDecFromStr("0.03424421"), + SuppliedValue: sdk.MustNewDecFromStr("0.03424421"), // (1001 / 1000000) umee * 34.21 = 0.03424421 }, }, @@ -652,7 +652,7 @@ func (s *IntegrationTestSuite) TestLeverageScenario() { // These transactions will set up nonzero leverage positions and allow nonzero query results s.runTestCases( - lend, + supply, addCollateral, borrow, liquidate, @@ -666,6 +666,6 @@ func (s *IntegrationTestSuite) TestLeverageScenario() { withdraw, ) - // These queries run while the lending and borrowing is active to produce nonzero output + // These queries run while the supplying and borrowing is active to produce nonzero output s.runTestCases(nonzeroQueries...) } diff --git a/x/leverage/gov_handler_test.go b/x/leverage/gov_handler_test.go index 4f6377a606..5084dfc3ad 100644 --- a/x/leverage/gov_handler_test.go +++ b/x/leverage/gov_handler_test.go @@ -28,7 +28,7 @@ func newTestToken(base, symbol, reserveFactor string) types.Token { MaxBorrowRate: sdk.MustNewDecFromStr("1.52"), KinkUtilization: sdk.MustNewDecFromStr("0.8"), LiquidationIncentive: sdk.MustNewDecFromStr("0.1"), - EnableMsgLend: true, + EnableMsgSupply: true, EnableMsgBorrow: true, Blacklist: false, } diff --git a/x/leverage/keeper/borrows_test.go b/x/leverage/keeper/borrows_test.go index ad95f25d76..fd9493d062 100644 --- a/x/leverage/keeper/borrows_test.go +++ b/x/leverage/keeper/borrows_test.go @@ -96,14 +96,14 @@ func (s *IntegrationTestSuite) TestGetAvailableToBorrow() { available := s.tk.GetAvailableToBorrow(s.ctx, "abcd") s.Require().Equal(sdk.ZeroInt(), available) - // creates account which has loaned 1000 uumee, and borrowed 0 uumee + // creates account which has supplied 1000 uumee, and borrowed 0 uumee _ = s.setupAccount(umeeDenom, 1000, 1000, 0, true) // confirm lending pool is 1000 uumee available = s.tk.GetAvailableToBorrow(s.ctx, umeeDenom) s.Require().Equal(sdk.NewInt(1000), available) - // creates account which has loaned 1000 uumee, and borrowed 123 uumee + // creates account which has supplied 1000 uumee, and borrowed 123 uumee _ = s.setupAccount(umeeDenom, 1000, 1000, 123, true) // confirm lending pool is 1877 uumee @@ -123,7 +123,7 @@ func (s *IntegrationTestSuite) TestDeriveBorrowUtilization() { utilization := s.tk.SupplyUtilization(s.ctx, "abcd") s.Require().Equal(sdk.OneDec(), utilization) - // creates account which has loaned 1000 uumee, and borrowed 0 uumee + // creates account which has supplied 1000 uumee, and borrowed 0 uumee addr := s.setupAccount(umeeDenom, 1000, 1000, 0, true) // All tests below are commented with the following equation in mind: @@ -133,7 +133,7 @@ func (s *IntegrationTestSuite) TestDeriveBorrowUtilization() { utilization = s.tk.SupplyUtilization(s.ctx, umeeDenom) s.Require().Equal(sdk.ZeroDec(), utilization) - // lender borrows 200 uumee, reducing module account to 800 uumee + // user borrows 200 uumee, reducing module account to 800 uumee s.Require().NoError(s.tk.BorrowAsset(s.ctx, addr, sdk.NewInt64Coin(umeeDenom, 200))) // 20% utilization (200 / 200+800-0) @@ -147,21 +147,21 @@ func (s *IntegrationTestSuite) TestDeriveBorrowUtilization() { utilization = s.tk.SupplyUtilization(s.ctx, umeeDenom) s.Require().Equal(sdk.MustNewDecFromStr("0.25"), utilization) - // Setting umee collateral weight to 1.0 to allow lender to borrow heavily + // Setting umee collateral weight to 1.0 to allow user to borrow heavily umeeToken := newToken("uumee", "UMEE") umeeToken.CollateralWeight = sdk.MustNewDecFromStr("1") umeeToken.LiquidationThreshold = sdk.MustNewDecFromStr("1") s.Require().NoError(s.app.LeverageKeeper.SetTokenSettings(s.ctx, umeeToken)) - // lender borrows 600 uumee, reducing module account to 0 uumee + // user borrows 600 uumee, reducing module account to 0 uumee s.Require().NoError(s.tk.BorrowAsset(s.ctx, addr, sdk.NewInt64Coin(umeeDenom, 600))) // 100% utilization (800 / 800+200-200)) utilization = s.tk.SupplyUtilization(s.ctx, umeeDenom) s.Require().Equal(sdk.MustNewDecFromStr("1.0"), utilization) - // artificially set lender borrow to 1200 umee + // artificially set user borrow to 1200 umee s.Require().NoError(s.tk.SetBorrow(s.ctx, addr, sdk.NewInt64Coin(umeeDenom, 1200))) // still 100% utilization (1200 / 1200+200-200) diff --git a/x/leverage/keeper/grpc_query.go b/x/leverage/keeper/grpc_query.go index 652f22059e..036b9e7964 100644 --- a/x/leverage/keeper/grpc_query.go +++ b/x/leverage/keeper/grpc_query.go @@ -126,10 +126,10 @@ func (q Querier) BorrowedValue( return &types.QueryBorrowedValueResponse{BorrowedValue: value}, nil } -func (q Querier) Loaned( +func (q Querier) Supplied( goCtx context.Context, - req *types.QueryLoanedRequest, -) (*types.QueryLoanedResponse, error) { + req *types.QuerySuppliedRequest, +) (*types.QuerySuppliedResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "empty request") } @@ -139,36 +139,36 @@ func (q Querier) Loaned( ctx := sdk.UnwrapSDKContext(goCtx) - lender, err := sdk.AccAddressFromBech32(req.Address) + addr, err := sdk.AccAddressFromBech32(req.Address) if err != nil { return nil, err } if len(req.Denom) == 0 { - tokens, err := q.Keeper.GetLenderLoaned(ctx, lender) + tokens, err := q.Keeper.GetAllSupplied(ctx, addr) if err != nil { return nil, err } - return &types.QueryLoanedResponse{Loaned: tokens}, nil + return &types.QuerySuppliedResponse{Supplied: tokens}, nil } if !q.Keeper.IsAcceptedToken(ctx, req.Denom) { return nil, status.Error(codes.InvalidArgument, "not accepted Token denom") } - token, err := q.Keeper.GetLoaned(ctx, lender, req.Denom) + token, err := q.Keeper.GetSupplied(ctx, addr, req.Denom) if err != nil { return nil, err } - return &types.QueryLoanedResponse{Loaned: sdk.NewCoins(token)}, nil + return &types.QuerySuppliedResponse{Supplied: sdk.NewCoins(token)}, nil } -func (q Querier) LoanedValue( +func (q Querier) SuppliedValue( goCtx context.Context, - req *types.QueryLoanedValueRequest, -) (*types.QueryLoanedValueResponse, error) { + req *types.QuerySuppliedValueRequest, +) (*types.QuerySuppliedValueResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "empty request") } @@ -178,7 +178,7 @@ func (q Querier) LoanedValue( ctx := sdk.UnwrapSDKContext(goCtx) - lender, err := sdk.AccAddressFromBech32(req.Address) + addr, err := sdk.AccAddressFromBech32(req.Address) if err != nil { return nil, err } @@ -186,7 +186,7 @@ func (q Querier) LoanedValue( var tokens sdk.Coins if len(req.Denom) == 0 { - tokens, err = q.Keeper.GetLenderLoaned(ctx, lender) + tokens, err = q.Keeper.GetAllSupplied(ctx, addr) if err != nil { return nil, err } @@ -195,12 +195,12 @@ func (q Querier) LoanedValue( return nil, status.Error(codes.InvalidArgument, "not accepted Token denom") } - loaned, err := q.Keeper.GetLoaned(ctx, lender, req.Denom) + supplied, err := q.Keeper.GetSupplied(ctx, addr, req.Denom) if err != nil { return nil, err } - tokens = sdk.NewCoins(loaned) + tokens = sdk.NewCoins(supplied) } value, err := q.Keeper.TotalTokenValue(ctx, tokens) @@ -208,7 +208,7 @@ func (q Querier) LoanedValue( return nil, err } - return &types.QueryLoanedValueResponse{LoanedValue: value}, nil + return &types.QuerySuppliedValueResponse{SuppliedValue: value}, nil } func (q Querier) AvailableBorrow( @@ -253,10 +253,10 @@ func (q Querier) BorrowAPY( return &types.QueryBorrowAPYResponse{APY: borrowAPY}, nil } -func (q Querier) LendAPY( +func (q Querier) SupplyAPY( goCtx context.Context, - req *types.QueryLendAPYRequest, -) (*types.QueryLendAPYResponse, error) { + req *types.QuerySupplyAPYRequest, +) (*types.QuerySupplyAPYResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "empty request") } @@ -269,9 +269,9 @@ func (q Querier) LendAPY( return nil, status.Error(codes.InvalidArgument, "not accepted Token denom") } - lendAPY := q.Keeper.DeriveLendAPY(ctx, req.Denom) + supplyAPY := q.Keeper.DeriveSupplyAPY(ctx, req.Denom) - return &types.QueryLendAPYResponse{APY: lendAPY}, nil + return &types.QuerySupplyAPYResponse{APY: supplyAPY}, nil } func (q Querier) MarketSize( @@ -290,7 +290,7 @@ func (q Querier) MarketSize( return nil, status.Error(codes.InvalidArgument, "not accepted Token denom") } - marketSizeCoin, err := q.Keeper.GetTotalLoaned(ctx, req.Denom) + marketSizeCoin, err := q.Keeper.GetTotalSupply(ctx, req.Denom) if err != nil { return nil, err } @@ -319,7 +319,7 @@ func (q Querier) TokenMarketSize( return nil, status.Error(codes.InvalidArgument, "not accepted Token denom") } - marketSizeCoin, err := q.Keeper.GetTotalLoaned(ctx, req.Denom) + marketSizeCoin, err := q.Keeper.GetTotalSupply(ctx, req.Denom) if err != nil { return nil, err } @@ -394,7 +394,7 @@ func (q Querier) CollateralValue( ctx := sdk.UnwrapSDKContext(goCtx) - lender, err := sdk.AccAddressFromBech32(req.Address) + addr, err := sdk.AccAddressFromBech32(req.Address) if err != nil { return nil, err } @@ -402,13 +402,13 @@ func (q Querier) CollateralValue( var uTokens sdk.Coins if len(req.Denom) == 0 { - uTokens = q.Keeper.GetBorrowerCollateral(ctx, lender) + uTokens = q.Keeper.GetBorrowerCollateral(ctx, addr) } else { if !q.Keeper.IsAcceptedUToken(ctx, req.Denom) { return nil, status.Error(codes.InvalidArgument, "not accepted uToken denom") } - collateral := q.Keeper.GetCollateralAmount(ctx, lender, req.Denom) + collateral := q.Keeper.GetCollateralAmount(ctx, addr, req.Denom) uTokens = sdk.NewCoins(collateral) } @@ -544,9 +544,9 @@ func (q Querier) MarketSummary( return nil, status.Error(codes.InvalidArgument, "not accepted Token denom") } rate := q.Keeper.DeriveExchangeRate(ctx, req.Denom) - lendAPY := q.Keeper.DeriveLendAPY(ctx, req.Denom) + supplyAPY := q.Keeper.DeriveSupplyAPY(ctx, req.Denom) borrowAPY := q.Keeper.DeriveBorrowAPY(ctx, req.Denom) - marketSizeCoin, _ := q.Keeper.GetTotalLoaned(ctx, req.Denom) + marketSizeCoin, _ := q.Keeper.GetTotalSupply(ctx, req.Denom) availableBorrow := q.Keeper.GetAvailableToBorrow(ctx, req.Denom) reserved := q.Keeper.GetReserveAmount(ctx, req.Denom) collateral := q.Keeper.GetTotalCollateral(ctx, req.Denom) @@ -555,7 +555,7 @@ func (q Querier) MarketSummary( SymbolDenom: token.SymbolDenom, Exponent: token.Exponent, UTokenExchangeRate: rate, - Lend_APY: lendAPY, + Supply_APY: supplyAPY, Borrow_APY: borrowAPY, MarketSize: marketSizeCoin.Amount, AvailableBorrow: availableBorrow, diff --git a/x/leverage/keeper/interest.go b/x/leverage/keeper/interest.go index cf68b38d64..ee3eacf483 100644 --- a/x/leverage/keeper/interest.go +++ b/x/leverage/keeper/interest.go @@ -45,9 +45,9 @@ func (k Keeper) DeriveBorrowAPY(ctx sdk.Context, denom string) sdk.Dec { ) } -// DeriveLendAPY derives the current lend interest rate on a token denom +// DeriveSupplyAPY derives the current supply interest rate on a token denom // using its supply utilization borrow APY. Returns zero on invalid asset. -func (k Keeper) DeriveLendAPY(ctx sdk.Context, denom string) sdk.Dec { +func (k Keeper) DeriveSupplyAPY(ctx sdk.Context, denom string) sdk.Dec { token, err := k.GetTokenSettings(ctx, denom) if err != nil { return sdk.ZeroDec() @@ -57,7 +57,7 @@ func (k Keeper) DeriveLendAPY(ctx sdk.Context, denom string) sdk.Dec { utilization := k.SupplyUtilization(ctx, denom) reduction := k.GetParams(ctx).OracleRewardFactor.Add(token.ReserveFactor) - // lend APY = borrow APY * utilization, reduced by reserve factor and oracle reward factor + // supply APY = borrow APY * utilization, reduced by reserve factor and oracle reward factor return borrowRate.Mul(utilization).Mul(sdk.OneDec().Sub(reduction)) } diff --git a/x/leverage/keeper/invariants.go b/x/leverage/keeper/invariants.go index 0d42d67415..120d80d240 100644 --- a/x/leverage/keeper/invariants.go +++ b/x/leverage/keeper/invariants.go @@ -13,7 +13,7 @@ const ( routeCollateralAmount = "collateral-amount" routeBorrowAmount = "borrow-amount" routeBorrowAPY = "borrow-apy" - routeLendAPY = "lend-apy" + routeSupplyAPY = "supply-apy" ) // RegisterInvariants registers the leverage module invariants @@ -22,7 +22,7 @@ func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper) { ir.RegisterRoute(types.ModuleName, routeCollateralAmount, CollateralAmountInvariant(k)) ir.RegisterRoute(types.ModuleName, routeBorrowAmount, BorrowAmountInvariant(k)) ir.RegisterRoute(types.ModuleName, routeBorrowAPY, BorrowAPYInvariant(k)) - ir.RegisterRoute(types.ModuleName, routeLendAPY, LendAPYInvariant(k)) + ir.RegisterRoute(types.ModuleName, routeSupplyAPY, SupplyAPYInvariant(k)) ir.RegisterRoute(types.ModuleName, routeInterestScalars, InterestScalarsInvariant(k)) } @@ -49,7 +49,7 @@ func AllInvariants(k Keeper) sdk.Invariant { return res, stop } - res, stop = LendAPYInvariant(k)(ctx) + res, stop = SupplyAPYInvariant(k)(ctx) if stop { return res, stop } @@ -226,8 +226,8 @@ func BorrowAPYInvariant(k Keeper) sdk.Invariant { } } -// LendAPYInvariant checks that Lend APY have all positive values -func LendAPYInvariant(k Keeper) sdk.Invariant { +// SupplyAPYInvariant checks that Supply APY have all positive values +func SupplyAPYInvariant(k Keeper) sdk.Invariant { return func(ctx sdk.Context) (string, bool) { var ( msg string @@ -237,27 +237,27 @@ func LendAPYInvariant(k Keeper) sdk.Invariant { tokenPrefix := types.KeyPrefixRegisteredToken // Iterate through all denoms of registered tokens in the - // keeper, ensuring none have a negative lend APY. + // keeper, ensuring none have a negative supply APY. err := k.iterate(ctx, tokenPrefix, func(key, val []byte) error { denom := types.DenomFromKey(key, tokenPrefix) - lendAPY := k.DeriveLendAPY(ctx, denom) + supplyAPY := k.DeriveSupplyAPY(ctx, denom) - if lendAPY.IsNegative() { + if supplyAPY.IsNegative() { count++ - msg += fmt.Sprintf("\t%s lend APY %s is negative\n", denom, lendAPY.String()) + msg += fmt.Sprintf("\t%s supply APY %s is negative\n", denom, supplyAPY.String()) } return nil }) if err != nil { - msg += fmt.Sprintf("\tSome error occurred while iterating through the lend APY %+v\n", err) + msg += fmt.Sprintf("\tSome error occurred while iterating through the supply APY %+v\n", err) } broken := count != 0 return sdk.FormatInvariant( - types.ModuleName, routeLendAPY, - fmt.Sprintf("number of negative lend APY found %d\n%s", count, msg), + types.ModuleName, routeSupplyAPY, + fmt.Sprintf("number of negative supply APY found %d\n%s", count, msg), ), broken } } diff --git a/x/leverage/keeper/keeper.go b/x/leverage/keeper/keeper.go index 48fec5905a..0d9a7258ca 100644 --- a/x/leverage/keeper/keeper.go +++ b/x/leverage/keeper/keeper.go @@ -73,11 +73,11 @@ func (k Keeper) ModuleBalance(ctx sdk.Context, denom string) sdk.Int { return k.bankKeeper.SpendableCoins(ctx, authtypes.NewModuleAddress(types.ModuleName)).AmountOf(denom) } -// LendAsset attempts to deposit assets into the leverage module account in +// Supply attempts to deposit assets into the leverage module account in // exchange for uTokens. If asset type is invalid or account balance is // insufficient, we return an error. -func (k Keeper) LendAsset(ctx sdk.Context, lenderAddr sdk.AccAddress, loan sdk.Coin) error { - if err := k.validateLendAsset(ctx, loan); err != nil { +func (k Keeper) Supply(ctx sdk.Context, supplierAddr sdk.AccAddress, loan sdk.Coin) error { + if err := k.validateSupply(ctx, loan); err != nil { return err } @@ -89,7 +89,7 @@ func (k Keeper) LendAsset(ctx sdk.Context, lenderAddr sdk.AccAddress, loan sdk.C // send token balance to leverage module account loanTokens := sdk.NewCoins(loan) - if err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, lenderAddr, types.ModuleName, loanTokens); err != nil { + if err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, supplierAddr, types.ModuleName, loanTokens); err != nil { return err } @@ -102,8 +102,8 @@ func (k Keeper) LendAsset(ctx sdk.Context, lenderAddr sdk.AccAddress, loan sdk.C return err } - // The uTokens are sent to lender address - if err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, lenderAddr, uTokens); err != nil { + // The uTokens are sent to supplier address + if err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, supplierAddr, uTokens); err != nil { return err } @@ -111,9 +111,9 @@ func (k Keeper) LendAsset(ctx sdk.Context, lenderAddr sdk.AccAddress, loan sdk.C } // WithdrawAsset attempts to deposit uTokens into the leverage module in exchange -// for the original tokens loaned. Accepts a uToken amount to exchange for base tokens. +// for the original tokens supplied. Accepts a uToken amount to exchange for base tokens. // If the uToken denom is invalid or account or module balance insufficient, returns error. -func (k Keeper) WithdrawAsset(ctx sdk.Context, lenderAddr sdk.AccAddress, coin sdk.Coin) error { +func (k Keeper) WithdrawAsset(ctx sdk.Context, supplierAddr sdk.AccAddress, coin sdk.Coin) error { if !k.IsAcceptedUToken(ctx, coin.Denom) { return sdkerrors.Wrap(types.ErrInvalidAsset, coin.String()) } @@ -131,21 +131,21 @@ func (k Keeper) WithdrawAsset(ctx sdk.Context, lenderAddr sdk.AccAddress, coin s return sdkerrors.Wrap(types.ErrLendingPoolInsufficient, token.String()) } - // Withdraw will first attempt to use any uTokens in the lender's wallet - amountFromWallet := sdk.MinInt(k.bankKeeper.SpendableCoins(ctx, lenderAddr).AmountOf(coin.Denom), coin.Amount) - // Any additional uTokens must come from the lender's collateral + // Withdraw will first attempt to use any uTokens in the supplier's wallet + amountFromWallet := sdk.MinInt(k.bankKeeper.SpendableCoins(ctx, supplierAddr).AmountOf(coin.Denom), coin.Amount) + // Any additional uTokens must come from the supplier's collateral amountFromCollateral := coin.Amount.Sub(amountFromWallet) if amountFromCollateral.IsPositive() { // Calculate current borrowed value - borrowed := k.GetBorrowerBorrows(ctx, lenderAddr) + borrowed := k.GetBorrowerBorrows(ctx, supplierAddr) borrowedValue, err := k.TotalTokenValue(ctx, borrowed) if err != nil { return err } // Check for sufficient collateral - collateral := k.GetBorrowerCollateral(ctx, lenderAddr) + collateral := k.GetBorrowerCollateral(ctx, supplierAddr) if collateral.AmountOf(coin.Denom).LT(amountFromCollateral) { return sdkerrors.Wrap(types.ErrInsufficientBalance, coin.String()) } @@ -163,22 +163,22 @@ func (k Keeper) WithdrawAsset(ctx sdk.Context, lenderAddr sdk.AccAddress, coin s "withdraw would decrease borrow limit to %s, below the current borrowed value %s", newBorrowLimit, borrowedValue) } - // reduce the lender's collateral by amountFromCollateral + // reduce the supplier's collateral by amountFromCollateral newCollateral := sdk.NewCoin(coin.Denom, collateral.AmountOf(coin.Denom).Sub(amountFromCollateral)) - if err = k.setCollateralAmount(ctx, lenderAddr, newCollateral); err != nil { + if err = k.setCollateralAmount(ctx, supplierAddr, newCollateral); err != nil { return err } } // transfer amountFromWallet uTokens to the module account uTokens := sdk.NewCoins(sdk.NewCoin(coin.Denom, amountFromWallet)) - if err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, lenderAddr, types.ModuleName, uTokens); err != nil { + if err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, supplierAddr, types.ModuleName, uTokens); err != nil { return err } - // send the base assets to lender + // send the base assets to supplier tokens := sdk.NewCoins(token) - if err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, lenderAddr, tokens); err != nil { + if err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, supplierAddr, tokens); err != nil { return err } diff --git a/x/leverage/keeper/keeper_test.go b/x/leverage/keeper/keeper_test.go index a8cd4475fc..ef091ef2a4 100644 --- a/x/leverage/keeper/keeper_test.go +++ b/x/leverage/keeper/keeper_test.go @@ -44,7 +44,7 @@ func newToken(base, symbol string) types.Token { MaxBorrowRate: sdk.MustNewDecFromStr("1.52"), KinkUtilization: sdk.MustNewDecFromStr("0.8"), LiquidationIncentive: sdk.MustNewDecFromStr("0.1"), - EnableMsgLend: true, + EnableMsgSupply: true, EnableMsgBorrow: true, Blacklist: false, } @@ -100,9 +100,9 @@ func (s *IntegrationTestSuite) SetupTest() { s.queryClient = types.NewQueryClient(queryHelper) } -// setupAccount executes some common boilerplate before a test, where a lender account is given tokens of a given denom, -// may also lend them to receive uTokens, and may also enable those uTokens as collateral and borrow tokens in the same denom. -func (s *IntegrationTestSuite) setupAccount(denom string, mintAmount, lendAmount, borrowAmount int64, collateral bool) sdk.AccAddress { +// setupAccount executes some common boilerplate before a test, where a user account is given tokens of a given denom, +// may also supply them to receive uTokens, and may also enable those uTokens as collateral and borrow tokens in the same denom. +func (s *IntegrationTestSuite) setupAccount(denom string, mintAmount, supplyAmount, borrowAmount int64, collateral bool) sdk.AccAddress { // create a unique address setupAccountCounter = setupAccountCounter.Add(sdk.OneInt()) addr := sdk.AccAddress([]byte("addr" + setupAccountCounter.String())) @@ -121,15 +121,15 @@ func (s *IntegrationTestSuite) setupAccount(denom string, mintAmount, lendAmount )) } - if lendAmount > 0 { - // account lends lendAmount tokens and receives uTokens - err := s.app.LeverageKeeper.LendAsset(s.ctx, addr, sdk.NewInt64Coin(denom, lendAmount)) + if supplyAmount > 0 { + // account supplies supplyAmount tokens and receives uTokens + err := s.app.LeverageKeeper.Supply(s.ctx, addr, sdk.NewInt64Coin(denom, supplyAmount)) s.Require().NoError(err) } if collateral { // account enables associated uToken as collateral - collat, err := s.app.LeverageKeeper.ExchangeToken(s.ctx, sdk.NewInt64Coin(denom, lendAmount)) + collat, err := s.app.LeverageKeeper.ExchangeToken(s.ctx, sdk.NewInt64Coin(denom, supplyAmount)) s.Require().NoError(err) err = s.app.LeverageKeeper.AddCollateral(s.ctx, addr, collat) s.Require().NoError(err) @@ -145,10 +145,10 @@ func (s *IntegrationTestSuite) setupAccount(denom string, mintAmount, lendAmount return addr } -func (s *IntegrationTestSuite) TestLendAsset_InvalidAsset() { - lenderAddr := sdk.AccAddress([]byte("addr________________")) - lenderAcc := s.app.AccountKeeper.NewAccountWithAddress(s.ctx, lenderAddr) - s.app.AccountKeeper.SetAccount(s.ctx, lenderAcc) +func (s *IntegrationTestSuite) TestSupply_InvalidAsset() { + addr := sdk.AccAddress([]byte("addr________________")) + acc := s.app.AccountKeeper.NewAccountWithAddress(s.ctx, addr) + s.app.AccountKeeper.SetAccount(s.ctx, acc) // create coins of an unregistered base asset type "uabcd" invalidCoin := sdk.NewInt64Coin("uabcd", 1000000000) // 1k abcd @@ -156,26 +156,26 @@ func (s *IntegrationTestSuite) TestLendAsset_InvalidAsset() { // mint and send coins s.Require().NoError(s.app.BankKeeper.MintCoins(s.ctx, minttypes.ModuleName, invalidCoins)) - s.Require().NoError(s.app.BankKeeper.SendCoinsFromModuleToAccount(s.ctx, minttypes.ModuleName, lenderAddr, invalidCoins)) + s.Require().NoError(s.app.BankKeeper.SendCoinsFromModuleToAccount(s.ctx, minttypes.ModuleName, addr, invalidCoins)) - // lending should fail as we have not registered token "uabcd" - err := s.app.LeverageKeeper.LendAsset(s.ctx, lenderAddr, invalidCoin) + // supplying should fail as we have not registered token "uabcd" + err := s.app.LeverageKeeper.Supply(s.ctx, addr, invalidCoin) s.Require().Error(err) } -func (s *IntegrationTestSuite) TestLendAsset_Valid() { +func (s *IntegrationTestSuite) TestSupply_Valid() { app, ctx := s.app, s.ctx - lenderAddr := sdk.AccAddress([]byte("addr________________1234")) - lenderAcc := app.AccountKeeper.NewAccountWithAddress(ctx, lenderAddr) - app.AccountKeeper.SetAccount(ctx, lenderAcc) + addr := sdk.AccAddress([]byte("addr________________1234")) + acc := app.AccountKeeper.NewAccountWithAddress(ctx, addr) + app.AccountKeeper.SetAccount(ctx, acc) // mint and send coins s.Require().NoError(app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, initCoins)) - s.Require().NoError(app.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, lenderAddr, initCoins)) + s.Require().NoError(app.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, addr, initCoins)) - // lend asset - err := s.app.LeverageKeeper.LendAsset(ctx, lenderAddr, sdk.NewInt64Coin(umeeapp.BondDenom, 1000000000)) // 1k umee + // supply asset + err := s.app.LeverageKeeper.Supply(ctx, addr, sdk.NewInt64Coin(umeeapp.BondDenom, 1000000000)) // 1k umee s.Require().NoError(err) // verify the total supply of the minted uToken @@ -184,27 +184,27 @@ func (s *IntegrationTestSuite) TestLendAsset_Valid() { expected := sdk.NewInt64Coin(uTokenDenom, 1000000000) // 1k u/umee s.Require().Equal(expected, supply) - // verify the lender's balances - tokenBalance := app.BankKeeper.GetBalance(ctx, lenderAddr, umeeapp.BondDenom) + // verify the user's balances + tokenBalance := app.BankKeeper.GetBalance(ctx, addr, umeeapp.BondDenom) s.Require().Equal(initTokens.Sub(sdk.NewInt(1000000000)), tokenBalance.Amount) - uTokenBalance := app.BankKeeper.GetBalance(ctx, lenderAddr, uTokenDenom) + uTokenBalance := app.BankKeeper.GetBalance(ctx, addr, uTokenDenom) s.Require().Equal(int64(1000000000), uTokenBalance.Amount.Int64()) } func (s *IntegrationTestSuite) TestWithdrawAsset_Valid() { app, ctx := s.app, s.ctx - lenderAddr := sdk.AccAddress([]byte("addr________________")) - lenderAcc := app.AccountKeeper.NewAccountWithAddress(ctx, lenderAddr) - app.AccountKeeper.SetAccount(ctx, lenderAcc) + addr := sdk.AccAddress([]byte("addr________________")) + acc := app.AccountKeeper.NewAccountWithAddress(ctx, addr) + app.AccountKeeper.SetAccount(ctx, acc) // mint and send coins s.Require().NoError(app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, initCoins)) - s.Require().NoError(app.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, lenderAddr, initCoins)) + s.Require().NoError(app.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, addr, initCoins)) - // lend asset - err := s.app.LeverageKeeper.LendAsset(ctx, lenderAddr, sdk.NewInt64Coin(umeeapp.BondDenom, 1000000000)) // 1k umee + // supply asset + err := s.app.LeverageKeeper.Supply(ctx, addr, sdk.NewInt64Coin(umeeapp.BondDenom, 1000000000)) // 1k umee s.Require().NoError(err) // verify the total supply of the minted uToken @@ -213,20 +213,20 @@ func (s *IntegrationTestSuite) TestWithdrawAsset_Valid() { expected := sdk.NewInt64Coin(uTokenDenom, 1000000000) // 1k u/umee s.Require().Equal(expected, supply) - // withdraw the total amount of assets loaned + // withdraw the total amount of assets supplied uToken := expected - err = s.app.LeverageKeeper.WithdrawAsset(ctx, lenderAddr, uToken) + err = s.app.LeverageKeeper.WithdrawAsset(ctx, addr, uToken) s.Require().NoError(err) // verify total supply of the uTokens supply = s.app.LeverageKeeper.GetUTokenSupply(ctx, uTokenDenom) s.Require().Equal(int64(0), supply.Amount.Int64()) - // verify the lender's balances - tokenBalance := app.BankKeeper.GetBalance(ctx, lenderAddr, umeeapp.BondDenom) + // verify the user's balances + tokenBalance := app.BankKeeper.GetBalance(ctx, addr, umeeapp.BondDenom) s.Require().Equal(initTokens, tokenBalance.Amount) - uTokenBalance := app.BankKeeper.GetBalance(ctx, lenderAddr, uTokenDenom) + uTokenBalance := app.BankKeeper.GetBalance(ctx, addr, uTokenDenom) s.Require().Equal(int64(0), uTokenBalance.Amount.Int64()) } @@ -260,53 +260,53 @@ func (s *IntegrationTestSuite) TestGetToken() { s.Require().Equal(t.LiquidationIncentive, sdk.MustNewDecFromStr("0.1")) s.Require().NoError(t.AssertBorrowEnabled()) - s.Require().NoError(t.AssertLendEnabled()) + s.Require().NoError(t.AssertSupplyEnabled()) s.Require().NoError(s.app.LeverageKeeper.AssertNotBlacklisted(s.ctx, "uabc")) } // initialize the common starting scenario from which borrow and repay tests stem: -// Umee and u/umee are registered assets; a "lender" account has 9k umee and 1k u/umee; +// Umee and u/umee are registered assets; a "supplier" account has 9k umee and 1k u/umee; // the leverage module has 1k umee in its lending pool (module account); and a "bum" // account has been created with no assets. -func (s *IntegrationTestSuite) initBorrowScenario() (lender, bum sdk.AccAddress) { +func (s *IntegrationTestSuite) initBorrowScenario() (supplier, bum sdk.AccAddress) { app, ctx := s.app, s.ctx - // create an account and address which will represent a lender - lenderAddr := sdk.AccAddress([]byte("addr______________01")) - lenderAcc := app.AccountKeeper.NewAccountWithAddress(ctx, lenderAddr) - app.AccountKeeper.SetAccount(ctx, lenderAcc) + // create an account and address which will represent a supplier + supplierAddr := sdk.AccAddress([]byte("addr______________01")) + supplierAcc := app.AccountKeeper.NewAccountWithAddress(ctx, supplierAddr) + app.AccountKeeper.SetAccount(ctx, supplierAcc) // create an account and address which will represent a user with no assets bumAddr := sdk.AccAddress([]byte("addr______________02")) bumAcc := app.AccountKeeper.NewAccountWithAddress(ctx, bumAddr) app.AccountKeeper.SetAccount(ctx, bumAcc) - // mint and send 10k umee to lender + // mint and send 10k umee to supplier s.Require().NoError(app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, sdk.NewCoins(sdk.NewInt64Coin(umeeapp.BondDenom, 10000000000)), // 10k umee )) - s.Require().NoError(app.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, lenderAddr, + s.Require().NoError(app.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, supplierAddr, sdk.NewCoins(sdk.NewInt64Coin(umeeapp.BondDenom, 10000000000)), // 10k umee, )) - // lender lends 1000 umee and receives 1k u/umee - lendCoin := sdk.NewInt64Coin(umeeapp.BondDenom, 1000000000) - err := s.app.LeverageKeeper.LendAsset(ctx, lenderAddr, lendCoin) + // supplier supplies 1000 umee and receives 1k u/umee + supplyCoin := sdk.NewInt64Coin(umeeapp.BondDenom, 1000000000) + err := s.app.LeverageKeeper.Supply(ctx, supplierAddr, supplyCoin) s.Require().NoError(err) - // lender enables u/umee as collateral - collat, err := s.app.LeverageKeeper.ExchangeToken(ctx, lendCoin) + // supplier enables u/umee as collateral + collat, err := s.app.LeverageKeeper.ExchangeToken(ctx, supplyCoin) s.Require().NoError(err) - err = s.app.LeverageKeeper.AddCollateral(ctx, lenderAddr, collat) + err = s.app.LeverageKeeper.AddCollateral(ctx, supplierAddr, collat) s.Require().NoError(err) // return the account addresses - return lenderAddr, bumAddr + return supplierAddr, bumAddr } -// mintAndLendAtom mints a amount of atoms to an address +// mintAndSupplyAtom mints a amount of atoms to an address // account has been created with no assets. -func (s *IntegrationTestSuite) mintAndLendAtom(mintTo sdk.AccAddress, amountToMint, amountToLend int64) { +func (s *IntegrationTestSuite) mintAndSupplyAtom(mintTo sdk.AccAddress, amountToMint, amountToSupply int64) { app, ctx := s.app, s.ctx // mint and send atom to mint addr @@ -317,30 +317,30 @@ func (s *IntegrationTestSuite) mintAndLendAtom(mintTo sdk.AccAddress, amountToMi sdk.NewCoins(sdk.NewInt64Coin(atomIBCDenom, amountToMint)), // amountToMint Atom, )) - // lender lends amountToLend atom and receives amountToLend u/atom - lendCoin := sdk.NewInt64Coin(atomIBCDenom, amountToLend) - err := s.app.LeverageKeeper.LendAsset(ctx, mintTo, lendCoin) + // user supplies amountToSupply atom and receives amountToSupply u/atom + supplyCoin := sdk.NewInt64Coin(atomIBCDenom, amountToSupply) + err := s.app.LeverageKeeper.Supply(ctx, mintTo, supplyCoin) s.Require().NoError(err) - // lender enables u/atom as collateral - collat, err := s.app.LeverageKeeper.ExchangeToken(ctx, lendCoin) + // user enables u/atom as collateral + collat, err := s.app.LeverageKeeper.ExchangeToken(ctx, supplyCoin) s.Require().NoError(err) err = s.app.LeverageKeeper.AddCollateral(ctx, mintTo, collat) s.Require().NoError(err) } func (s *IntegrationTestSuite) TestBorrowAsset_Invalid() { - lenderAddr, _ := s.initBorrowScenario() + addr, _ := s.initBorrowScenario() - // The "lender" user from the init scenario is being used because it + // The "supplier" user from the init scenario is being used because it // already has 1k u/umee for collateral - // lender attempts to borrow 200 u/umee, fails because uTokens cannot be borrowed - err := s.app.LeverageKeeper.BorrowAsset(s.ctx, lenderAddr, sdk.NewInt64Coin("u/"+umeeapp.BondDenom, 200000000)) + // user attempts to borrow 200 u/umee, fails because uTokens cannot be borrowed + err := s.app.LeverageKeeper.BorrowAsset(s.ctx, addr, sdk.NewInt64Coin("u/"+umeeapp.BondDenom, 200000000)) s.Require().Error(err) - // lender attempts to borrow 200 abcd, fails because "abcd" is not a valid denom - err = s.app.LeverageKeeper.BorrowAsset(s.ctx, lenderAddr, sdk.NewInt64Coin("uabcd", 200000000)) + // user attempts to borrow 200 abcd, fails because "abcd" is not a valid denom + err = s.app.LeverageKeeper.BorrowAsset(s.ctx, addr, sdk.NewInt64Coin("uabcd", 200000000)) s.Require().Error(err) } @@ -357,214 +357,214 @@ func (s *IntegrationTestSuite) TestBorrowAsset_InsufficientCollateral() { func (s *IntegrationTestSuite) TestBorrowAsset_InsufficientLendingPool() { // Any user from the init scenario can perform this test, because it errors on module balance - lenderAddr, _ := s.initBorrowScenario() + addr, _ := s.initBorrowScenario() - // lender attempts to borrow 20000 umee, fails because of insufficient module account balance - err := s.app.LeverageKeeper.BorrowAsset(s.ctx, lenderAddr, sdk.NewInt64Coin(umeeapp.BondDenom, 20000000000)) + // user attempts to borrow 20000 umee, fails because of insufficient module account balance + err := s.app.LeverageKeeper.BorrowAsset(s.ctx, addr, sdk.NewInt64Coin(umeeapp.BondDenom, 20000000000)) s.Require().Error(err) } func (s *IntegrationTestSuite) TestRepayAsset_Invalid() { // Any user from the init scenario can be used for this test. - lenderAddr, _ := s.initBorrowScenario() + addr, _ := s.initBorrowScenario() - // lender attempts to repay 200 abcd, fails because "abcd" is not an accepted asset type - _, err := s.app.LeverageKeeper.RepayAsset(s.ctx, lenderAddr, sdk.NewInt64Coin("uabcd", 200000000)) + // user attempts to repay 200 abcd, fails because "abcd" is not an accepted asset type + _, err := s.app.LeverageKeeper.RepayAsset(s.ctx, addr, sdk.NewInt64Coin("uabcd", 200000000)) s.Require().Error(err) - // lender attempts to repay 200 u/umee, fails because utokens are not loanable assets - _, err = s.app.LeverageKeeper.RepayAsset(s.ctx, lenderAddr, sdk.NewInt64Coin("u/"+umeeapp.BondDenom, 200000000)) + // user attempts to repay 200 u/umee, fails because utokens are not loanable assets + _, err = s.app.LeverageKeeper.RepayAsset(s.ctx, addr, sdk.NewInt64Coin("u/"+umeeapp.BondDenom, 200000000)) s.Require().Error(err) } func (s *IntegrationTestSuite) TestBorrowAsset_Valid() { - lenderAddr, _ := s.initBorrowScenario() + addr, _ := s.initBorrowScenario() - // The "lender" user from the init scenario is being used because it + // The "supplier" user from the init scenario is being used because it // already has 1k u/umee for collateral - // lender borrows 20 umee - err := s.app.LeverageKeeper.BorrowAsset(s.ctx, lenderAddr, sdk.NewInt64Coin(umeeapp.BondDenom, 20000000)) + // user borrows 20 umee + err := s.app.LeverageKeeper.BorrowAsset(s.ctx, addr, sdk.NewInt64Coin(umeeapp.BondDenom, 20000000)) s.Require().NoError(err) - // verify lender's new loan amount in the correct denom (20 umee) - loanBalance := s.app.LeverageKeeper.GetBorrow(s.ctx, lenderAddr, umeeapp.BondDenom) + // verify user's new loan amount in the correct denom (20 umee) + loanBalance := s.app.LeverageKeeper.GetBorrow(s.ctx, addr, umeeapp.BondDenom) s.Require().Equal(loanBalance, sdk.NewInt64Coin(umeeapp.BondDenom, 20000000)) - // verify lender's total loan balance (sdk.Coins) is also 20 umee (no other coins present) - totalLoanBalance := s.app.LeverageKeeper.GetBorrowerBorrows(s.ctx, lenderAddr) + // verify user's total loan balance (sdk.Coins) is also 20 umee (no other coins present) + totalLoanBalance := s.app.LeverageKeeper.GetBorrowerBorrows(s.ctx, addr) s.Require().Equal(totalLoanBalance, sdk.NewCoins(sdk.NewInt64Coin(umeeapp.BondDenom, 20000000))) - // verify lender's new umee balance (10 - 1k from initial + 20 from loan = 9020 umee) - tokenBalance := s.app.BankKeeper.GetBalance(s.ctx, lenderAddr, umeeapp.BondDenom) + // verify user's new umee balance (10 - 1k from initial + 20 from loan = 9020 umee) + tokenBalance := s.app.BankKeeper.GetBalance(s.ctx, addr, umeeapp.BondDenom) s.Require().Equal(tokenBalance, sdk.NewInt64Coin(umeeapp.BondDenom, 9020000000)) - // verify lender's uToken balance remains at 0 u/umee from initial conditions - uTokenBalance := s.app.BankKeeper.GetBalance(s.ctx, lenderAddr, "u/"+umeeapp.BondDenom) + // verify user's uToken balance remains at 0 u/umee from initial conditions + uTokenBalance := s.app.BankKeeper.GetBalance(s.ctx, addr, "u/"+umeeapp.BondDenom) s.Require().Equal(uTokenBalance, sdk.NewInt64Coin("u/"+umeeapp.BondDenom, 0)) - // verify lender's uToken collateral remains at 1000 u/umee from initial conditions - collateralBalance := s.app.LeverageKeeper.GetCollateralAmount(s.ctx, lenderAddr, "u/"+umeeapp.BondDenom) + // verify user's uToken collateral remains at 1000 u/umee from initial conditions + collateralBalance := s.app.LeverageKeeper.GetCollateralAmount(s.ctx, addr, "u/"+umeeapp.BondDenom) s.Require().Equal(collateralBalance, sdk.NewInt64Coin("u/"+umeeapp.BondDenom, 1000000000)) } func (s *IntegrationTestSuite) TestBorrowAsset_BorrowLimit() { - lenderAddr, _ := s.initBorrowScenario() + addr, _ := s.initBorrowScenario() - // The "lender" user from the init scenario is being used because it + // The "supplier" user from the init scenario is being used because it // already has 1k u/umee for collateral - // determine an amount of umee to borrow, such that the lender will be at about 90% of their borrow limit + // determine an amount of umee to borrow, such that the user will be at about 90% of their borrow limit token, _ := s.app.LeverageKeeper.GetTokenSettings(s.ctx, umeeapp.BondDenom) uDenom := s.app.LeverageKeeper.FromTokenToUTokenDenom(s.ctx, umeeapp.BondDenom) - collateral := s.app.LeverageKeeper.GetCollateralAmount(s.ctx, lenderAddr, uDenom) + collateral := s.app.LeverageKeeper.GetCollateralAmount(s.ctx, addr, uDenom) amountToBorrow := token.CollateralWeight.Mul(sdk.MustNewDecFromStr("0.9")).MulInt(collateral.Amount).TruncateInt() - // lender borrows umee up to 90% of their borrow limit - err := s.app.LeverageKeeper.BorrowAsset(s.ctx, lenderAddr, sdk.NewCoin(umeeapp.BondDenom, amountToBorrow)) + // user borrows umee up to 90% of their borrow limit + err := s.app.LeverageKeeper.BorrowAsset(s.ctx, addr, sdk.NewCoin(umeeapp.BondDenom, amountToBorrow)) s.Require().NoError(err) - // lender tries to borrow the same amount again, fails due to borrow limit - err = s.app.LeverageKeeper.BorrowAsset(s.ctx, lenderAddr, sdk.NewCoin(umeeapp.BondDenom, amountToBorrow)) + // user tries to borrow the same amount again, fails due to borrow limit + err = s.app.LeverageKeeper.BorrowAsset(s.ctx, addr, sdk.NewCoin(umeeapp.BondDenom, amountToBorrow)) s.Require().Error(err) - // lender tries to disable u/umee as collateral, fails due to borrow limit - err = s.app.LeverageKeeper.RemoveCollateral(s.ctx, lenderAddr, sdk.NewCoin(uDenom, collateral.Amount)) + // user tries to disable u/umee as collateral, fails due to borrow limit + err = s.app.LeverageKeeper.RemoveCollateral(s.ctx, addr, sdk.NewCoin(uDenom, collateral.Amount)) s.Require().Error(err) - // lender tries to withdraw all its u/umee, fails due to borrow limit - err = s.app.LeverageKeeper.WithdrawAsset(s.ctx, lenderAddr, sdk.NewCoin(uDenom, collateral.Amount)) + // user tries to withdraw all its u/umee, fails due to borrow limit + err = s.app.LeverageKeeper.WithdrawAsset(s.ctx, addr, sdk.NewCoin(uDenom, collateral.Amount)) s.Require().Error(err) } func (s *IntegrationTestSuite) TestBorrowAsset_Reserved() { - // The "lender" user from the init scenario is being used because it + // The "supplier" user from the init scenario is being used because it // already has 1k u/umee for collateral. - lenderAddr, _ := s.initBorrowScenario() + addr, _ := s.initBorrowScenario() // artifically reserve 200 umee err := s.tk.SetReserveAmount(s.ctx, sdk.NewInt64Coin(umeeapp.BondDenom, 200000000)) s.Require().NoError(err) - // Note: Setting umee collateral weight to 1.0 to allow lender to borrow heavily + // Note: Setting umee collateral weight to 1.0 to allow user to borrow heavily umeeToken := newToken("uumee", "UMEE") umeeToken.CollateralWeight = sdk.MustNewDecFromStr("1.0") umeeToken.LiquidationThreshold = sdk.MustNewDecFromStr("1.0") s.Require().NoError(s.app.LeverageKeeper.SetTokenSettings(s.ctx, umeeToken)) - // Lender tries to borrow 1000 umee, insufficient balance because 200 of the + // Supplier tries to borrow 1000 umee, insufficient balance because 200 of the // module's 1000 umee are reserved. - err = s.app.LeverageKeeper.BorrowAsset(s.ctx, lenderAddr, sdk.NewInt64Coin(umeeapp.BondDenom, 1000000000)) + err = s.app.LeverageKeeper.BorrowAsset(s.ctx, addr, sdk.NewInt64Coin(umeeapp.BondDenom, 1000000000)) s.Require().Error(err) - // lender borrows 800 umee - err = s.app.LeverageKeeper.BorrowAsset(s.ctx, lenderAddr, sdk.NewInt64Coin(umeeapp.BondDenom, 800000000)) + // user borrows 800 umee + err = s.app.LeverageKeeper.BorrowAsset(s.ctx, addr, sdk.NewInt64Coin(umeeapp.BondDenom, 800000000)) s.Require().NoError(err) } func (s *IntegrationTestSuite) TestRepayAsset_Valid() { - // The "lender" user from the init scenario is being used because it + // The "supplier" user from the init scenario is being used because it // already has 1k u/umee for collateral. - lenderAddr, _ := s.initBorrowScenario() + addr, _ := s.initBorrowScenario() app, ctx := s.app, s.ctx - // lender borrows 20 umee - err := s.app.LeverageKeeper.BorrowAsset(ctx, lenderAddr, sdk.NewInt64Coin(umeeapp.BondDenom, 20000000)) + // user borrows 20 umee + err := s.app.LeverageKeeper.BorrowAsset(ctx, addr, sdk.NewInt64Coin(umeeapp.BondDenom, 20000000)) s.Require().NoError(err) - // lender repays 8 umee - repaid, err := s.app.LeverageKeeper.RepayAsset(ctx, lenderAddr, sdk.NewInt64Coin(umeeapp.BondDenom, 8000000)) + // user repays 8 umee + repaid, err := s.app.LeverageKeeper.RepayAsset(ctx, addr, sdk.NewInt64Coin(umeeapp.BondDenom, 8000000)) s.Require().NoError(err) s.Require().Equal(sdk.NewInt(8000000), repaid) - // verify lender's new loan amount (12 umee) - loanBalance := s.app.LeverageKeeper.GetBorrow(ctx, lenderAddr, umeeapp.BondDenom) + // verify user's new loan amount (12 umee) + loanBalance := s.app.LeverageKeeper.GetBorrow(ctx, addr, umeeapp.BondDenom) s.Require().Equal(loanBalance, sdk.NewInt64Coin(umeeapp.BondDenom, 12000000)) - // verify lender's new umee balance (10 - 1k from initial + 20 from loan - 8 repaid = 9012 umee) - tokenBalance := app.BankKeeper.GetBalance(ctx, lenderAddr, umeeapp.BondDenom) + // verify user's new umee balance (10 - 1k from initial + 20 from loan - 8 repaid = 9012 umee) + tokenBalance := app.BankKeeper.GetBalance(ctx, addr, umeeapp.BondDenom) s.Require().Equal(tokenBalance, sdk.NewInt64Coin(umeeapp.BondDenom, 9012000000)) - // verify lender's uToken balance remains at 0 u/umee from initial conditions - uTokenBalance := s.app.BankKeeper.GetBalance(s.ctx, lenderAddr, "u/"+umeeapp.BondDenom) + // verify user's uToken balance remains at 0 u/umee from initial conditions + uTokenBalance := s.app.BankKeeper.GetBalance(s.ctx, addr, "u/"+umeeapp.BondDenom) s.Require().Equal(uTokenBalance, sdk.NewInt64Coin("u/"+umeeapp.BondDenom, 0)) - // verify lender's uToken collateral remains at 1000 u/umee from initial conditions - collateralBalance := s.app.LeverageKeeper.GetCollateralAmount(s.ctx, lenderAddr, "u/"+umeeapp.BondDenom) + // verify user's uToken collateral remains at 1000 u/umee from initial conditions + collateralBalance := s.app.LeverageKeeper.GetCollateralAmount(s.ctx, addr, "u/"+umeeapp.BondDenom) s.Require().Equal(collateralBalance, sdk.NewInt64Coin("u/"+umeeapp.BondDenom, 1000000000)) - // lender repays 12 umee (loan repaid in full) - repaid, err = s.app.LeverageKeeper.RepayAsset(ctx, lenderAddr, sdk.NewInt64Coin(umeeapp.BondDenom, 12000000)) + // user repays 12 umee (loan repaid in full) + repaid, err = s.app.LeverageKeeper.RepayAsset(ctx, addr, sdk.NewInt64Coin(umeeapp.BondDenom, 12000000)) s.Require().NoError(err) s.Require().Equal(sdk.NewInt(12000000), repaid) - // verify lender's new loan amount in the correct denom (zero) - loanBalance = s.app.LeverageKeeper.GetBorrow(ctx, lenderAddr, umeeapp.BondDenom) + // verify user's new loan amount in the correct denom (zero) + loanBalance = s.app.LeverageKeeper.GetBorrow(ctx, addr, umeeapp.BondDenom) s.Require().Equal(loanBalance, sdk.NewInt64Coin(umeeapp.BondDenom, 0)) - // verify lender's new umee balance (10 - 1k from initial + 20 from loan - 20 repaid = 9000 umee) - tokenBalance = app.BankKeeper.GetBalance(ctx, lenderAddr, umeeapp.BondDenom) + // verify user's new umee balance (10 - 1k from initial + 20 from loan - 20 repaid = 9000 umee) + tokenBalance = app.BankKeeper.GetBalance(ctx, addr, umeeapp.BondDenom) s.Require().Equal(tokenBalance, sdk.NewInt64Coin(umeeapp.BondDenom, 9000000000)) - // verify lender's uToken balance remains at 0 u/umee from initial conditions - uTokenBalance = s.app.BankKeeper.GetBalance(s.ctx, lenderAddr, "u/"+umeeapp.BondDenom) + // verify user's uToken balance remains at 0 u/umee from initial conditions + uTokenBalance = s.app.BankKeeper.GetBalance(s.ctx, addr, "u/"+umeeapp.BondDenom) s.Require().Equal(uTokenBalance, sdk.NewInt64Coin("u/"+umeeapp.BondDenom, 0)) - // verify lender's uToken collateral remains at 1000 u/umee from initial conditions - collateralBalance = s.app.LeverageKeeper.GetCollateralAmount(s.ctx, lenderAddr, "u/"+umeeapp.BondDenom) + // verify user's uToken collateral remains at 1000 u/umee from initial conditions + collateralBalance = s.app.LeverageKeeper.GetCollateralAmount(s.ctx, addr, "u/"+umeeapp.BondDenom) s.Require().Equal(collateralBalance, sdk.NewInt64Coin("u/"+umeeapp.BondDenom, 1000000000)) } func (s *IntegrationTestSuite) TestRepayAsset_Overpay() { - // The "lender" user from the init scenario is being used because it + // The "supplier" user from the init scenario is being used because it // already has 1k u/umee for collateral. - lenderAddr, _ := s.initBorrowScenario() + addr, _ := s.initBorrowScenario() app, ctx := s.app, s.ctx - // lender borrows 20 umee - err := s.app.LeverageKeeper.BorrowAsset(ctx, lenderAddr, sdk.NewInt64Coin(umeeapp.BondDenom, 20000000)) + // user borrows 20 umee + err := s.app.LeverageKeeper.BorrowAsset(ctx, addr, sdk.NewInt64Coin(umeeapp.BondDenom, 20000000)) s.Require().NoError(err) - // lender repays 30 umee - should automatically reduce to 20 (the loan amount) and succeed + // user repays 30 umee - should automatically reduce to 20 (the loan amount) and succeed coinToRepay := sdk.NewInt64Coin(umeeapp.BondDenom, 30000000) - repaid, err := s.app.LeverageKeeper.RepayAsset(ctx, lenderAddr, coinToRepay) + repaid, err := s.app.LeverageKeeper.RepayAsset(ctx, addr, coinToRepay) s.Require().NoError(err) s.Require().Equal(sdk.NewInt(20000000), repaid) // verify that coinToRepay has not been modified s.Require().Equal(sdk.NewInt(30000000), coinToRepay.Amount) - // verify lender's new loan amount is 0 umee - loanBalance := s.app.LeverageKeeper.GetBorrow(ctx, lenderAddr, umeeapp.BondDenom) + // verify user's new loan amount is 0 umee + loanBalance := s.app.LeverageKeeper.GetBorrow(ctx, addr, umeeapp.BondDenom) s.Require().Equal(loanBalance, sdk.NewInt64Coin(umeeapp.BondDenom, 0)) - // verify lender's new umee balance (10 - 1k from initial + 20 from loan - 20 repaid = 9000 umee) - tokenBalance := app.BankKeeper.GetBalance(ctx, lenderAddr, umeeapp.BondDenom) + // verify user's new umee balance (10 - 1k from initial + 20 from loan - 20 repaid = 9000 umee) + tokenBalance := app.BankKeeper.GetBalance(ctx, addr, umeeapp.BondDenom) s.Require().Equal(tokenBalance, sdk.NewInt64Coin(umeeapp.BondDenom, 9000000000)) - // verify lender's uToken balance remains at 0 u/umee from initial conditions - uTokenBalance := s.app.BankKeeper.GetBalance(s.ctx, lenderAddr, "u/"+umeeapp.BondDenom) + // verify user's uToken balance remains at 0 u/umee from initial conditions + uTokenBalance := s.app.BankKeeper.GetBalance(s.ctx, addr, "u/"+umeeapp.BondDenom) s.Require().Equal(uTokenBalance, sdk.NewInt64Coin("u/"+umeeapp.BondDenom, 0)) - // verify lender's uToken collateral remains at 1000 u/umee from initial conditions - collateralBalance := s.app.LeverageKeeper.GetCollateralAmount(s.ctx, lenderAddr, "u/"+umeeapp.BondDenom) + // verify user's uToken collateral remains at 1000 u/umee from initial conditions + collateralBalance := s.app.LeverageKeeper.GetCollateralAmount(s.ctx, addr, "u/"+umeeapp.BondDenom) s.Require().Equal(collateralBalance, sdk.NewInt64Coin("u/"+umeeapp.BondDenom, 1000000000)) - // lender repays 50 umee - this time it fails because the loan no longer exists - _, err = s.app.LeverageKeeper.RepayAsset(ctx, lenderAddr, sdk.NewInt64Coin(umeeapp.BondDenom, 50000000)) + // user repays 50 umee - this time it fails because the loan no longer exists + _, err = s.app.LeverageKeeper.RepayAsset(ctx, addr, sdk.NewInt64Coin(umeeapp.BondDenom, 50000000)) s.Require().Error(err) } func (s *IntegrationTestSuite) TestLiqudateBorrow_Valid() { - lenderAddr, _ := s.initBorrowScenario() + addr, _ := s.initBorrowScenario() app, ctx := s.app, s.ctx - // The "lender" user from the init scenario is being used because it + // The "supplier" user from the init scenario is being used because it // already has 1k u/umee for collateral. - // lender borrows 90 umee - err := s.app.LeverageKeeper.BorrowAsset(ctx, lenderAddr, sdk.NewInt64Coin(umeeapp.BondDenom, 90000000)) + // user borrows 90 umee + err := s.app.LeverageKeeper.BorrowAsset(ctx, addr, sdk.NewInt64Coin(umeeapp.BondDenom, 90000000)) s.Require().NoError(err) // create an account and address which will represent a liquidator @@ -580,12 +580,12 @@ func (s *IntegrationTestSuite) TestLiqudateBorrow_Valid() { sdk.NewCoins(sdk.NewInt64Coin(umeeapp.BondDenom, 10000000000)), // 10k umee, )) - // liquidator attempts to liquidate lender, but lender is ineligible (not over borrow limit) + // liquidator attempts to liquidate user, but user is ineligible (not over borrow limit) // liquidator does not specify a minimum reward (hence 0 u/umee) repayment := sdk.NewInt64Coin(umeeapp.BondDenom, 30000000) // 30 umee rewardDenom := s.app.LeverageKeeper.FromTokenToUTokenDenom(ctx, umeeapp.BondDenom) unrestrictedReward := sdk.NewInt64Coin(umeeapp.BondDenom, 0) // 0 umee (rewardDenom = u/umee) - _, _, err = s.app.LeverageKeeper.LiquidateBorrow(ctx, liquidatorAddr, lenderAddr, repayment, unrestrictedReward) + _, _, err = s.app.LeverageKeeper.LiquidateBorrow(ctx, liquidatorAddr, addr, repayment, unrestrictedReward) s.Require().Error(err) // Note: Setting umee collateral weight to 0.0 to allow liquidation @@ -595,21 +595,21 @@ func (s *IntegrationTestSuite) TestLiqudateBorrow_Valid() { s.Require().NoError(s.app.LeverageKeeper.SetTokenSettings(s.ctx, umeeToken)) - // liquidator attempts to liquidate lender, but specifies too high of a minimum reward + // liquidator attempts to liquidate user, but specifies too high of a minimum reward repayment = sdk.NewInt64Coin(umeeapp.BondDenom, 10000000) // 10 umee excessiveReward := sdk.NewInt64Coin(umeeapp.BondDenom, 20000000) // 20 umee (rewardDenom = u/umee) - _, _, err = s.app.LeverageKeeper.LiquidateBorrow(ctx, liquidatorAddr, lenderAddr, repayment, excessiveReward) + _, _, err = s.app.LeverageKeeper.LiquidateBorrow(ctx, liquidatorAddr, addr, repayment, excessiveReward) s.Require().Error(err) - // liquidator partially liquidates lender, receiving some collateral + // liquidator partially liquidates user, receiving some collateral repayment = sdk.NewInt64Coin(umeeapp.BondDenom, 10000000) // 10 umee - repaid, reward, err := s.app.LeverageKeeper.LiquidateBorrow(ctx, liquidatorAddr, lenderAddr, repayment, unrestrictedReward) + repaid, reward, err := s.app.LeverageKeeper.LiquidateBorrow(ctx, liquidatorAddr, addr, repayment, unrestrictedReward) s.Require().NoError(err) s.Require().Equal(repayment.Amount, repaid) s.Require().Equal(sdk.NewInt(11000000), reward) - // verify lender's new loan amount is 80 umee (still over borrow limit) - loanBalance := s.app.LeverageKeeper.GetBorrow(ctx, lenderAddr, umeeapp.BondDenom) + // verify user's new loan amount is 80 umee (still over borrow limit) + loanBalance := s.app.LeverageKeeper.GetBorrow(ctx, addr, umeeapp.BondDenom) s.Require().Equal(loanBalance.String(), sdk.NewInt64Coin(umeeapp.BondDenom, 80000000).String()) // verify liquidator's new u/umee balance = 11 = (10 + liquidation incentive) @@ -620,9 +620,9 @@ func (s *IntegrationTestSuite) TestLiqudateBorrow_Valid() { tokenBalance := app.BankKeeper.GetBalance(ctx, liquidatorAddr, umeeapp.BondDenom) s.Require().Equal(tokenBalance, sdk.NewInt64Coin(umeeapp.BondDenom, 9990000000)) - // liquidator fully liquidates lender, receiving more collateral and reducing borrowed amount to zero + // liquidator fully liquidates user, receiving more collateral and reducing borrowed amount to zero repayment = sdk.NewInt64Coin(umeeapp.BondDenom, 300000000) // 300 umee - repaid, reward, err = s.app.LeverageKeeper.LiquidateBorrow(ctx, liquidatorAddr, lenderAddr, repayment, unrestrictedReward) + repaid, reward, err = s.app.LeverageKeeper.LiquidateBorrow(ctx, liquidatorAddr, addr, repayment, unrestrictedReward) s.Require().NoError(err) s.Require().Equal(sdk.NewInt(80000000), repaid) s.Require().Equal(sdk.NewInt(88000000), reward) @@ -634,8 +634,8 @@ func (s *IntegrationTestSuite) TestLiqudateBorrow_Valid() { uTokenBalance = app.BankKeeper.GetBalance(ctx, liquidatorAddr, rewardDenom) s.Require().Equal(uTokenBalance, sdk.NewInt64Coin(rewardDenom, 99000000)) - // verify lender's new loan amount is zero - loanBalance = s.app.LeverageKeeper.GetBorrow(ctx, lenderAddr, umeeapp.BondDenom) + // verify user's new loan amount is zero + loanBalance = s.app.LeverageKeeper.GetBorrow(ctx, addr, umeeapp.BondDenom) s.Require().Equal(loanBalance, sdk.NewInt64Coin(umeeapp.BondDenom, 0)) // verify liquidator's new umee balance (10k - 90) = 9910 umee @@ -644,7 +644,7 @@ func (s *IntegrationTestSuite) TestLiqudateBorrow_Valid() { } func (s *IntegrationTestSuite) TestRepayBadDebt() { - // Creating a lender so module account has some uumee + // Creating a supplier so module account has some uumee _ = s.setupAccount(umeeDenom, 200000000, 200000000, 0, false) // 200 umee // Using an address with no assets @@ -699,7 +699,7 @@ func (s *IntegrationTestSuite) TestRepayBadDebt() { func (s *IntegrationTestSuite) TestDeriveExchangeRate() { // The init scenario is being used so module balance starts at 1000 umee - // and the uToken supply starts at 1000 due to lender account + // and the uToken supply starts at 1000 due to supplier account _, addr := s.initBorrowScenario() // artificially increase total borrows (by affecting a single address) @@ -721,16 +721,16 @@ func (s *IntegrationTestSuite) TestDeriveExchangeRate() { } func (s *IntegrationTestSuite) TestAccrueZeroInterest() { - // The "lender" user from the init scenario is being used because it + // The "supplier" user from the init scenario is being used because it // already has 1k u/umee for collateral. - lenderAddr, _ := s.initBorrowScenario() + addr, _ := s.initBorrowScenario() - // lender borrows 40 umee - err := s.app.LeverageKeeper.BorrowAsset(s.ctx, lenderAddr, sdk.NewInt64Coin(umeeapp.BondDenom, 40000000)) + // user borrows 40 umee + err := s.app.LeverageKeeper.BorrowAsset(s.ctx, addr, sdk.NewInt64Coin(umeeapp.BondDenom, 40000000)) s.Require().NoError(err) - // verify lender's loan amount (40 umee) - loanBalance := s.app.LeverageKeeper.GetBorrow(s.ctx, lenderAddr, umeeapp.BondDenom) + // verify user's loan amount (40 umee) + loanBalance := s.app.LeverageKeeper.GetBorrow(s.ctx, addr, umeeapp.BondDenom) s.Require().Equal(loanBalance, sdk.NewInt64Coin(umeeapp.BondDenom, 40000000)) // Because no time has passed since genesis (due to test setup) this will not @@ -738,8 +738,8 @@ func (s *IntegrationTestSuite) TestAccrueZeroInterest() { err = s.app.LeverageKeeper.AccrueAllInterest(s.ctx) s.Require().NoError(err) - // verify lender's loan amount (40 umee) - loanBalance = s.app.LeverageKeeper.GetBorrow(s.ctx, lenderAddr, umeeapp.BondDenom) + // verify user's loan amount (40 umee) + loanBalance = s.app.LeverageKeeper.GetBorrow(s.ctx, addr, umeeapp.BondDenom) s.Require().Equal(loanBalance, sdk.NewInt64Coin(umeeapp.BondDenom, 40000000)) // borrow APY at utilization = 4% @@ -747,18 +747,18 @@ func (s *IntegrationTestSuite) TestAccrueZeroInterest() { borrowAPY := s.app.LeverageKeeper.DeriveBorrowAPY(s.ctx, umeeapp.BondDenom) s.Require().Equal(sdk.MustNewDecFromStr("0.03"), borrowAPY) - // lend APY when borrow APY is 3% + // supply APY when borrow APY is 3% // and utilization is 4%, and reservefactor is 20%, and OracleRewardFactor is 1% // 0.03 * 0.04 * (1 - 0.21) = 0.000948 - lendAPY := s.app.LeverageKeeper.DeriveLendAPY(s.ctx, umeeapp.BondDenom) + supplyAPY := s.app.LeverageKeeper.DeriveSupplyAPY(s.ctx, umeeapp.BondDenom) s.Require().NoError(err) - s.Require().Equal(sdk.MustNewDecFromStr("0.000948"), lendAPY) + s.Require().Equal(sdk.MustNewDecFromStr("0.000948"), supplyAPY) } func (s *IntegrationTestSuite) TestDynamicInterest() { // Init scenario is being used because the module account (lending pool) // already has 1000 umee. - lenderAddr, _ := s.initBorrowScenario() + addr, _ := s.initBorrowScenario() umeeToken := newToken("uumee", "UMEE") umeeToken.CollateralWeight = sdk.MustNewDecFromStr("1.0") // to allow high utilization @@ -770,16 +770,16 @@ func (s *IntegrationTestSuite) TestDynamicInterest() { rate := s.app.LeverageKeeper.DeriveBorrowAPY(s.ctx, umeeapp.BondDenom) s.Require().Equal(rate, sdk.MustNewDecFromStr("0.02")) - // lender borrows 200 umee, utilization 200/1000 - err := s.app.LeverageKeeper.BorrowAsset(s.ctx, lenderAddr, sdk.NewInt64Coin(umeeapp.BondDenom, 200000000)) + // user borrows 200 umee, utilization 200/1000 + err := s.app.LeverageKeeper.BorrowAsset(s.ctx, addr, sdk.NewInt64Coin(umeeapp.BondDenom, 200000000)) s.Require().NoError(err) // Between base interest and kink (20% utilization) rate = s.app.LeverageKeeper.DeriveBorrowAPY(s.ctx, umeeapp.BondDenom) s.Require().Equal(rate, sdk.MustNewDecFromStr("0.07")) - // lender borrows 600 more umee, utilization 800/1000 - err = s.app.LeverageKeeper.BorrowAsset(s.ctx, lenderAddr, sdk.NewInt64Coin(umeeapp.BondDenom, 600000000)) + // user borrows 600 more umee, utilization 800/1000 + err = s.app.LeverageKeeper.BorrowAsset(s.ctx, addr, sdk.NewInt64Coin(umeeapp.BondDenom, 600000000)) s.Require().NoError(err) // Kink interest rate (80% utilization) @@ -787,8 +787,8 @@ func (s *IntegrationTestSuite) TestDynamicInterest() { s.Require().NoError(err) s.Require().Equal(rate, sdk.MustNewDecFromStr("0.22")) - // lender borrows 100 more umee, utilization 900/1000 - err = s.app.LeverageKeeper.BorrowAsset(s.ctx, lenderAddr, sdk.NewInt64Coin(umeeapp.BondDenom, 100000000)) + // user borrows 100 more umee, utilization 900/1000 + err = s.app.LeverageKeeper.BorrowAsset(s.ctx, addr, sdk.NewInt64Coin(umeeapp.BondDenom, 100000000)) s.Require().NoError(err) // Between kink interest and max (90% utilization) @@ -796,8 +796,8 @@ func (s *IntegrationTestSuite) TestDynamicInterest() { s.Require().NoError(err) s.Require().Equal(rate, sdk.MustNewDecFromStr("0.87")) - // lender borrows 100 more umee, utilization 1000/1000 - err = s.app.LeverageKeeper.BorrowAsset(s.ctx, lenderAddr, sdk.NewInt64Coin(umeeapp.BondDenom, 100000000)) + // user borrows 100 more umee, utilization 1000/1000 + err = s.app.LeverageKeeper.BorrowAsset(s.ctx, addr, sdk.NewInt64Coin(umeeapp.BondDenom, 100000000)) s.Require().NoError(err) // Max interest rate (100% utilization) @@ -812,128 +812,128 @@ func (s *IntegrationTestSuite) TestDynamicInterest_InvalidAsset() { } func (s *IntegrationTestSuite) TestGetEligibleLiquidationTargets_OneAddrOneAsset() { - // The "lender" user from the init scenario is being used because it + // The "supplier" user from the init scenario is being used because it // already has 1k u/umee enabled as collateral. - lenderAddr, _ := s.initBorrowScenario() + addr, _ := s.initBorrowScenario() - // lender borrows 100 umee (max current allowed) lender amount enabled as collateral * CollateralWeight + // user borrows 100 umee (max current allowed) user amount enabled as collateral * CollateralWeight // = 1000 * 0.1 // = 100 - err := s.app.LeverageKeeper.BorrowAsset(s.ctx, lenderAddr, sdk.NewInt64Coin(umeeapp.BondDenom, 100000000)) + err := s.app.LeverageKeeper.BorrowAsset(s.ctx, addr, sdk.NewInt64Coin(umeeapp.BondDenom, 100000000)) s.Require().NoError(err) zeroAddresses, err := s.app.LeverageKeeper.GetEligibleLiquidationTargets(s.ctx) s.Require().NoError(err) s.Require().Equal([]sdk.AccAddress{}, zeroAddresses) - // Note: Setting umee liquidation threshold to 0.05 to make the lender eligible to liquidation + // Note: Setting umee liquidation threshold to 0.05 to make the user eligible to liquidation umeeToken := newToken("uumee", "UMEE") umeeToken.CollateralWeight = sdk.MustNewDecFromStr("0.05") umeeToken.LiquidationThreshold = sdk.MustNewDecFromStr("0.05") s.Require().NoError(s.app.LeverageKeeper.SetTokenSettings(s.ctx, umeeToken)) - lenderAddress, err := s.app.LeverageKeeper.GetEligibleLiquidationTargets(s.ctx) + targetAddress, err := s.app.LeverageKeeper.GetEligibleLiquidationTargets(s.ctx) s.Require().NoError(err) - s.Require().Equal([]sdk.AccAddress{lenderAddr}, lenderAddress) + s.Require().Equal([]sdk.AccAddress{addr}, targetAddress) // if it tries to borrow any other asset it should return an error - err = s.app.LeverageKeeper.BorrowAsset(s.ctx, lenderAddr, sdk.NewInt64Coin(atomIBCDenom, 1)) + err = s.app.LeverageKeeper.BorrowAsset(s.ctx, addr, sdk.NewInt64Coin(atomIBCDenom, 1)) s.Require().Error(err) } func (s *IntegrationTestSuite) TestGetEligibleLiquidationTargets_OneAddrTwoAsset() { - // The "lender" user from the init scenario is being used because it + // The "supplier" user from the init scenario is being used because it // already has 1k u/umee enabled as collateral. - lenderAddr, _ := s.initBorrowScenario() + addr, _ := s.initBorrowScenario() - // lender borrows 100 umee (max current allowed) lender amount enabled as collateral * CollateralWeight + // user borrows 100 umee (max current allowed) user amount enabled as collateral * CollateralWeight // = 1000 * 0.1 // = 100 - err := s.app.LeverageKeeper.BorrowAsset(s.ctx, lenderAddr, sdk.NewInt64Coin(umeeapp.BondDenom, 100000000)) + err := s.app.LeverageKeeper.BorrowAsset(s.ctx, addr, sdk.NewInt64Coin(umeeapp.BondDenom, 100000000)) s.Require().NoError(err) zeroAddresses, err := s.app.LeverageKeeper.GetEligibleLiquidationTargets(s.ctx) s.Require().NoError(err) s.Require().Equal([]sdk.AccAddress{}, zeroAddresses) - mintAmountAtom := int64(100000000) // 100 atom - lendAmountAtom := int64(50000000) // 50 atom + mintAmountAtom := int64(100000000) // 100 atom + supplyAmountAtom := int64(50000000) // 50 atom - // mints and send to lender 100 atom and already + // mints and send to user 100 atom and already // enable 50 u/atom as collateral. - s.mintAndLendAtom(lenderAddr, mintAmountAtom, lendAmountAtom) + s.mintAndSupplyAtom(addr, mintAmountAtom, supplyAmountAtom) - // lender borrows 4 atom (max current allowed - 1) lender amount enabled as collateral * CollateralWeight + // user borrows 4 atom (max current allowed - 1) user amount enabled as collateral * CollateralWeight // = (50 * 0.1) - 1 // = 4 - err = s.app.LeverageKeeper.BorrowAsset(s.ctx, lenderAddr, sdk.NewInt64Coin(atomIBCDenom, 4000000)) // 4 atom + err = s.app.LeverageKeeper.BorrowAsset(s.ctx, addr, sdk.NewInt64Coin(atomIBCDenom, 4000000)) // 4 atom s.Require().NoError(err) - // Note: Setting umee liquidation threshold to 0.05 to make the lender eligible for liquidation + // Note: Setting umee liquidation threshold to 0.05 to make the user eligible for liquidation umeeToken := newToken("uumee", "UMEE") umeeToken.CollateralWeight = sdk.MustNewDecFromStr("0.05") umeeToken.LiquidationThreshold = sdk.MustNewDecFromStr("0.05") s.Require().NoError(s.app.LeverageKeeper.SetTokenSettings(s.ctx, umeeToken)) - // Note: Setting atom collateral weight to 0.01 to make the lender eligible for liquidation + // Note: Setting atom collateral weight to 0.01 to make the user eligible for liquidation atomIBCToken := newToken(atomIBCDenom, "ATOM") atomIBCToken.CollateralWeight = sdk.MustNewDecFromStr("0.01") atomIBCToken.LiquidationThreshold = sdk.MustNewDecFromStr("0.01") s.Require().NoError(s.app.LeverageKeeper.SetTokenSettings(s.ctx, atomIBCToken)) - lenderAddress, err := s.app.LeverageKeeper.GetEligibleLiquidationTargets(s.ctx) + targetAddr, err := s.app.LeverageKeeper.GetEligibleLiquidationTargets(s.ctx) s.Require().NoError(err) - s.Require().Equal([]sdk.AccAddress{lenderAddr}, lenderAddress) + s.Require().Equal([]sdk.AccAddress{addr}, targetAddr) } func (s *IntegrationTestSuite) TestGetEligibleLiquidationTargets_TwoAddr() { - // The "lender" user from the init scenario is being used because it + // The "supplier" user from the init scenario is being used because it // already has 1k u/umee enabled as collateral. - lenderAddr, anotherLender := s.initBorrowScenario() + supplierAddr, anotherSupplier := s.initBorrowScenario() - // lender borrows 100 umee (max current allowed) lender amount enabled as collateral * CollateralWeight + // supplier borrows 100 umee (max current allowed) supplier amount enabled as collateral * CollateralWeight // = 1000 * 0.1 // = 100 - err := s.app.LeverageKeeper.BorrowAsset(s.ctx, lenderAddr, sdk.NewInt64Coin(umeeapp.BondDenom, 100000000)) + err := s.app.LeverageKeeper.BorrowAsset(s.ctx, supplierAddr, sdk.NewInt64Coin(umeeapp.BondDenom, 100000000)) s.Require().NoError(err) zeroAddresses, err := s.app.LeverageKeeper.GetEligibleLiquidationTargets(s.ctx) s.Require().NoError(err) s.Require().Equal([]sdk.AccAddress{}, zeroAddresses) - mintAmountAtom := int64(100000000) // 100 atom - lendAmountAtom := int64(50000000) // 50 atom + mintAmountAtom := int64(100000000) // 100 atom + supplyAmountAtom := int64(50000000) // 50 atom - // mints and send to anotherLender 100 atom and already + // mints and send to anotherSupplier 100 atom and already // enable 50 u/atom as collateral. - s.mintAndLendAtom(anotherLender, mintAmountAtom, lendAmountAtom) + s.mintAndSupplyAtom(anotherSupplier, mintAmountAtom, supplyAmountAtom) - // anotherLender borrows 4 atom (max current allowed - 1) anotherLender amount enabled as collateral * CollateralWeight + // anotherSupplier borrows 4 atom (max current allowed - 1) anotherSupplier amount enabled as collateral * CollateralWeight // = (50 * 0.1) - 1 // = 4 - err = s.app.LeverageKeeper.BorrowAsset(s.ctx, anotherLender, sdk.NewInt64Coin(atomIBCDenom, 4000000)) // 4 atom + err = s.app.LeverageKeeper.BorrowAsset(s.ctx, anotherSupplier, sdk.NewInt64Coin(atomIBCDenom, 4000000)) // 4 atom s.Require().NoError(err) - // Note: Setting umee liquidation threshold to 0.05 to make the lender eligible for liquidation + // Note: Setting umee liquidation threshold to 0.05 to make the supplier eligible for liquidation umeeToken := newToken("uumee", "UMEE") umeeToken.CollateralWeight = sdk.MustNewDecFromStr("0.05") umeeToken.LiquidationThreshold = sdk.MustNewDecFromStr("0.05") s.Require().NoError(s.app.LeverageKeeper.SetTokenSettings(s.ctx, umeeToken)) - // Note: Setting atom collateral weight to 0.01 to make the lender eligible for liquidation + // Note: Setting atom collateral weight to 0.01 to make the supplier eligible for liquidation atomIBCToken := newToken(atomIBCDenom, "ATOM") atomIBCToken.CollateralWeight = sdk.MustNewDecFromStr("0.01") atomIBCToken.LiquidationThreshold = sdk.MustNewDecFromStr("0.01") s.Require().NoError(s.app.LeverageKeeper.SetTokenSettings(s.ctx, atomIBCToken)) - lenderAddress, err := s.app.LeverageKeeper.GetEligibleLiquidationTargets(s.ctx) + supplierAddress, err := s.app.LeverageKeeper.GetEligibleLiquidationTargets(s.ctx) s.Require().NoError(err) - s.Require().Equal([]sdk.AccAddress{lenderAddr, anotherLender}, lenderAddress) + s.Require().Equal([]sdk.AccAddress{supplierAddr, anotherSupplier}, supplierAddress) } func (s *IntegrationTestSuite) TestReserveAmountInvariant() { @@ -947,9 +947,9 @@ func (s *IntegrationTestSuite) TestReserveAmountInvariant() { } func (s *IntegrationTestSuite) TestCollateralAmountInvariant() { - lenderAddr, _ := s.initBorrowScenario() + addr, _ := s.initBorrowScenario() - // The "lender" user from the init scenario is being used because it + // The "supplier" user from the init scenario is being used because it // already has 1k u/umee for collateral // check invariant @@ -958,8 +958,8 @@ func (s *IntegrationTestSuite) TestCollateralAmountInvariant() { uTokenDenom := types.UTokenFromTokenDenom(umeeapp.BondDenom) - // withdraw the lended umee in the initBorrowScenario - err := s.app.LeverageKeeper.WithdrawAsset(s.ctx, lenderAddr, sdk.NewInt64Coin(uTokenDenom, 1000000000)) + // withdraw the supplyed umee in the initBorrowScenario + err := s.app.LeverageKeeper.WithdrawAsset(s.ctx, addr, sdk.NewInt64Coin(uTokenDenom, 1000000000)) s.Require().NoError(err) // check invariant @@ -968,22 +968,22 @@ func (s *IntegrationTestSuite) TestCollateralAmountInvariant() { } func (s *IntegrationTestSuite) TestBorrowAmountInvariant() { - lenderAddr, _ := s.initBorrowScenario() + addr, _ := s.initBorrowScenario() - // The "lender" user from the init scenario is being used because it + // The "supplier" user from the init scenario is being used because it // already has 1k u/umee for collateral - // lender borrows 20 umee - err := s.app.LeverageKeeper.BorrowAsset(s.ctx, lenderAddr, sdk.NewInt64Coin(umeeapp.BondDenom, 20000000)) + // user borrows 20 umee + err := s.app.LeverageKeeper.BorrowAsset(s.ctx, addr, sdk.NewInt64Coin(umeeapp.BondDenom, 20000000)) s.Require().NoError(err) // check invariant _, broken := keeper.BorrowAmountInvariant(s.app.LeverageKeeper)(s.ctx) s.Require().False(broken) - // lender repays 30 umee, actually only 20 because is the min between + // user repays 30 umee, actually only 20 because is the min between // the amount borrowed and the amount repaid - _, err = s.app.LeverageKeeper.RepayAsset(s.ctx, lenderAddr, sdk.NewInt64Coin(umeeapp.BondDenom, 30000000)) + _, err = s.app.LeverageKeeper.RepayAsset(s.ctx, addr, sdk.NewInt64Coin(umeeapp.BondDenom, 30000000)) s.Require().NoError(err) // check invariant @@ -992,22 +992,22 @@ func (s *IntegrationTestSuite) TestBorrowAmountInvariant() { } func (s *IntegrationTestSuite) TestWithdrawAsset_InsufficientCollateral() { - // Create a lender with 1 u/umee collateral by lending 1 umee - lenderAddr := s.setupAccount(umeeapp.BondDenom, 1000000, 1000000, 0, true) + // Create a supplier with 1 u/umee collateral by supplying 1 umee + supplierAddr := s.setupAccount(umeeapp.BondDenom, 1000000, 1000000, 0, true) - // Create an additional lender so lending pool has extra umee + // Create an additional supplier so lending pool has extra umee _ = s.setupAccount(umeeapp.BondDenom, 1000000, 1000000, 0, true) // verify collateral amount and total supply of minted uTokens uTokenDenom := types.UTokenFromTokenDenom(umeeapp.BondDenom) - collateral := s.app.LeverageKeeper.GetCollateralAmount(s.ctx, lenderAddr, uTokenDenom) + collateral := s.app.LeverageKeeper.GetCollateralAmount(s.ctx, supplierAddr, uTokenDenom) s.Require().Equal(sdk.NewInt64Coin(uTokenDenom, 1000000), collateral) // 1 u/umee supply := s.app.LeverageKeeper.GetUTokenSupply(s.ctx, uTokenDenom) s.Require().Equal(sdk.NewInt64Coin(uTokenDenom, 2000000), supply) // 2 u/umee // withdraw more collateral than available uToken := collateral.Add(sdk.NewInt64Coin(uTokenDenom, 1)) - err := s.app.LeverageKeeper.WithdrawAsset(s.ctx, lenderAddr, uToken) + err := s.app.LeverageKeeper.WithdrawAsset(s.ctx, supplierAddr, uToken) s.Require().EqualError(err, "1000001u/uumee: insufficient balance") } @@ -1017,7 +1017,7 @@ func (s *IntegrationTestSuite) TestTotalCollateral() { collateral := s.app.LeverageKeeper.GetTotalCollateral(s.ctx, uDenom) s.Require().Equal(sdk.ZeroInt(), collateral) - // Uses borrow scenario, because lender possesses collateral + // Uses borrow scenario, because supplier possesses collateral _, _ = s.initBorrowScenario() // Test nonzero collateral diff --git a/x/leverage/keeper/loaned.go b/x/leverage/keeper/loaned.go index 7a4e542659..56cf5ed938 100644 --- a/x/leverage/keeper/loaned.go +++ b/x/leverage/keeper/loaned.go @@ -7,31 +7,31 @@ import ( "github.com/umee-network/umee/v2/x/leverage/types" ) -// GetLoaned returns an sdk.Coin representing how much of a given denom a -// lender has loaned, including interest accrued. -func (k Keeper) GetLoaned(ctx sdk.Context, lenderAddr sdk.AccAddress, denom string) (sdk.Coin, error) { +// GetSupplied returns an sdk.Coin representing how much of a given denom a +// user has supplied, including interest accrued. +func (k Keeper) GetSupplied(ctx sdk.Context, supplierAddr sdk.AccAddress, denom string) (sdk.Coin, error) { if !k.IsAcceptedToken(ctx, denom) { return sdk.Coin{}, sdkerrors.Wrap(types.ErrInvalidAsset, denom) } // sum wallet-held and collateral-enabled uTokens in the associated uToken denom uDenom := k.FromTokenToUTokenDenom(ctx, denom) - balance := k.bankKeeper.GetBalance(ctx, lenderAddr, uDenom) - collateral := k.GetCollateralAmount(ctx, lenderAddr, uDenom) + balance := k.bankKeeper.GetBalance(ctx, supplierAddr, uDenom) + collateral := k.GetCollateralAmount(ctx, supplierAddr, uDenom) // convert uTokens to tokens return k.ExchangeUToken(ctx, balance.Add(collateral)) } -// GetLenderLoaned returns the total tokens loaned by a lender across all denoms, -// including any interest accrued. -func (k Keeper) GetLenderLoaned(ctx sdk.Context, lenderAddr sdk.AccAddress) (sdk.Coins, error) { +// GetAllSupplied returns the total tokens supplied by a user, including +// any interest accrued. +func (k Keeper) GetAllSupplied(ctx sdk.Context, supplierAddr sdk.AccAddress) (sdk.Coins, error) { // get all uTokens set as collateral - collateral := k.GetBorrowerCollateral(ctx, lenderAddr) + collateral := k.GetBorrowerCollateral(ctx, supplierAddr) - // get all uTokens not set as collateral by filtering non-uTokens from lender balance + // get all uTokens not set as collateral by filtering non-uTokens from supplier balance uTokens := sdk.Coins{} - balance := k.bankKeeper.GetAllBalances(ctx, lenderAddr) + balance := k.bankKeeper.GetAllBalances(ctx, supplierAddr) for _, coin := range balance { if k.IsAcceptedUToken(ctx, coin.Denom) { uTokens = uTokens.Add(coin) @@ -42,9 +42,9 @@ func (k Keeper) GetLenderLoaned(ctx sdk.Context, lenderAddr sdk.AccAddress) (sdk return k.ExchangeUTokens(ctx, collateral.Add(uTokens...)) } -// GetTotalLoaned returns the total loaned by all lenders in a given denom, +// GetTotalSupply returns the total supplied by all suppliers in a given denom, // including any interest accrued. -func (k Keeper) GetTotalLoaned(ctx sdk.Context, denom string) (sdk.Coin, error) { +func (k Keeper) GetTotalSupply(ctx sdk.Context, denom string) (sdk.Coin, error) { if !k.IsAcceptedToken(ctx, denom) { return sdk.Coin{}, sdkerrors.Wrap(types.ErrInvalidAsset, denom) } diff --git a/x/leverage/keeper/msg_server.go b/x/leverage/keeper/msg_server.go index 03d9de7ae3..ce6f5bac70 100644 --- a/x/leverage/keeper/msg_server.go +++ b/x/leverage/keeper/msg_server.go @@ -20,41 +20,41 @@ func NewMsgServerImpl(keeper Keeper) types.MsgServer { return &msgServer{keeper: keeper} } -func (s msgServer) LendAsset( +func (s msgServer) Supply( goCtx context.Context, - msg *types.MsgLendAsset, -) (*types.MsgLendAssetResponse, error) { + msg *types.MsgSupply, +) (*types.MsgSupplyResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - lenderAddr, err := sdk.AccAddressFromBech32(msg.Lender) + supplierAddr, err := sdk.AccAddressFromBech32(msg.Supplier) if err != nil { return nil, err } - if err := s.keeper.LendAsset(ctx, lenderAddr, msg.Amount); err != nil { + if err := s.keeper.Supply(ctx, supplierAddr, msg.Amount); err != nil { return nil, err } s.keeper.Logger(ctx).Debug( - "assets loaned", - "lender", lenderAddr.String(), + "assets supplied", + "supplier", supplierAddr.String(), "amount", msg.Amount.String(), ) ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeLoanAsset, - sdk.NewAttribute(types.EventAttrLender, lenderAddr.String()), + sdk.NewAttribute(types.EventAttrSupplier, supplierAddr.String()), sdk.NewAttribute(sdk.AttributeKeyAmount, msg.Amount.String()), ), sdk.NewEvent( sdk.EventTypeMessage, sdk.NewAttribute(sdk.AttributeKeyModule, types.EventAttrModule), - sdk.NewAttribute(sdk.AttributeKeySender, lenderAddr.String()), + sdk.NewAttribute(sdk.AttributeKeySender, supplierAddr.String()), ), }) - return &types.MsgLendAssetResponse{}, nil + return &types.MsgSupplyResponse{}, nil } func (s msgServer) WithdrawAsset( @@ -63,31 +63,31 @@ func (s msgServer) WithdrawAsset( ) (*types.MsgWithdrawAssetResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - lenderAddr, err := sdk.AccAddressFromBech32(msg.Lender) + supplierAddr, err := sdk.AccAddressFromBech32(msg.Supplier) if err != nil { return nil, err } - if err := s.keeper.WithdrawAsset(ctx, lenderAddr, msg.Amount); err != nil { + if err := s.keeper.WithdrawAsset(ctx, supplierAddr, msg.Amount); err != nil { return nil, err } s.keeper.Logger(ctx).Debug( - "loaned assets withdrawn", - "lender", lenderAddr.String(), + "supplied assets withdrawn", + "supplier", supplierAddr.String(), "amount", msg.Amount.String(), ) ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - types.EventTypeWithdrawLoanedAsset, - sdk.NewAttribute(types.EventAttrLender, lenderAddr.String()), + types.EventTypeWithdrawAsset, + sdk.NewAttribute(types.EventAttrSupplier, supplierAddr.String()), sdk.NewAttribute(sdk.AttributeKeyAmount, msg.Amount.String()), ), sdk.NewEvent( sdk.EventTypeMessage, sdk.NewAttribute(sdk.AttributeKeyModule, types.EventAttrModule), - sdk.NewAttribute(sdk.AttributeKeySender, lenderAddr.String()), + sdk.NewAttribute(sdk.AttributeKeySender, supplierAddr.String()), ), }) diff --git a/x/leverage/keeper/validate.go b/x/leverage/keeper/validate.go index d946b1d6ac..5f8adbbb85 100644 --- a/x/leverage/keeper/validate.go +++ b/x/leverage/keeper/validate.go @@ -6,8 +6,8 @@ import ( "github.com/umee-network/umee/v2/x/leverage/types" ) -// validateLendAsset validates an sdk.Coin and ensures its Denom is a Token with EnableMsgLend -func (k Keeper) validateLendAsset(ctx sdk.Context, loan sdk.Coin) error { +// validateSupply validates an sdk.Coin and ensures its Denom is a Token with EnableMsgSupply +func (k Keeper) validateSupply(ctx sdk.Context, loan sdk.Coin) error { if !loan.IsValid() { return types.ErrInvalidAsset.Wrap(loan.String()) } @@ -15,7 +15,7 @@ func (k Keeper) validateLendAsset(ctx sdk.Context, loan sdk.Coin) error { if err != nil { return err } - return token.AssertLendEnabled() + return token.AssertSupplyEnabled() } // validateBorrowAsset validates an sdk.Coin and ensures its Denom is a Token with EnableMsgBorrow @@ -31,7 +31,7 @@ func (k Keeper) validateBorrowAsset(ctx sdk.Context, borrow sdk.Coin) error { return token.AssertBorrowEnabled() } -// validateCollateralAsset validates an sdk.Coin and ensures its Denom is a Token with EnableMsgLend +// validateCollateralAsset validates an sdk.Coin and ensures its Denom is a Token with EnableMsgSupply // and CollateralWeight > 0 func (k Keeper) validateCollateralAsset(ctx sdk.Context, collateral sdk.Coin) error { if !collateral.IsValid() { @@ -46,5 +46,5 @@ func (k Keeper) validateCollateralAsset(ctx sdk.Context, collateral sdk.Coin) er if token.CollateralWeight.IsZero() { return types.ErrCollateralWeightZero } - return token.AssertLendEnabled() + return token.AssertSupplyEnabled() } diff --git a/x/leverage/simulation/operations.go b/x/leverage/simulation/operations.go index 1b2735d821..1955f67be6 100644 --- a/x/leverage/simulation/operations.go +++ b/x/leverage/simulation/operations.go @@ -16,14 +16,14 @@ import ( // Default simulation operation weights for leverage messages const ( - DefaultWeightMsgLendAsset int = 100 + DefaultWeightMsgSupply int = 100 DefaultWeightMsgWithdrawAsset int = 85 DefaultWeightMsgBorrowAsset int = 80 DefaultWeightMsgAddCollateral int = 60 DefaultWeightMsgRemoveCollateral int = 0 DefaultWeightMsgRepayAsset int = 70 DefaultWeightMsgLiquidate int = 75 - OperationWeightMsgLendAsset = "op_weight_msg_lend_asset" + OperationWeightMsgSupply = "op_weight_msg_supply_asset" OperationWeightMsgWithdrawAsset = "op_weight_msg_withdraw_asset" OperationWeightMsgBorrowAsset = "op_weight_msg_borrow_asset" OperationWeightMsgAddCollateral = "op_weight_msg_add_collateral" @@ -38,7 +38,7 @@ func WeightedOperations( lk keeper.Keeper, ) simulation.WeightedOperations { var ( - weightMsgLend int + weightMsgSupply int weightMsgWithdraw int weightMsgBorrow int weightMsgAddCollateral int @@ -46,9 +46,9 @@ func WeightedOperations( weightMsgRepayAsset int weightMsgLiquidate int ) - appParams.GetOrGenerate(cdc, OperationWeightMsgLendAsset, &weightMsgLend, nil, + appParams.GetOrGenerate(cdc, OperationWeightMsgSupply, &weightMsgSupply, nil, func(_ *rand.Rand) { - weightMsgLend = DefaultWeightMsgLendAsset + weightMsgSupply = DefaultWeightMsgSupply }, ) appParams.GetOrGenerate(cdc, OperationWeightMsgWithdrawAsset, &weightMsgWithdraw, nil, @@ -84,8 +84,8 @@ func WeightedOperations( return simulation.WeightedOperations{ simulation.NewWeightedOperation( - weightMsgLend, - SimulateMsgLendAsset(ak, bk), + weightMsgSupply, + SimulateMsgSupply(ak, bk), ), simulation.NewWeightedOperation( weightMsgWithdraw, @@ -114,9 +114,9 @@ func WeightedOperations( } } -// SimulateMsgLendAsset tests and runs a single msg lend where -// an account lends some available assets. -func SimulateMsgLendAsset(ak simulation.AccountKeeper, bk types.BankKeeper) simtypes.Operation { +// SimulateMsgSupply tests and runs a single msg supply where +// an account supplies some available assets. +func SimulateMsgSupply(ak simulation.AccountKeeper, bk types.BankKeeper) simtypes.Operation { return func( r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, @@ -126,7 +126,7 @@ func SimulateMsgLendAsset(ak simulation.AccountKeeper, bk types.BankKeeper) simt return simtypes.NoOpMsg(types.ModuleName, types.EventTypeLoanAsset, "skip all transfers"), nil, nil } - msg := types.NewMsgLendAsset(from.Address, coin) + msg := types.NewMsgSupply(from.Address, coin) txCtx := simulation.OperationInput{ R: r, @@ -148,7 +148,7 @@ func SimulateMsgLendAsset(ak simulation.AccountKeeper, bk types.BankKeeper) simt } // SimulateMsgWithdrawAsset tests and runs a single msg withdraw where -// an account attempts to withdraw some loaned assets. +// an account attempts to withdraw some supplied assets. func SimulateMsgWithdrawAsset(ak simulation.AccountKeeper, bk types.BankKeeper, lk keeper.Keeper) simtypes.Operation { return func( r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, @@ -156,7 +156,7 @@ func SimulateMsgWithdrawAsset(ak simulation.AccountKeeper, bk types.BankKeeper, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { from, withdrawUToken, skip := randomWithdrawFields(r, ctx, accs, bk, lk) if skip { - return simtypes.NoOpMsg(types.ModuleName, types.EventTypeWithdrawLoanedAsset, "skip all transfers"), nil, nil + return simtypes.NoOpMsg(types.ModuleName, types.EventTypeWithdrawAsset, "skip all transfers"), nil, nil } msg := types.NewMsgWithdrawAsset(from.Address, withdrawUToken) @@ -167,7 +167,7 @@ func SimulateMsgWithdrawAsset(ak simulation.AccountKeeper, bk types.BankKeeper, TxGen: simappparams.MakeTestEncodingConfig().TxConfig, Cdc: nil, Msg: msg, - MsgType: types.EventTypeWithdrawLoanedAsset, + MsgType: types.EventTypeWithdrawAsset, Context: ctx, SimAccount: from, AccountKeeper: ak, diff --git a/x/leverage/simulation/operations_test.go b/x/leverage/simulation/operations_test.go index f9cb2e273b..09d49a18e0 100644 --- a/x/leverage/simulation/operations_test.go +++ b/x/leverage/simulation/operations_test.go @@ -43,7 +43,7 @@ func (s *SimTestSuite) SetupTest() { LiquidationIncentive: sdk.MustNewDecFromStr("0.1"), SymbolDenom: umeeapp.DisplayDenom, Exponent: 6, - EnableMsgLend: true, + EnableMsgSupply: true, EnableMsgBorrow: true, Blacklist: false, } @@ -59,7 +59,7 @@ func (s *SimTestSuite) SetupTest() { LiquidationIncentive: sdk.MustNewDecFromStr("0.11"), SymbolDenom: "ATOM", Exponent: 6, - EnableMsgLend: true, + EnableMsgSupply: true, EnableMsgBorrow: true, Blacklist: false, } @@ -75,7 +75,7 @@ func (s *SimTestSuite) SetupTest() { LiquidationIncentive: sdk.MustNewDecFromStr("0.1"), SymbolDenom: "ABC", Exponent: 6, - EnableMsgLend: true, + EnableMsgSupply: true, EnableMsgBorrow: true, Blacklist: false, } @@ -136,8 +136,8 @@ func (s *SimTestSuite) TestWeightedOperations() { opMsgRoute string opMsgName string }{ - {simulation.DefaultWeightMsgLendAsset, types.ModuleName, types.EventTypeLoanAsset}, - {simulation.DefaultWeightMsgWithdrawAsset, types.ModuleName, types.EventTypeWithdrawLoanedAsset}, + {simulation.DefaultWeightMsgSupply, types.ModuleName, types.EventTypeLoanAsset}, + {simulation.DefaultWeightMsgWithdrawAsset, types.ModuleName, types.EventTypeWithdrawAsset}, {simulation.DefaultWeightMsgBorrowAsset, types.ModuleName, types.EventTypeBorrowAsset}, {simulation.DefaultWeightMsgAddCollateral, types.ModuleName, types.EventTypeAddCollateral}, {simulation.DefaultWeightMsgRemoveCollateral, types.ModuleName, types.EventTypeRemoveCollateral}, @@ -156,21 +156,21 @@ func (s *SimTestSuite) TestWeightedOperations() { } } -func (s *SimTestSuite) TestSimulateMsgLendAsset() { +func (s *SimTestSuite) TestSimulateMsgSupply() { r := rand.New(rand.NewSource(1)) accs := s.getTestingAccounts(r, 3, func(fundedAccount simtypes.Account) {}) s.app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: s.app.LastBlockHeight() + 1, AppHash: s.app.LastCommitID().Hash}}) - op := simulation.SimulateMsgLendAsset(s.app.AccountKeeper, s.app.BankKeeper) + op := simulation.SimulateMsgSupply(s.app.AccountKeeper, s.app.BankKeeper) operationMsg, futureOperations, err := op(r, s.app.BaseApp, s.ctx, accs, "") s.Require().NoError(err) - var msg types.MsgLendAsset + var msg types.MsgSupply types.ModuleCdc.UnmarshalJSON(operationMsg.Msg, &msg) s.Require().True(operationMsg.OK) - s.Require().Equal("umee1ghekyjucln7y67ntx7cf27m9dpuxxemn8w6h33", msg.Lender) + s.Require().Equal("umee1ghekyjucln7y67ntx7cf27m9dpuxxemn8w6h33", msg.Supplier) s.Require().Equal(types.EventTypeLoanAsset, msg.Type()) s.Require().Equal("185121068uumee", msg.Amount.String()) s.Require().Len(futureOperations, 0) @@ -178,10 +178,10 @@ func (s *SimTestSuite) TestSimulateMsgLendAsset() { func (s *SimTestSuite) TestSimulateMsgWithdrawAsset() { r := rand.New(rand.NewSource(1)) - lendToken := sdk.NewCoin(umeeapp.BondDenom, sdk.NewInt(100)) + supplyToken := sdk.NewCoin(umeeapp.BondDenom, sdk.NewInt(100)) accs := s.getTestingAccounts(r, 3, func(fundedAccount simtypes.Account) { - s.app.LeverageKeeper.LendAsset(s.ctx, fundedAccount.Address, lendToken) + s.app.LeverageKeeper.Supply(s.ctx, fundedAccount.Address, supplyToken) }) s.app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: s.app.LastBlockHeight() + 1, AppHash: s.app.LastCommitID().Hash}}) @@ -194,24 +194,24 @@ func (s *SimTestSuite) TestSimulateMsgWithdrawAsset() { types.ModuleCdc.UnmarshalJSON(operationMsg.Msg, &msg) s.Require().True(operationMsg.OK) - s.Require().Equal("umee1ghekyjucln7y67ntx7cf27m9dpuxxemn8w6h33", msg.Lender) - s.Require().Equal(types.EventTypeWithdrawLoanedAsset, msg.Type()) + s.Require().Equal("umee1ghekyjucln7y67ntx7cf27m9dpuxxemn8w6h33", msg.Supplier) + s.Require().Equal(types.EventTypeWithdrawAsset, msg.Type()) s.Require().Equal("73u/uumee", msg.Amount.String()) s.Require().Len(futureOperations, 0) } func (s *SimTestSuite) TestSimulateMsgBorrowAsset() { r := rand.New(rand.NewSource(8)) - lendToken := sdk.NewCoin(umeeapp.BondDenom, sdk.NewInt(1000)) + supplyToken := sdk.NewCoin(umeeapp.BondDenom, sdk.NewInt(1000)) accs := s.getTestingAccounts(r, 3, func(fundedAccount simtypes.Account) { - uToken, err := s.app.LeverageKeeper.ExchangeToken(s.ctx, lendToken) + uToken, err := s.app.LeverageKeeper.ExchangeToken(s.ctx, supplyToken) if err != nil { s.Require().NoError(err) } s.app.LeverageKeeper.AddCollateral(s.ctx, fundedAccount.Address, uToken) - s.app.LeverageKeeper.LendAsset(s.ctx, fundedAccount.Address, lendToken) + s.app.LeverageKeeper.Supply(s.ctx, fundedAccount.Address, supplyToken) }) s.app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: s.app.LastBlockHeight() + 1, AppHash: s.app.LastCommitID().Hash}}) @@ -274,16 +274,16 @@ func (s *SimTestSuite) TestSimulateMsgRemoveCollateral() { func (s *SimTestSuite) TestSimulateMsgRepayAsset() { r := rand.New(rand.NewSource(1)) - lendToken := sdk.NewInt64Coin(umeeapp.BondDenom, 100) + supplyToken := sdk.NewInt64Coin(umeeapp.BondDenom, 100) borrowToken := sdk.NewInt64Coin(umeeapp.BondDenom, 20) accs := s.getTestingAccounts(r, 3, func(fundedAccount simtypes.Account) { - uToken, err := s.app.LeverageKeeper.ExchangeToken(s.ctx, lendToken) + uToken, err := s.app.LeverageKeeper.ExchangeToken(s.ctx, supplyToken) if err != nil { s.Require().NoError(err) } - s.Require().NoError(s.app.LeverageKeeper.LendAsset(s.ctx, fundedAccount.Address, lendToken)) + s.Require().NoError(s.app.LeverageKeeper.Supply(s.ctx, fundedAccount.Address, supplyToken)) s.Require().NoError(s.app.LeverageKeeper.AddCollateral(s.ctx, fundedAccount.Address, uToken)) s.Require().NoError(s.app.LeverageKeeper.BorrowAsset(s.ctx, fundedAccount.Address, borrowToken)) }) @@ -306,12 +306,12 @@ func (s *SimTestSuite) TestSimulateMsgRepayAsset() { func (s *SimTestSuite) TestSimulateMsgLiquidate() { r := rand.New(rand.NewSource(1)) - lendToken := sdk.NewCoin(umeeapp.BondDenom, sdk.NewInt(100)) + supplyToken := sdk.NewCoin(umeeapp.BondDenom, sdk.NewInt(100)) uToken := sdk.NewCoin("u/"+umeeapp.BondDenom, sdk.NewInt(100)) borrowToken := sdk.NewCoin(umeeapp.BondDenom, sdk.NewInt(10)) accs := s.getTestingAccounts(r, 3, func(fundedAccount simtypes.Account) { - s.Require().NoError(s.app.LeverageKeeper.LendAsset(s.ctx, fundedAccount.Address, lendToken)) + s.Require().NoError(s.app.LeverageKeeper.Supply(s.ctx, fundedAccount.Address, supplyToken)) s.Require().NoError(s.app.LeverageKeeper.AddCollateral(s.ctx, fundedAccount.Address, uToken)) s.Require().NoError(s.app.LeverageKeeper.BorrowAsset(s.ctx, fundedAccount.Address, borrowToken)) }) diff --git a/x/leverage/spec/01_concepts.md b/x/leverage/spec/01_concepts.md index 0fe103e461..4e740bbd79 100644 --- a/x/leverage/spec/01_concepts.md +++ b/x/leverage/spec/01_concepts.md @@ -6,9 +6,9 @@ This document covers basic concepts and math that determine the `leverage` modul At the foundation of the `leverage` module is the [Token Registry](02_state.md#Token-Registry), which contains a list of accepted types. -This list is controlled by governance. Assets that are not in the token registry are nor available for borrowing or lending. +This list is controlled by governance. Assets that are not in the token registry are nor available for borrowing or supplying. -Once added to the token registry, assets cannot be removed. In the rare case where an asset would need to be phased out, it can have lending or borrowing disabled, or in extreme cases, be ignored by collateral and borrowed value calculations using a blacklist. +Once added to the token registry, assets cannot be removed. In the rare case where an asset would need to be phased out, it can have supplying or borrowing disabled, or in extreme cases, be ignored by collateral and borrowed value calculations using a blacklist. ### uTokens @@ -16,19 +16,19 @@ Every base asset has an associated _uToken_ denomination. uTokens do not have parameters like the `Token` struct does, and they are always represented in account balances with a denom of `UTokenPrefix + token.BaseDenom`. For example, the base asset `uumee` is associated with the uToken denomination `u/uumee`. -## Lending and Borrowing +## Supplying and Borrowing Users have the following actions available to them: -- [Lend](04_messages.md#MsgLendAsset) accepted asset types to the module, receiving _uTokens_ in exchange. +- [Supply](04_messages.md#MsgSupply) accepted asset types to the module, receiving _uTokens_ in exchange. - Lenders earn interest at an effective rate of the asset's [Lending APY](01_concepts.md#Lending-APY) as the [uToken Exchange Rate](01_concepts.md#uToken-Exchange-Rate) increases over time. + Suppliers earn interest at an effective rate of the asset's [Supplying APY](01_concepts.md#Supplying-APY) as the [uToken Exchange Rate](01_concepts.md#uToken-Exchange-Rate) increases over time. - Additionally, for assets denominations already enabled as collateral, the lent assets immediately become collateral as well, causing their borrow limit to increase. + Additionally, for assets denominations already enabled as collateral, the supplied assets immediately become collateral as well, causing their borrow limit to increase. - If a lender is undercollateralized (borrowed value > borrow limit), collateral is eligible for liquidation and cannot be withdrawn until the user's borrows are healthy again. + If a user is undercollateralized (borrowed value > borrow limit), collateral is eligible for liquidation and cannot be withdrawn until the user's borrows are healthy again. - Care should be taken by undercollateralized users when lending token amounts too small to restore the health of their borrows, as the newly lent assets will be eligible for liquidation immediately. + Care should be taken by undercollateralized users when supplying token amounts too small to restore the health of their borrows, as the newly supplied assets will be eligible for liquidation immediately. - [Enable or Disable](04_messages.md#MsgSetCollateral) a uToken denomination as collateral for borrowing. @@ -36,7 +36,7 @@ Users have the following actions available to them: If the user is undercollateralized (borrowed value > borrow limit), enabled collateral is eligible for liquidation and cannot be disabled until the user's borrows are healthy again. -- [Withdraw](04_messages.md#MsgWithdrawAsset) lent assets by turning in uTokens of the associated denomination. +- [Withdraw](04_messages.md#MsgWithdrawAsset) supplied assets by turning in uTokens of the associated denomination. Withdraw respects the [uToken Exchange Rate](01_concepts.md#uToken-Exchange-Rate). A user can always withdraw non-collateral uTokens, but can only withdraw collateral-enabled uTokens if it would not reduce their [Borrow Limit](01_concepts.md#Borrow-Limit) below their total borrowed value. @@ -152,13 +152,13 @@ The `Token` struct stored in state for a given denomination defines three points When utilization is between two of the above values, borrow APY is determined by linear interpolation between the two points. The resulting graph looks like a straight line with a "kink" in it. -### Lending APY +### Supplying APY -The interest accrued on borrows, after some of it is set aside for reserves, is distributed to all lenders (i.e. uToken holders) of that denomination by virtue of the uToken exchange rate increasing. +The interest accrued on borrows, after some of it is set aside for reserves, is distributed to all suppliers (i.e. uToken holders) of that denomination by virtue of the uToken exchange rate increasing. -While Lending APY is never explicity used in the leverage module due to its indirect nature, it is available for querying and can be calculated: +While Supplying APY is never explicity used in the leverage module due to its indirect nature, it is available for querying and can be calculated: -`LendAPY(token) = BorrowAPY(token) * SupplyUtilization(token) * [1.0 - ReserveFactor(token)]` +`SupplyAPY(token) = BorrowAPY(token) * SupplyUtilization(token) * [1.0 - ReserveFactor(token)]` ### Close Factor @@ -186,6 +186,6 @@ if portionOverLimit > params.CompleteLiquidationThreshold { ### Market Size -The `MarketSize` of a token denom is the USD value of all tokens loaned to the asset facility, including those that have been borrowed out and any interest accrued, minus reserves. +The `MarketSize` of a token denom is the USD value of all tokens supplied to the asset facility, including those that have been borrowed out and any interest accrued, minus reserves. `MarketSize(denom) = oracle.Price(denom) * [ ModuleBalance(denom) - ReservedAmount(denom) + TotalBorrowed(denom) ]` diff --git a/x/leverage/spec/02_state.md b/x/leverage/spec/02_state.md index 6a24989b87..6f2e2b96f0 100644 --- a/x/leverage/spec/02_state.md +++ b/x/leverage/spec/02_state.md @@ -46,8 +46,8 @@ type Token struct { LiquidationIncentive sdk.Dec SymbolDenom string Exponent uint32 - EnableMsgLend bool - EnableMsgBorrow bool + EnableMsgSupply bool + EnableMsgBorrow bool Blacklist bool } ``` diff --git a/x/leverage/spec/03_queries.md b/x/leverage/spec/03_queries.md index 7a4dabd270..b8d9dc1b8c 100644 --- a/x/leverage/spec/03_queries.md +++ b/x/leverage/spec/03_queries.md @@ -9,21 +9,21 @@ General queries: Queries on accepted asset types: - **Borrow APY** queries for the [Borrow APY](01_concepts.md#Borrow-APY) of a specified denomination. -- **Lend APY** queries for the [Lending APY](01_concepts.md#Lending-APY) of a specified denomination. +- **Supply APY** queries for the [Supplying APY](01_concepts.md#Supplying-APY) of a specified denomination. - **Reserve Amount** queries for the amount reserved of a specified denomination. - **Total Collateral** queries for the total collateral amount of a specified uToken denomination. - **Exchange Rate** queries the [uToken Exchange Rate](01_concepts.md#uToken-Exchange-Rate) of a given uToken denomination. - **Market Size** queries the [Market Size](01_concepts.md#Market-Size) of a specified denomination. -- **Token Market Size** queries the [Market Size](01_concepts.md#Market-Size) of a specified denomination, but denominated in base tokens instead of USD. This amounts to _total loaned by all lenders + interest accrued._ +- **Token Market Size** queries the [Market Size](01_concepts.md#Market-Size) of a specified denomination, but denominated in base tokens instead of USD. This amounts to _total supplied by all suppliers + interest accrued._ - **Market Summary** combines several asset-specifying queries for more efficient frontend access. Queries on account addresses: -- **Borrowed** queries for the amount of a given token denomination borrowed by a user. If a denomination is not supplied, the total for each borrowed token is returned. -- **BorrowedValue** queries for the USD value of the amount of a given token denomination borrowed by a user. If a denomination is not supplied, the total across all of that user's borrowed tokens is returned. -- **Loaned** queries for the amount of a given token denomination loaned by a user. If a denomination is not supplied, the total sum of all of that user's loaned tokens is returned. -- **LoanedValue** queries for the USD value of the amount of a given token denomination loaned by a user. If a denomination is not supplied, the total across all of that user's loaned tokens is returned. +- **Borrowed** queries for the amount of a given token denomination borrowed by a user. If a denomination is not specified, the total for each borrowed token is returned. +- **BorrowedValue** queries for the USD value of the amount of a given token denomination borrowed by a user. If a denomination is not specified, the total across all of that user's borrowed tokens is returned. +- **Supplied** queries for the amount of a given token denomination supplied by a user. If a denomination is not specified, the total sum of all of that user's supplied tokens is returned. +- **SuppliedValue** queries for the USD value of the amount of a given token denomination supplied by a user. If a denomination is not specified, the total across all of that user's supplied tokens is returned. - **Collateral Setting** queries a borrower's collateral setting (enabled or disabled) of a specified uToken denomination. -- **Collateral** queries a user's collateral amount by token denomination. If a denomination is not supplied, the total for each collateral token is returned. -- **CollateralValue** queries a user's collateral value in USD by token denomination. If a denomination is not supplied, the sum over all collateral tokens is returned. +- **Collateral** queries a user's collateral amount by token denomination. If a denomination is not specified, the total for each collateral token is returned. +- **CollateralValue** queries a user's collateral value in USD by token denomination. If a denomination is not specified, the sum over all collateral tokens is returned. - **Borrow Limit** queries the [Borrow Limit](01_concepts.md#Borrow-Limit) in USD of a given user. - **Liquidation Limit** queries the [Borrow Limit](01_concepts.md#Liquidation-Limit) in USD of a given user. \ No newline at end of file diff --git a/x/leverage/spec/04_messages.md b/x/leverage/spec/04_messages.md index 34b6fe4c56..2a8a47709f 100644 --- a/x/leverage/spec/04_messages.md +++ b/x/leverage/spec/04_messages.md @@ -1,37 +1,37 @@ # Messages -## MsgLendAsset +## MsgSupply -A user lends assets the the module. +A user supplies assets the the module. ```protobuf -message MsgLendAsset { - string lender = 1; +message MsgSupply { + string supplier = 1; cosmos.base.v1beta1.Coin amount = 2; } ``` The message will fail under the following conditions: - `amount` is not a valid amount of an accepted asset -- `lender` balance is insufficient +- `supplier` balance is insufficient ## MsgWithdrawAsset -A user withdraws lent assets. +A user withdraws supplied assets. ```protobuf message MsgWithdrawAsset { - string lender = 1; + string supplier = 1; cosmos.base.v1beta1.Coin amount = 2; } ``` The message will fail under the following conditions: - `amount` is not a valid amount of an accepted asset's corresponding uToken -- The sum of `lender` uToken balance and uToken collateral (if enabled) is insufficient +- The sum of `supplier` uToken balance and uToken collateral (if enabled) is insufficient The following additional failures are only possible for collateral-enabled _uTokens_ -- Withdrawing the required uToken collateral would reduce `lender`'s `BorrowLimit` below their total borrowed value +- Withdrawing the required uToken collateral would reduce `supplier`'s `BorrowLimit` below their total borrowed value - Borrow value or borrow limit cannot be computed due to a missing `x/oracle` price ## MsgAddCollateral @@ -40,7 +40,7 @@ A user adds some uTokens from their balance to the module as collateral. ```protobuf message MsgAddCollateral { - string lender = 1; + string supplier = 1; cosmos.base.v1beta1.Coin amount = 2; } ``` @@ -54,7 +54,7 @@ A user moves some uTokens from their collateral back to their balance. ```protobuf message MsgRemoveCollateral { - string lender = 1; + string supplier = 1; cosmos.base.v1beta1.Coin amount = 2; } ``` diff --git a/x/leverage/spec/05_endblock.md b/x/leverage/spec/05_endblock.md index b385fa5745..4c2e534c11 100644 --- a/x/leverage/spec/05_endblock.md +++ b/x/leverage/spec/05_endblock.md @@ -15,7 +15,7 @@ Borrowers whose entire balance of collateral has been liquidated but still owe d ## Accrue Interest -At every epoch, the module recalculates [Borrow APY](01_concepts.md#Borrow-APY) and [Lending APY](01_concepts.md#Lending-APY) for each accepted asset type, storing them in state for easier query. +At every epoch, the module recalculates [Borrow APY](01_concepts.md#Borrow-APY) and [Supplying APY](01_concepts.md#Supplying-APY) for each accepted asset type, storing them in state for easier query. Borrow APY is then used to accrue interest on all open borrows. diff --git a/x/leverage/spec/06_events.md b/x/leverage/spec/06_events.md index 0d1d310279..f0e32c0a59 100644 --- a/x/leverage/spec/06_events.md +++ b/x/leverage/spec/06_events.md @@ -4,25 +4,25 @@ The leverage module emits the following events: ## Handlers -### MsgLendAsset +### MsgSupply | Type | Attribute Key | Attribute Value | | -------- | ------------- | ----------------------------------------------- | -| lend | sender | {lenderAddress} | -| lend | amount | {amount} | +| supply | sender | {supplierAddress} | +| supply | amount | {amount} | | message | module | leverage | -| message | action | /umeenetwork.umee.leverage.v1beta1.MsgLendAsset | -| message | sender | {lenderAddress} | +| message | action | /umeenetwork.umee.leverage.v1beta1.MsgSupply | +| message | sender | {supplierAddress} | ### MsgWithdrawAsset | Type | Attribute Key | Attribute Value | | -------- | ------------- | --------------------------------------------------- | -| withdraw | sender | {lenderAddress} | +| withdraw | sender | {supplierAddress} | | withdraw | amount | {amount} | | message | module | leverage | | message | action | /umeenetwork.umee.leverage.v1beta1.MsgWithdrawAsset | -| message | sender | {lenderAddress} | +| message | sender | {supplierAddress} | ### MsgSetCollateral diff --git a/x/leverage/spec/README.md b/x/leverage/spec/README.md index d6fac4e1d7..8b1b4bc356 100644 --- a/x/leverage/spec/README.md +++ b/x/leverage/spec/README.md @@ -4,7 +4,7 @@ This document specifies the `x/leverage` module of the Umee chain. -The leverage module allows users to lend and borrow assets, and implements various features to support this, such as a token accept-list, a dynamic interest rate module, incentivized liquidation of undercollateralized debt, and automatic reserve-based repayment of bad debt. +The leverage module allows users to supply and borrow assets, and implements various features to support this, such as a token accept-list, a dynamic interest rate module, incentivized liquidation of undercollateralized debt, and automatic reserve-based repayment of bad debt. The leverage module depends directly on `x/oracle` for asset prices, and interacts indirectly with `x/ibctransfer`, `x/peggy`, and the cosmos `x/bank` module as these all affect account balances. @@ -13,7 +13,7 @@ The leverage module depends directly on `x/oracle` for asset prices, and interac 1. **[Concepts](01_concepts.md)** - [Accepted Assets](01_concepts.md#Accepted-Assets) - [uTokens](01_concepts.md#uTokens) - - [Lending and Borrowing](01_concepts.md#Lending-and-Borrowing) + - [Supplying and Borrowing](01_concepts.md#Supplying-and-Borrowing) - [Reserves](01_concepts.md#Reserves) - [Liquidation](01_concepts.md#Liquidation) - Important Derived Values: @@ -23,13 +23,13 @@ The leverage module depends directly on `x/oracle` for asset prices, and interac - [Borrow Limit](01_concepts.md#Borrow-Limit) - [Liquidation Limit](01_concepts.md#Liquidation-Limit) - [Borrow APY](01_concepts.md#Borrow-APY) - - [Lending APY](01_concepts.md#Lending-APY) + - [Supplying APY](01_concepts.md#Supplying-APY) - [Close Factor](01_concepts.md#Close-Factor) - [Market Size](01_concepts.md#Market-Size) 2. **[State](02_state.md)** 3. **[Queries](03_queries.md)** 4. **[Messages](04_messages.md)** - - [MsgLendAsset](04_messages.md#MsgLendAsset) + - [MsgSupply](04_messages.md#MsgSupply) - [MsgWithdrawAsset](04_messages.md#MsgWithdrawAsset) - [MsgAddCollateral](04_messages.md#MsgAddCollateral) - [MsgRemoveCollateral](04_messages.md#MsgRemoveCollateral) diff --git a/x/leverage/types/codec.go b/x/leverage/types/codec.go index 326103ae39..3d1bc0930a 100644 --- a/x/leverage/types/codec.go +++ b/x/leverage/types/codec.go @@ -28,7 +28,7 @@ func init() { // concrete types on the provided LegacyAmino codec. These types are used for // Amino JSON serialization. func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - cdc.RegisterConcrete(&MsgLendAsset{}, "umee/leverage/MsgLendAsset", nil) + cdc.RegisterConcrete(&MsgSupply{}, "umee/leverage/MsgSupply", nil) cdc.RegisterConcrete(&MsgWithdrawAsset{}, "umee/leverage/MsgWithdrawAsset", nil) cdc.RegisterConcrete(&UpdateRegistryProposal{}, "umee/leverage/UpdateRegistryProposal", nil) cdc.RegisterConcrete(&MsgAddCollateral{}, "umee/leverage/MsgAddCollateral", nil) @@ -41,7 +41,7 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { registry.RegisterImplementations( (*sdk.Msg)(nil), - &MsgLendAsset{}, + &MsgSupply{}, &MsgWithdrawAsset{}, &MsgAddCollateral{}, &MsgRemoveCollateral{}, diff --git a/x/leverage/types/errors.go b/x/leverage/types/errors.go index 9e7adfa35b..f7929df3b2 100644 --- a/x/leverage/types/errors.go +++ b/x/leverage/types/errors.go @@ -26,7 +26,7 @@ var ( ErrInvalidInteresrScalar = sdkerrors.Register(ModuleName, 1116, "interest scalar less than one") ErrEmptyAddress = sdkerrors.Register(ModuleName, 1117, "empty address") ErrLiquidationRewardRatio = sdkerrors.Register(ModuleName, 1118, "requested liquidation reward not met") - ErrLendNotAllowed = sdkerrors.Register(ModuleName, 1119, "lending of asset disabled") + ErrSupplyNotAllowed = sdkerrors.Register(ModuleName, 1119, "supplying of asset disabled") ErrBorrowNotAllowed = sdkerrors.Register(ModuleName, 1120, "borrowing of asset disabled") ErrBlacklisted = sdkerrors.Register(ModuleName, 1121, "base denom blacklisted") ErrCollateralWeightZero = sdkerrors.Register(ModuleName, 1122, "token collateral weight is zero") diff --git a/x/leverage/types/events.go b/x/leverage/types/events.go index b16d5ad7c5..4c44d054a0 100644 --- a/x/leverage/types/events.go +++ b/x/leverage/types/events.go @@ -2,20 +2,20 @@ package types // Event types and attributes for the leverage module const ( - EventTypeLoanAsset = "loan_asset" - EventTypeWithdrawLoanedAsset = "withdraw_loaned_asset" - EventTypeAddCollateral = "add_collateral" - EventTypeRemoveCollateral = "remove_collateral" - EventTypeBorrowAsset = "borrow_asset" - EventTypeRepayBorrowedAsset = "repay_borrowed_asset" - EventTypeLiquidate = "liquidate_borrow_position" - EventTypeRepayBadDebt = "repay_bad_debt" - EventTypeReservesExhausted = "reserves_exhausted" - EventTypeInterestAccrual = "interest_accrual" - EventTypeFundOracle = "fund_oracle" + EventTypeLoanAsset = "loan_asset" + EventTypeWithdrawAsset = "withdraw_asset" + EventTypeAddCollateral = "add_collateral" + EventTypeRemoveCollateral = "remove_collateral" + EventTypeBorrowAsset = "borrow_asset" + EventTypeRepayBorrowedAsset = "repay_borrowed_asset" + EventTypeLiquidate = "liquidate_borrow_position" + EventTypeRepayBadDebt = "repay_bad_debt" + EventTypeReservesExhausted = "reserves_exhausted" + EventTypeInterestAccrual = "interest_accrual" + EventTypeFundOracle = "fund_oracle" EventAttrModule = ModuleName - EventAttrLender = "lender" + EventAttrSupplier = "supplier" EventAttrBorrower = "borrower" EventAttrLiquidator = "liquidator" EventAttrDenom = "denom" diff --git a/x/leverage/types/keys.go b/x/leverage/types/keys.go index defcd61564..34a252395e 100644 --- a/x/leverage/types/keys.go +++ b/x/leverage/types/keys.go @@ -61,20 +61,20 @@ func CreateAdjustedBorrowKeyNoDenom(borrowerAddr sdk.AccAddress) []byte { } // CreateCollateralAmountKey returns a KVStore key for getting and setting the amount of -// collateral stored for a lender in a given denom. -func CreateCollateralAmountKey(lenderAddr sdk.AccAddress, uTokenDenom string) []byte { - // collateralPrefix | lengthprefixed(lenderAddr) | denom | 0x00 - key := CreateCollateralAmountKeyNoDenom(lenderAddr) +// collateral stored for a user in a given denom. +func CreateCollateralAmountKey(addr sdk.AccAddress, uTokenDenom string) []byte { + // collateralPrefix | lengthprefixed(addr) | denom | 0x00 + key := CreateCollateralAmountKeyNoDenom(addr) key = append(key, []byte(uTokenDenom)...) return append(key, 0) // append 0 for null-termination } // CreateCollateralAmountKeyNoDenom returns the common prefix used by all collateral associated -// with a given lender address. -func CreateCollateralAmountKeyNoDenom(lenderAddr sdk.AccAddress) []byte { - // collateralPrefix | lengthprefixed(lenderAddr) +// with a given address. +func CreateCollateralAmountKeyNoDenom(addr sdk.AccAddress) []byte { + // collateralPrefix | lengthprefixed(addr) key := CreateCollateralAmountKeyNoAddress() - key = append(key, address.MustLengthPrefix(lenderAddr)...) + key = append(key, address.MustLengthPrefix(addr)...) return key } diff --git a/x/leverage/types/leverage.pb.go b/x/leverage/types/leverage.pb.go index f170accdd4..f402b52130 100644 --- a/x/leverage/types/leverage.pb.go +++ b/x/leverage/types/leverage.pb.go @@ -76,7 +76,7 @@ func (m *Params) XXX_DiscardUnknown() { var xxx_messageInfo_Params proto.InternalMessageInfo // Token defines a token, along with its capital metadata, in the Umee capital -// facility that can be loaned and borrowed. +// facility that can be supplied and borrowed. type Token struct { // The base_denom defines the denomination of the underlying base token. BaseDenom string `protobuf:"bytes,1,opt,name=base_denom,json=baseDenom,proto3" json:"base_denom,omitempty" yaml:"base_denom"` @@ -110,10 +110,10 @@ type Token struct { // list of allowed tokens. SymbolDenom string `protobuf:"bytes,10,opt,name=symbol_denom,json=symbolDenom,proto3" json:"symbol_denom,omitempty" yaml:"symbol_denom"` Exponent uint32 `protobuf:"varint,11,opt,name=exponent,proto3" json:"exponent,omitempty" yaml:"exponent"` - // Allows lending and setting a collateral using this token. Note that - // withdrawing is always enabled. Disabling lending would be one step in + // Allows supplying for lending or collateral using this token. Note that + // withdrawing is always enabled. Disabling supplying would be one step in // phasing out an asset type. - EnableMsgLend bool `protobuf:"varint,12,opt,name=enable_msg_lend,json=enableMsgLend,proto3" json:"enable_msg_lend,omitempty" yaml:"enable_msg_lend"` + EnableMsgSupply bool `protobuf:"varint,12,opt,name=enable_msg_supply,json=enableMsgSupply,proto3" json:"enable_msg_supply,omitempty" yaml:"enable_msg_supply"` // Allows borrowing of this token. Note that repaying is always enabled. // Disabling borrowing would be one step in phasing out an asset type, but // could also be used from the start for asset types meant to be collateral @@ -122,8 +122,8 @@ type Token struct { // This should only be used to eliminate an asset completely. A blacklisted // asset is treated as though its oracle price is zero, and thus ignored by // calculations such as collateral value and borrow limit. Can still be repaid - // or withdrawn, but not liquidated. A blacklisted token must have enable_lend - // and enable_borrow set to false. Such tokens can be safely removed from the + // or withdrawn, but not liquidated. A blacklisted token must have enable_msg_supply + // and enable_msg_borrow set to false. Such tokens can be safely removed from the // oracle and price feeder as well. Blacklist bool `protobuf:"varint,14,opt,name=blacklist,proto3" json:"blacklist,omitempty"` } @@ -182,9 +182,9 @@ func (m *Token) GetExponent() uint32 { return 0 } -func (m *Token) GetEnableMsgLend() bool { +func (m *Token) GetEnableMsgSupply() bool { if m != nil { - return m.EnableMsgLend + return m.EnableMsgSupply } return false } @@ -211,55 +211,55 @@ func init() { func init() { proto.RegisterFile("umee/leverage/v1/leverage.proto", fileDescriptor_8cb1bf9ea641ecc6) } var fileDescriptor_8cb1bf9ea641ecc6 = []byte{ - // 766 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x4d, 0x4f, 0xeb, 0x46, - 0x14, 0x8d, 0xdb, 0x40, 0xc9, 0x40, 0x12, 0x30, 0x01, 0x2c, 0x9a, 0xc6, 0x68, 0xa4, 0x56, 0x6c, - 0x88, 0x4b, 0xdb, 0x55, 0x96, 0x29, 0x6a, 0x01, 0x41, 0x5b, 0x4d, 0xa9, 0x90, 0xba, 0xb1, 0x26, - 0xce, 0x6d, 0x62, 0x65, 0xec, 0x49, 0x3d, 0x93, 0x0f, 0xd8, 0x74, 0x51, 0x75, 0xdf, 0x65, 0x37, - 0x95,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 0x2c, 0x46, 0xff, 0x9b, 0x44, 0x30, 0x99, 0x26, 0xe9, 0x75, 0x54, - 0x04, 0x9f, 0x36, 0x18, 0xd8, 0x9e, 0x68, 0xd9, 0x0c, 0xfc, 0xa6, 0xb1, 0xb6, 0xa7, 0xed, 0xaf, - 0xd4, 0x77, 0x93, 0x62, 0x3d, 0x4a, 0xc0, 0x24, 0x1f, 0x21, 0xe7, 0xa2, 0x75, 0x06, 0x7e, 0x53, - 0x3f, 0x46, 0x1b, 0xa9, 0x94, 0xa8, 0xac, 0x46, 0x5e, 0xb1, 0x94, 0x93, 0xc9, 0x7e, 0x92, 0x82, - 0x49, 0x71, 0xca, 0x13, 0x95, 0x5e, 0x2f, 0xa3, 0x5c, 0x83, 0x51, 0xa7, 0xc3, 0x5c, 0x21, 0x8d, - 0x42, 0xc8, 0x40, 0x12, 0xa0, 0x96, 0x7d, 0x7b, 0x63, 0x6a, 0xf5, 0xd3, 0xdb, 0xfb, 0x8a, 0x76, - 0x77, 0x5f, 0xd1, 0xde, 0xdc, 0x57, 0xb4, 0xbf, 0x1f, 0x2a, 0x99, 0xbb, 0x87, 0x4a, 0xe6, 0xd5, - 0x43, 0x25, 0xf3, 0xeb, 0x97, 0xa9, 0xb2, 0x84, 0xaf, 0xf5, 0x81, 0x0f, 0x72, 0xc0, 0x83, 0x8e, - 0x5a, 0x58, 0xfd, 0xaf, 0xac, 0x61, 0xf2, 0xc0, 0xab, 0x22, 0x35, 0x96, 0xd5, 0x9b, 0xfd, 0xf5, - 0xbb, 0x00, 0x00, 0x00, 0xff, 0xff, 0x42, 0xff, 0x70, 0x19, 0xfe, 0x07, 0x00, 0x00, + // 759 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xbf, 0x4f, 0x1b, 0x49, + 0x14, 0xf6, 0xde, 0x19, 0x0e, 0x0f, 0xd8, 0x86, 0xc5, 0xc0, 0xea, 0xce, 0xe7, 0x45, 0x23, 0xdd, + 0x89, 0x06, 0xef, 0x71, 0x49, 0xe5, 0xd2, 0x41, 0x09, 0xa0, 0x90, 0x44, 0x03, 0x11, 0x52, 0x9a, + 0xd5, 0x78, 0x3d, 0xb1, 0x57, 0x9e, 0xdd, 0x71, 0x76, 0xc6, 0xbf, 0x68, 0x52, 0x44, 0xe9, 0x53, + 0xa6, 0x89, 0x44, 0x9b, 0xff, 0x20, 0x7f, 0x02, 0x25, 0x65, 0x94, 0xc2, 0x8a, 0xa0, 0x49, 0xed, + 0xbf, 0x20, 0xda, 0x99, 0xb5, 0xbd, 0x06, 0x07, 0xc9, 0x82, 0xca, 0x3b, 0xdf, 0x7b, 0xfe, 0xbe, + 0x6f, 0xe6, 0xbd, 0x37, 0x03, 0xcc, 0x96, 0x47, 0x88, 0x45, 0x49, 0x9b, 0x04, 0xb8, 0x46, 0xac, + 0xf6, 0xce, 0xe8, 0xbb, 0xd8, 0x0c, 0x98, 0x60, 0xfa, 0x72, 0x98, 0x50, 0x1c, 0x81, 0xed, 0x9d, + 0x3f, 0x73, 0x35, 0x56, 0x63, 0x32, 0x68, 0x85, 0x5f, 0x2a, 0x0f, 0x7e, 0x49, 0x82, 0xf9, 0x17, + 0x38, 0xc0, 0x1e, 0xd7, 0x3f, 0x69, 0xa0, 0xe0, 0x30, 0xaf, 0x49, 0x89, 0x20, 0x36, 0x75, 0xdf, + 0xb4, 0xdc, 0x2a, 0x16, 0x2e, 0xf3, 0x6d, 0x51, 0x0f, 0x08, 0xaf, 0x33, 0x5a, 0x35, 0x7e, 0xdb, + 0xd4, 0xb6, 0x52, 0xe5, 0x93, 0xf3, 0xbe, 0x99, 0xf8, 0xd6, 0x37, 0xff, 0xad, 0xb9, 0xa2, 0xde, + 0xaa, 0x14, 0x1d, 0xe6, 0x59, 0x0e, 0xe3, 0x1e, 0xe3, 0xd1, 0xcf, 0x36, 0xaf, 0x36, 0x2c, 0xd1, + 0x6b, 0x12, 0x5e, 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, 0xc6, 0x1f, 0x48, 0xed, 0x8d, 0x41, 0xdf, 0x5c, 0x8d, 0xee, 0x96, 0x58, 0x14, 0xa2, 0x45, + 0xb5, 0x54, 0x57, 0x80, 0x05, 0x16, 0x48, 0xb7, 0xc9, 0x7c, 0xe2, 0x0b, 0x63, 0x71, 0x53, 0xdb, + 0x4a, 0x97, 0x57, 0x07, 0x7d, 0x33, 0xab, 0xfe, 0x37, 0x8c, 0x40, 0x34, 0x4a, 0xd2, 0xf7, 0xc0, + 0x0a, 0xf1, 0x71, 0x85, 0x12, 0xdb, 0xe3, 0x35, 0x9b, 0xb7, 0x9a, 0x4d, 0xda, 0x33, 0x96, 0x36, + 0xb5, 0xad, 0x85, 0x72, 0x7e, 0x3c, 0x95, 0x37, 0x52, 0x20, 0xca, 0x2a, 0xec, 0x90, 0xd7, 0x8e, + 0x24, 0x72, 0x8d, 0x49, 0x15, 0xd7, 0x48, 0xdf, 0xc2, 0xa4, 0x52, 0xe2, 0x4c, 0xaa, 0x01, 0xf4, + 0x3c, 0x48, 0x55, 0x28, 0x76, 0x1a, 0xd4, 0xe5, 0xc2, 0xc8, 0x84, 0x0c, 0x68, 0x0c, 0x94, 0x92, + 0x3f, 0xce, 0x4c, 0xad, 0x7c, 0x70, 0x7e, 0x59, 0xd0, 0x2e, 0x2e, 0x0b, 0xda, 0xf7, 0xcb, 0x82, + 0xf6, 0xe1, 0xaa, 0x90, 0xb8, 0xb8, 0x2a, 0x24, 0xbe, 0x5e, 0x15, 0x12, 0xaf, 0xfe, 0x8b, 0x15, + 0x27, 0x7c, 0xb3, 0xb7, 0x7d, 0x22, 0x3a, 0x2c, 0x68, 0xc8, 0x85, 0xd5, 0xfe, 0xdf, 0xea, 0x8e, + 0x9f, 0x79, 0x59, 0xaa, 0xca, 0xbc, 0x7c, 0xb9, 0x1f, 0xfc, 0x0c, 0x00, 0x00, 0xff, 0xff, 0x0d, + 0xd9, 0xde, 0x5f, 0x04, 0x08, 0x00, 0x00, } func (this *Token) Equal(that interface{}) bool { @@ -314,7 +314,7 @@ func (this *Token) Equal(that interface{}) bool { if this.Exponent != that1.Exponent { return false } - if this.EnableMsgLend != that1.EnableMsgLend { + if this.EnableMsgSupply != that1.EnableMsgSupply { return false } if this.EnableMsgBorrow != that1.EnableMsgBorrow { @@ -428,9 +428,9 @@ func (m *Token) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x68 } - if m.EnableMsgLend { + if m.EnableMsgSupply { i-- - if m.EnableMsgLend { + if m.EnableMsgSupply { dAtA[i] = 1 } else { dAtA[i] = 0 @@ -601,7 +601,7 @@ func (m *Token) Size() (n int) { if m.Exponent != 0 { n += 1 + sovLeverage(uint64(m.Exponent)) } - if m.EnableMsgLend { + if m.EnableMsgSupply { n += 2 } if m.EnableMsgBorrow { @@ -1191,7 +1191,7 @@ func (m *Token) Unmarshal(dAtA []byte) error { } case 12: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field EnableMsgLend", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field EnableMsgSupply", wireType) } var v int for shift := uint(0); ; shift += 7 { @@ -1208,7 +1208,7 @@ func (m *Token) Unmarshal(dAtA []byte) error { break } } - m.EnableMsgLend = bool(v != 0) + m.EnableMsgSupply = bool(v != 0) case 13: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field EnableMsgBorrow", wireType) diff --git a/x/leverage/types/query.pb.go b/x/leverage/types/query.pb.go index d8827b6411..7febbebd6c 100644 --- a/x/leverage/types/query.pb.go +++ b/x/leverage/types/query.pb.go @@ -239,24 +239,24 @@ func (m *QueryBorrowAPYResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryBorrowAPYResponse proto.InternalMessageInfo -// QueryLendAPYRequest defines the request structure for the LendAPY +// QuerySupplyAPYRequest defines the request structure for the SupplyAPY // gRPC service handler. -type QueryLendAPYRequest struct { +type QuerySupplyAPYRequest struct { Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` } -func (m *QueryLendAPYRequest) Reset() { *m = QueryLendAPYRequest{} } -func (m *QueryLendAPYRequest) String() string { return proto.CompactTextString(m) } -func (*QueryLendAPYRequest) ProtoMessage() {} -func (*QueryLendAPYRequest) Descriptor() ([]byte, []int) { +func (m *QuerySupplyAPYRequest) Reset() { *m = QuerySupplyAPYRequest{} } +func (m *QuerySupplyAPYRequest) String() string { return proto.CompactTextString(m) } +func (*QuerySupplyAPYRequest) ProtoMessage() {} +func (*QuerySupplyAPYRequest) Descriptor() ([]byte, []int) { return fileDescriptor_1e8137dcabb0ccc7, []int{5} } -func (m *QueryLendAPYRequest) XXX_Unmarshal(b []byte) error { +func (m *QuerySupplyAPYRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryLendAPYRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QuerySupplyAPYRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryLendAPYRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QuerySupplyAPYRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -266,43 +266,43 @@ func (m *QueryLendAPYRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } -func (m *QueryLendAPYRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryLendAPYRequest.Merge(m, src) +func (m *QuerySupplyAPYRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySupplyAPYRequest.Merge(m, src) } -func (m *QueryLendAPYRequest) XXX_Size() int { +func (m *QuerySupplyAPYRequest) XXX_Size() int { return m.Size() } -func (m *QueryLendAPYRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryLendAPYRequest.DiscardUnknown(m) +func (m *QuerySupplyAPYRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySupplyAPYRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryLendAPYRequest proto.InternalMessageInfo +var xxx_messageInfo_QuerySupplyAPYRequest proto.InternalMessageInfo -func (m *QueryLendAPYRequest) GetDenom() string { +func (m *QuerySupplyAPYRequest) GetDenom() string { if m != nil { return m.Denom } return "" } -// QueryLendAPYResponse defines the response structure for the LendAPY +// QuerySupplyAPYResponse defines the response structure for the SupplyAPY // gRPC service handler. -type QueryLendAPYResponse struct { +type QuerySupplyAPYResponse struct { APY github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=APY,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"APY"` } -func (m *QueryLendAPYResponse) Reset() { *m = QueryLendAPYResponse{} } -func (m *QueryLendAPYResponse) String() string { return proto.CompactTextString(m) } -func (*QueryLendAPYResponse) ProtoMessage() {} -func (*QueryLendAPYResponse) Descriptor() ([]byte, []int) { +func (m *QuerySupplyAPYResponse) Reset() { *m = QuerySupplyAPYResponse{} } +func (m *QuerySupplyAPYResponse) String() string { return proto.CompactTextString(m) } +func (*QuerySupplyAPYResponse) ProtoMessage() {} +func (*QuerySupplyAPYResponse) Descriptor() ([]byte, []int) { return fileDescriptor_1e8137dcabb0ccc7, []int{6} } -func (m *QueryLendAPYResponse) XXX_Unmarshal(b []byte) error { +func (m *QuerySupplyAPYResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryLendAPYResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QuerySupplyAPYResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryLendAPYResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QuerySupplyAPYResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -312,17 +312,17 @@ func (m *QueryLendAPYResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte return b[:n], nil } } -func (m *QueryLendAPYResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryLendAPYResponse.Merge(m, src) +func (m *QuerySupplyAPYResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySupplyAPYResponse.Merge(m, src) } -func (m *QueryLendAPYResponse) XXX_Size() int { +func (m *QuerySupplyAPYResponse) XXX_Size() int { return m.Size() } -func (m *QueryLendAPYResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryLendAPYResponse.DiscardUnknown(m) +func (m *QuerySupplyAPYResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySupplyAPYResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryLendAPYResponse proto.InternalMessageInfo +var xxx_messageInfo_QuerySupplyAPYResponse proto.InternalMessageInfo // QueryMarketSizeRequest defines the request structure for the Market Size in // USD gRPC service handler. @@ -910,25 +910,25 @@ func (m *QueryCollateralValueResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryCollateralValueResponse proto.InternalMessageInfo -// QueryLoanedRequest defines the request structure for the Loaned gRPC service +// QuerySuppliedRequest defines the request structure for the Supplied gRPC service // handler. -type QueryLoanedRequest struct { +type QuerySuppliedRequest struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` Denom string `protobuf:"bytes,2,opt,name=denom,proto3" json:"denom,omitempty"` } -func (m *QueryLoanedRequest) Reset() { *m = QueryLoanedRequest{} } -func (m *QueryLoanedRequest) String() string { return proto.CompactTextString(m) } -func (*QueryLoanedRequest) ProtoMessage() {} -func (*QueryLoanedRequest) Descriptor() ([]byte, []int) { +func (m *QuerySuppliedRequest) Reset() { *m = QuerySuppliedRequest{} } +func (m *QuerySuppliedRequest) String() string { return proto.CompactTextString(m) } +func (*QuerySuppliedRequest) ProtoMessage() {} +func (*QuerySuppliedRequest) Descriptor() ([]byte, []int) { return fileDescriptor_1e8137dcabb0ccc7, []int{20} } -func (m *QueryLoanedRequest) XXX_Unmarshal(b []byte) error { +func (m *QuerySuppliedRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryLoanedRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QuerySuppliedRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryLoanedRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QuerySuppliedRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -938,50 +938,50 @@ func (m *QueryLoanedRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } -func (m *QueryLoanedRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryLoanedRequest.Merge(m, src) +func (m *QuerySuppliedRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySuppliedRequest.Merge(m, src) } -func (m *QueryLoanedRequest) XXX_Size() int { +func (m *QuerySuppliedRequest) XXX_Size() int { return m.Size() } -func (m *QueryLoanedRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryLoanedRequest.DiscardUnknown(m) +func (m *QuerySuppliedRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySuppliedRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryLoanedRequest proto.InternalMessageInfo +var xxx_messageInfo_QuerySuppliedRequest proto.InternalMessageInfo -func (m *QueryLoanedRequest) GetAddress() string { +func (m *QuerySuppliedRequest) GetAddress() string { if m != nil { return m.Address } return "" } -func (m *QueryLoanedRequest) GetDenom() string { +func (m *QuerySuppliedRequest) GetDenom() string { if m != nil { return m.Denom } return "" } -// QueryLoanedResponse defines the response structure for the Loaned gRPC +// QuerySuppliedResponse defines the response structure for the Supplied gRPC // service handler. -type QueryLoanedResponse struct { - Loaned github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=loaned,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"loaned"` +type QuerySuppliedResponse struct { + Supplied github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=supplied,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"supplied"` } -func (m *QueryLoanedResponse) Reset() { *m = QueryLoanedResponse{} } -func (m *QueryLoanedResponse) String() string { return proto.CompactTextString(m) } -func (*QueryLoanedResponse) ProtoMessage() {} -func (*QueryLoanedResponse) Descriptor() ([]byte, []int) { +func (m *QuerySuppliedResponse) Reset() { *m = QuerySuppliedResponse{} } +func (m *QuerySuppliedResponse) String() string { return proto.CompactTextString(m) } +func (*QuerySuppliedResponse) ProtoMessage() {} +func (*QuerySuppliedResponse) Descriptor() ([]byte, []int) { return fileDescriptor_1e8137dcabb0ccc7, []int{21} } -func (m *QueryLoanedResponse) XXX_Unmarshal(b []byte) error { +func (m *QuerySuppliedResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryLoanedResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QuerySuppliedResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryLoanedResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QuerySuppliedResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -991,44 +991,44 @@ func (m *QueryLoanedResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } -func (m *QueryLoanedResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryLoanedResponse.Merge(m, src) +func (m *QuerySuppliedResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySuppliedResponse.Merge(m, src) } -func (m *QueryLoanedResponse) XXX_Size() int { +func (m *QuerySuppliedResponse) XXX_Size() int { return m.Size() } -func (m *QueryLoanedResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryLoanedResponse.DiscardUnknown(m) +func (m *QuerySuppliedResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySuppliedResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryLoanedResponse proto.InternalMessageInfo +var xxx_messageInfo_QuerySuppliedResponse proto.InternalMessageInfo -func (m *QueryLoanedResponse) GetLoaned() github_com_cosmos_cosmos_sdk_types.Coins { +func (m *QuerySuppliedResponse) GetSupplied() github_com_cosmos_cosmos_sdk_types.Coins { if m != nil { - return m.Loaned + return m.Supplied } return nil } -// QueryLoanedValueRequest defines the request structure for the LoanedValue +// QuerySuppliedValueRequest defines the request structure for the SuppliedValue // gRPC service handler. -type QueryLoanedValueRequest struct { +type QuerySuppliedValueRequest struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` Denom string `protobuf:"bytes,2,opt,name=denom,proto3" json:"denom,omitempty"` } -func (m *QueryLoanedValueRequest) Reset() { *m = QueryLoanedValueRequest{} } -func (m *QueryLoanedValueRequest) String() string { return proto.CompactTextString(m) } -func (*QueryLoanedValueRequest) ProtoMessage() {} -func (*QueryLoanedValueRequest) Descriptor() ([]byte, []int) { +func (m *QuerySuppliedValueRequest) Reset() { *m = QuerySuppliedValueRequest{} } +func (m *QuerySuppliedValueRequest) String() string { return proto.CompactTextString(m) } +func (*QuerySuppliedValueRequest) ProtoMessage() {} +func (*QuerySuppliedValueRequest) Descriptor() ([]byte, []int) { return fileDescriptor_1e8137dcabb0ccc7, []int{22} } -func (m *QueryLoanedValueRequest) XXX_Unmarshal(b []byte) error { +func (m *QuerySuppliedValueRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryLoanedValueRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QuerySuppliedValueRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryLoanedValueRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QuerySuppliedValueRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1038,50 +1038,50 @@ func (m *QueryLoanedValueRequest) XXX_Marshal(b []byte, deterministic bool) ([]b return b[:n], nil } } -func (m *QueryLoanedValueRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryLoanedValueRequest.Merge(m, src) +func (m *QuerySuppliedValueRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySuppliedValueRequest.Merge(m, src) } -func (m *QueryLoanedValueRequest) XXX_Size() int { +func (m *QuerySuppliedValueRequest) XXX_Size() int { return m.Size() } -func (m *QueryLoanedValueRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryLoanedValueRequest.DiscardUnknown(m) +func (m *QuerySuppliedValueRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySuppliedValueRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryLoanedValueRequest proto.InternalMessageInfo +var xxx_messageInfo_QuerySuppliedValueRequest proto.InternalMessageInfo -func (m *QueryLoanedValueRequest) GetAddress() string { +func (m *QuerySuppliedValueRequest) GetAddress() string { if m != nil { return m.Address } return "" } -func (m *QueryLoanedValueRequest) GetDenom() string { +func (m *QuerySuppliedValueRequest) GetDenom() string { if m != nil { return m.Denom } return "" } -// QueryLoanedValueResponse defines the response structure for the LoanedValue +// QuerySuppliedValueResponse defines the response structure for the SuppliedValue // gRPC service handler. -type QueryLoanedValueResponse struct { - LoanedValue github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=loaned_value,json=loanedValue,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"loaned_value"` +type QuerySuppliedValueResponse struct { + SuppliedValue github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=supplied_value,json=suppliedValue,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"supplied_value"` } -func (m *QueryLoanedValueResponse) Reset() { *m = QueryLoanedValueResponse{} } -func (m *QueryLoanedValueResponse) String() string { return proto.CompactTextString(m) } -func (*QueryLoanedValueResponse) ProtoMessage() {} -func (*QueryLoanedValueResponse) Descriptor() ([]byte, []int) { +func (m *QuerySuppliedValueResponse) Reset() { *m = QuerySuppliedValueResponse{} } +func (m *QuerySuppliedValueResponse) String() string { return proto.CompactTextString(m) } +func (*QuerySuppliedValueResponse) ProtoMessage() {} +func (*QuerySuppliedValueResponse) Descriptor() ([]byte, []int) { return fileDescriptor_1e8137dcabb0ccc7, []int{23} } -func (m *QueryLoanedValueResponse) XXX_Unmarshal(b []byte) error { +func (m *QuerySuppliedValueResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryLoanedValueResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QuerySuppliedValueResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryLoanedValueResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QuerySuppliedValueResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1091,17 +1091,17 @@ func (m *QueryLoanedValueResponse) XXX_Marshal(b []byte, deterministic bool) ([] return b[:n], nil } } -func (m *QueryLoanedValueResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryLoanedValueResponse.Merge(m, src) +func (m *QuerySuppliedValueResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySuppliedValueResponse.Merge(m, src) } -func (m *QueryLoanedValueResponse) XXX_Size() int { +func (m *QuerySuppliedValueResponse) XXX_Size() int { return m.Size() } -func (m *QueryLoanedValueResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryLoanedValueResponse.DiscardUnknown(m) +func (m *QuerySuppliedValueResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySuppliedValueResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryLoanedValueResponse proto.InternalMessageInfo +var xxx_messageInfo_QuerySuppliedValueResponse proto.InternalMessageInfo // QueryReserveAmountRequest defines the request structure for the ReserveAmount // gRPC service handler. @@ -1680,7 +1680,7 @@ type QueryMarketSummaryResponse struct { Exponent uint32 `protobuf:"varint,2,opt,name=exponent,proto3" json:"exponent,omitempty"` OraclePrice *github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=oracle_price,json=oraclePrice,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"oracle_price,omitempty"` UTokenExchangeRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=uToken_exchange_rate,json=uTokenExchangeRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"uToken_exchange_rate"` - Lend_APY github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=lend_APY,json=lendAPY,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"lend_APY"` + Supply_APY github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=supply_APY,json=supplyAPY,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"supply_APY"` Borrow_APY github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,opt,name=borrow_APY,json=borrowAPY,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"borrow_APY"` MarketSize github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,7,opt,name=market_size,json=marketSize,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"market_size"` AvailableBorrow github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,8,opt,name=available_borrow,json=availableBorrow,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"available_borrow"` @@ -1826,8 +1826,8 @@ func init() { proto.RegisterType((*QueryAvailableBorrowResponse)(nil), "umee.leverage.v1.QueryAvailableBorrowResponse") proto.RegisterType((*QueryBorrowAPYRequest)(nil), "umee.leverage.v1.QueryBorrowAPYRequest") proto.RegisterType((*QueryBorrowAPYResponse)(nil), "umee.leverage.v1.QueryBorrowAPYResponse") - proto.RegisterType((*QueryLendAPYRequest)(nil), "umee.leverage.v1.QueryLendAPYRequest") - proto.RegisterType((*QueryLendAPYResponse)(nil), "umee.leverage.v1.QueryLendAPYResponse") + proto.RegisterType((*QuerySupplyAPYRequest)(nil), "umee.leverage.v1.QuerySupplyAPYRequest") + proto.RegisterType((*QuerySupplyAPYResponse)(nil), "umee.leverage.v1.QuerySupplyAPYResponse") proto.RegisterType((*QueryMarketSizeRequest)(nil), "umee.leverage.v1.QueryMarketSizeRequest") proto.RegisterType((*QueryMarketSizeResponse)(nil), "umee.leverage.v1.QueryMarketSizeResponse") proto.RegisterType((*QueryTokenMarketSizeRequest)(nil), "umee.leverage.v1.QueryTokenMarketSizeRequest") @@ -1841,10 +1841,10 @@ func init() { proto.RegisterType((*QueryBorrowedValueResponse)(nil), "umee.leverage.v1.QueryBorrowedValueResponse") proto.RegisterType((*QueryCollateralValueRequest)(nil), "umee.leverage.v1.QueryCollateralValueRequest") proto.RegisterType((*QueryCollateralValueResponse)(nil), "umee.leverage.v1.QueryCollateralValueResponse") - proto.RegisterType((*QueryLoanedRequest)(nil), "umee.leverage.v1.QueryLoanedRequest") - proto.RegisterType((*QueryLoanedResponse)(nil), "umee.leverage.v1.QueryLoanedResponse") - proto.RegisterType((*QueryLoanedValueRequest)(nil), "umee.leverage.v1.QueryLoanedValueRequest") - proto.RegisterType((*QueryLoanedValueResponse)(nil), "umee.leverage.v1.QueryLoanedValueResponse") + proto.RegisterType((*QuerySuppliedRequest)(nil), "umee.leverage.v1.QuerySuppliedRequest") + proto.RegisterType((*QuerySuppliedResponse)(nil), "umee.leverage.v1.QuerySuppliedResponse") + proto.RegisterType((*QuerySuppliedValueRequest)(nil), "umee.leverage.v1.QuerySuppliedValueRequest") + proto.RegisterType((*QuerySuppliedValueResponse)(nil), "umee.leverage.v1.QuerySuppliedValueResponse") proto.RegisterType((*QueryReserveAmountRequest)(nil), "umee.leverage.v1.QueryReserveAmountRequest") proto.RegisterType((*QueryReserveAmountResponse)(nil), "umee.leverage.v1.QueryReserveAmountResponse") proto.RegisterType((*QueryCollateralRequest)(nil), "umee.leverage.v1.QueryCollateralRequest") @@ -1866,111 +1866,110 @@ func init() { func init() { proto.RegisterFile("umee/leverage/v1/query.proto", fileDescriptor_1e8137dcabb0ccc7) } var fileDescriptor_1e8137dcabb0ccc7 = []byte{ - // 1654 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x59, 0x4b, 0x6f, 0x14, 0xc7, - 0x16, 0x76, 0x03, 0x7e, 0x1d, 0xdb, 0xd7, 0xa8, 0xae, 0xb9, 0x1e, 0xfa, 0x9a, 0xb1, 0xe9, 0x8b, - 0x1f, 0xe0, 0xeb, 0x69, 0x3f, 0xa4, 0x48, 0x51, 0xb2, 0x88, 0x0d, 0x41, 0x81, 0xe0, 0xc4, 0x0c, - 0x0f, 0x05, 0x36, 0x9d, 0x9e, 0x99, 0xca, 0xb8, 0xe5, 0x9e, 0xee, 0x71, 0x77, 0x8f, 0xc1, 0x28, - 0x52, 0x1e, 0x8a, 0x12, 0x16, 0x59, 0x20, 0x25, 0x9b, 0x48, 0x64, 0x1f, 0x65, 0x95, 0x9f, 0xc1, - 0x12, 0x29, 0x9b, 0x28, 0x0b, 0x12, 0x41, 0x7e, 0x41, 0x7e, 0x41, 0xd4, 0x55, 0xa7, 0x5f, 0xd3, - 0x5d, 0x3d, 0x43, 0x1b, 0x56, 0x78, 0xaa, 0xcf, 0xe3, 0xab, 0xaa, 0x73, 0xbe, 0x73, 0x4e, 0x01, - 0x33, 0x9d, 0x16, 0xa5, 0xaa, 0x49, 0x0f, 0xa8, 0xa3, 0x37, 0xa9, 0x7a, 0xb0, 0xa6, 0xee, 0x77, - 0xa8, 0x73, 0x58, 0x69, 0x3b, 0xb6, 0x67, 0x93, 0x93, 0xfe, 0xd7, 0x4a, 0xf0, 0xb5, 0x72, 0xb0, - 0x26, 0xcf, 0x34, 0x6d, 0xbb, 0x69, 0x52, 0x55, 0x6f, 0x1b, 0xaa, 0x6e, 0x59, 0xb6, 0xa7,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0x0c, 0x32, 0x47, 0xe4, 0x07, 0x09, 0x4e, 0x76, - 0x8f, 0x0e, 0x64, 0x31, 0xdd, 0xba, 0x67, 0xce, 0x18, 0xb2, 0xda, 0xa7, 0x60, 0xb0, 0x01, 0x65, - 0xf9, 0xcb, 0x5f, 0xff, 0xfa, 0xee, 0xd8, 0x3c, 0xf9, 0x9f, 0x9a, 0x7a, 0x1e, 0x70, 0x42, 0x1d, - 0xcd, 0xe3, 0x30, 0xee, 0xc1, 0x10, 0x9f, 0x18, 0xc8, 0x39, 0x81, 0x9f, 0xc4, 0x60, 0x22, 0xcf, - 0xf7, 0x90, 0x42, 0x0c, 0x73, 0x0c, 0x83, 0x4c, 0x4a, 0x69, 0x0c, 0x7c, 0x24, 0x21, 0x9f, 0xc1, - 0x48, 0xd0, 0x75, 0x93, 0x05, 0x81, 0xd1, 0xae, 0x71, 0x45, 0x5e, 0xec, 0x29, 0x87, 0xee, 0x15, - 0xe6, 0x7e, 0x86, 0xc8, 0x69, 0xf7, 0x41, 0x2f, 0x4e, 0xbe, 0x97, 0x60, 0x22, 0xd1, 0xf7, 0x93, - 0xe5, 0x1e, 0xe6, 0xe3, 0xed, 0xa1, 0xfc, 0xff, 0xfe, 0x84, 0x11, 0xd0, 0x12, 0x03, 0xa4, 0x90, - 0x39, 0x31, 0x20, 0xde, 0x1a, 0xfa, 0x17, 0xc2, 0x3b, 0x48, 0xe1, 0x85, 0x24, 0xba, 0x6d, 0xe1, - 0x85, 0x24, 0xbb, 0xe9, 0xbc, 0x0b, 0xe1, 0x5d, 0x25, 0xf9, 0x56, 0x82, 0xb1, 0x58, 0xef, 0x4a, - 0xce, 0xe7, 0x1a, 0x4e, 0x9c, 0xc5, 0x85, 0x7e, 0x44, 0x11, 0xc8, 0x02, 0x03, 0x32, 0x47, 0xca, - 0x22, 0x20, 0x78, 0x0e, 0x8f, 0x25, 0x98, 0xec, 0x7a, 0x32, 0x22, 0x2b, 0x02, 0x3f, 0xd9, 0xef, - 0x51, 0x72, 0xa5, 0x5f, 0x71, 0x84, 0x76, 0x81, 0x41, 0x3b, 0x47, 0x94, 0x34, 0xb4, 0x6e, 0x76, - 0x25, 0x5f, 0x49, 0x30, 0x1a, 0x3e, 0x1d, 0x91, 0xfc, 0xc0, 0x8c, 0x9e, 0x80, 0xe4, 0xa5, 0xde, - 0x82, 0x08, 0xe6, 0x1c, 0x03, 0x53, 0x26, 0x33, 0xa2, 0x88, 0xd1, 0xf4, 0xf6, 0x21, 0xf9, 0x14, - 0x86, 0xf1, 0xdd, 0x88, 0x08, 0x03, 0x21, 0xf1, 0x08, 0x25, 0x2f, 0xf4, 0x12, 0xeb, 0x9d, 0x42, - 0xac, 0xaa, 0xfa, 0xde, 0x1f, 0x4a, 0x00, 0xd1, 0xfb, 0x0b, 0x11, 0x6d, 0x2e, 0xf5, 0xae, 0x23, - 0x9f, 0xef, 0x43, 0x12, 0x71, 0xcc, 0x33, 0x1c, 0xb3, 0xe4, 0x4c, 0x1a, 0x47, 0xac, 0x86, 0x92, - 0x1f, 0x25, 0x98, 0xec, 0x7a, 0x0f, 0x12, 0x86, 0x4b, 0xf6, 0x63, 0x93, 0x30, 0x5c, 0x04, 0xcf, - 0x4c, 0x79, 0x3c, 0xcb, 0xc8, 0x55, 0x8b, 0xe3, 0xf3, 0xd9, 0x26, 0x31, 0x77, 0x09, 0xd9, 0x26, - 0x6b, 0xa0, 0x13, 0xb2, 0x4d, 0xe6, 0x28, 0x97, 0xc7, 0x36, 0x58, 0x8b, 0x35, 0x5e, 0xa4, 0xc8, - 0x37, 0x12, 0x40, 0x54, 0x03, 0x85, 0x37, 0x98, 0xaa, 0xad, 0xc2, 0x1b, 0x4c, 0x17, 0xd4, 0xbc, - 0x48, 0x8e, 0x6a, 0x39, 0xcb, 0xf7, 0xae, 0x27, 0x0c, 0xe1, 0x05, 0x66, 0xbf, 0x9c, 0x08, 0x2f, - 0x50, 0xf0, 0x32, 0x92, 0x97, 0xef, 0xdd, 0x2f, 0x26, 0x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 0xdb, 0x59, 0xb1, 0xa8, 0x77, 0xcf, 0x76, 0xf6, 0xb8, 0xd1, 0x83, 0x75, 0xf5, 0x7e, 0x64, 0x99, - 0xf5, 0xf6, 0xb5, 0x21, 0xf6, 0x9f, 0x63, 0x1b, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0x34, 0xbb, - 0xbb, 0x1e, 0xc3, 0x1b, 0x00, 0x00, + // 1646 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x59, 0x4b, 0x6f, 0xdc, 0xd4, + 0x17, 0x8f, 0xdb, 0x26, 0x4d, 0x4e, 0x92, 0x7f, 0xaa, 0xfb, 0x4f, 0xc9, 0xd4, 0xa4, 0x33, 0x53, + 0xd3, 0x34, 0x69, 0xda, 0xd8, 0x79, 0x48, 0x48, 0x08, 0x16, 0x24, 0x2d, 0x15, 0x94, 0x06, 0xd2, + 0xe9, 0x43, 0x6a, 0x37, 0xc6, 0x33, 0x73, 0x99, 0x58, 0xf1, 0xd8, 0x13, 0xdb, 0x33, 0xed, 0x14, + 0x21, 0x10, 0x42, 0xd0, 0x05, 0x8b, 0x4a, 0xb0, 0x41, 0x82, 0x0d, 0x62, 0x81, 0x58, 0xf1, 0x31, + 0xba, 0xac, 0xc4, 0x06, 0xb1, 0x28, 0xa8, 0xe5, 0x33, 0xb0, 0x46, 0xbe, 0x3e, 0x7e, 0x3f, 0x66, + 0xea, 0xa4, 0xab, 0x66, 0xee, 0x3d, 0x8f, 0xdf, 0x3d, 0x3e, 0xef, 0xc2, 0x7c, 0xb7, 0x4d, 0xa9, + 0xa4, 0xd1, 0x1e, 0x35, 0x95, 0x16, 0x95, 0x7a, 0x6b, 0xd2, 0x7e, 0x97, 0x9a, 0x7d, 0xb1, 0x63, + 0x1a, 0xb6, 0x41, 0x4e, 0x38, 0xb7, 0xa2, 0x77, 0x2b, 0xf6, 0xd6, 0xf8, 0xf9,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0x3c, 0xf2, 0xc7, + 0xf3, 0xf2, 0xc8, 0xdd, 0xd5, 0x50, 0xbb, 0xef, 0xc8, 0x5b, 0xd1, 0xa9, 0x7d, 0xcf, 0x30, 0xf7, + 0x5c, 0xe1, 0xbd, 0x75, 0xe9, 0x7e, 0xa0, 0x81, 0x35, 0xff, 0xf5, 0x31, 0xf6, 0xdf, 0x6a, 0x1b, + 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0x0f, 0xde, 0x1e, 0x65, 0xfd, 0x1b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1990,41 +1989,41 @@ type QueryClient interface { // Params queries the parameters of the x/leverage module. Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) // Borrowed queries for the borrowed amount of a user by token denomination. - // If the denomination is not supplied, the total for each borrowed token is + // If the denomination is not specified, the total for each borrowed token is // returned. Borrowed(ctx context.Context, in *QueryBorrowedRequest, opts ...grpc.CallOption) (*QueryBorrowedResponse, error) // BorrowedValue queries for the usd value of the borrowed amount of a user - // by token denomination. If the denomination is not supplied, the sum across + // by token denomination. If the denomination is not specified, the sum across // all borrowed tokens is returned. BorrowedValue(ctx context.Context, in *QueryBorrowedValueRequest, opts ...grpc.CallOption) (*QueryBorrowedValueResponse, error) - // Loaned queries for the amount of tokens loaned by a user by denomination. - // If the denomination is not supplied, the total for each loaned token is + // Supplied queries for the amount of tokens by a user by denomination. + // If the denomination is not specified, the total for each supplied token is // returned. - Loaned(ctx context.Context, in *QueryLoanedRequest, opts ...grpc.CallOption) (*QueryLoanedResponse, error) - // LoanedValue queries for the USD value loaned by a user by token - // denomination. If the denomination is not supplied, the sum across all - // loaned tokens is returned. - LoanedValue(ctx context.Context, in *QueryLoanedValueRequest, opts ...grpc.CallOption) (*QueryLoanedValueResponse, error) + Supplied(ctx context.Context, in *QuerySuppliedRequest, opts ...grpc.CallOption) (*QuerySuppliedResponse, error) + // SuppliedValue queries for the USD value supplied by a user by token + // denomination. If the denomination is not specified, the sum across all + // supplied tokens is returned. + SuppliedValue(ctx context.Context, in *QuerySuppliedValueRequest, opts ...grpc.CallOption) (*QuerySuppliedValueResponse, error) // AvailableBorrow queries for the available amount to borrow of a specified // denomination. AvailableBorrow(ctx context.Context, in *QueryAvailableBorrowRequest, opts ...grpc.CallOption) (*QueryAvailableBorrowResponse, error) // BorrowAPY queries for the borrow APY of a specified denomination. BorrowAPY(ctx context.Context, in *QueryBorrowAPYRequest, opts ...grpc.CallOption) (*QueryBorrowAPYResponse, error) - // LendAPY queries for the lend APY of a specified denomination. - LendAPY(ctx context.Context, in *QueryLendAPYRequest, opts ...grpc.CallOption) (*QueryLendAPYResponse, error) + // SupplyAPY queries for the supply APY of a specified denomination. + SupplyAPY(ctx context.Context, in *QuerySupplyAPYRequest, opts ...grpc.CallOption) (*QuerySupplyAPYResponse, error) // MarketSize queries for the Market Size in USD of a specified denomination, - // which is the USD value of total tokens loaned by all users plus borrow + // which is the USD value of total tokens supplied by all users plus borrow // interest owed by all users. MarketSize(ctx context.Context, in *QueryMarketSizeRequest, opts ...grpc.CallOption) (*QueryMarketSizeResponse, error) // TokenMarketSize queries for the Market Size in base tokens of a specified - // denomination, which is the total tokens loaned by all users plus borrow + // denomination, which is the total tokens supplied by all users plus borrow // interest owed by all users. TokenMarketSize(ctx context.Context, in *QueryTokenMarketSizeRequest, opts ...grpc.CallOption) (*QueryTokenMarketSizeResponse, error) // ReserveAmount queries for the amount reserved of a specified denomination. // If the token is not valid, the reserved amount is zero. ReserveAmount(ctx context.Context, in *QueryReserveAmountRequest, opts ...grpc.CallOption) (*QueryReserveAmountResponse, error) // Collateral queries the collateral amount of a user by token denomination. - // If the denomination is not supplied, all of the user's collateral tokens + // If the denomination is not specified, all of the user's collateral tokens // are returned. Collateral(ctx context.Context, in *QueryCollateralRequest, opts ...grpc.CallOption) (*QueryCollateralResponse, error) // CollateralValue queries for the total USD value of a user's collateral, or @@ -2041,7 +2040,7 @@ type QueryClient interface { // LiquidationTargets queries a list of all borrower addresses eligible for // liquidation. LiquidationTargets(ctx context.Context, in *QueryLiquidationTargetsRequest, opts ...grpc.CallOption) (*QueryLiquidationTargetsResponse, error) - // MarketSummary queries a base asset's current borrowing and lending + // MarketSummary queries a base asset's current borrowing and supplying // conditions. MarketSummary(ctx context.Context, in *QueryMarketSummaryRequest, opts ...grpc.CallOption) (*QueryMarketSummaryResponse, error) // TotalCollateral returns the total collateral system-wide of a given @@ -2093,18 +2092,18 @@ func (c *queryClient) BorrowedValue(ctx context.Context, in *QueryBorrowedValueR return out, nil } -func (c *queryClient) Loaned(ctx context.Context, in *QueryLoanedRequest, opts ...grpc.CallOption) (*QueryLoanedResponse, error) { - out := new(QueryLoanedResponse) - err := c.cc.Invoke(ctx, "/umee.leverage.v1.Query/Loaned", in, out, opts...) +func (c *queryClient) Supplied(ctx context.Context, in *QuerySuppliedRequest, opts ...grpc.CallOption) (*QuerySuppliedResponse, error) { + out := new(QuerySuppliedResponse) + err := c.cc.Invoke(ctx, "/umee.leverage.v1.Query/Supplied", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *queryClient) LoanedValue(ctx context.Context, in *QueryLoanedValueRequest, opts ...grpc.CallOption) (*QueryLoanedValueResponse, error) { - out := new(QueryLoanedValueResponse) - err := c.cc.Invoke(ctx, "/umee.leverage.v1.Query/LoanedValue", in, out, opts...) +func (c *queryClient) SuppliedValue(ctx context.Context, in *QuerySuppliedValueRequest, opts ...grpc.CallOption) (*QuerySuppliedValueResponse, error) { + out := new(QuerySuppliedValueResponse) + err := c.cc.Invoke(ctx, "/umee.leverage.v1.Query/SuppliedValue", in, out, opts...) if err != nil { return nil, err } @@ -2129,9 +2128,9 @@ func (c *queryClient) BorrowAPY(ctx context.Context, in *QueryBorrowAPYRequest, return out, nil } -func (c *queryClient) LendAPY(ctx context.Context, in *QueryLendAPYRequest, opts ...grpc.CallOption) (*QueryLendAPYResponse, error) { - out := new(QueryLendAPYResponse) - err := c.cc.Invoke(ctx, "/umee.leverage.v1.Query/LendAPY", in, out, opts...) +func (c *queryClient) SupplyAPY(ctx context.Context, in *QuerySupplyAPYRequest, opts ...grpc.CallOption) (*QuerySupplyAPYResponse, error) { + out := new(QuerySupplyAPYResponse) + err := c.cc.Invoke(ctx, "/umee.leverage.v1.Query/SupplyAPY", in, out, opts...) if err != nil { return nil, err } @@ -2244,41 +2243,41 @@ type QueryServer interface { // Params queries the parameters of the x/leverage module. Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) // Borrowed queries for the borrowed amount of a user by token denomination. - // If the denomination is not supplied, the total for each borrowed token is + // If the denomination is not specified, the total for each borrowed token is // returned. Borrowed(context.Context, *QueryBorrowedRequest) (*QueryBorrowedResponse, error) // BorrowedValue queries for the usd value of the borrowed amount of a user - // by token denomination. If the denomination is not supplied, the sum across + // by token denomination. If the denomination is not specified, the sum across // all borrowed tokens is returned. BorrowedValue(context.Context, *QueryBorrowedValueRequest) (*QueryBorrowedValueResponse, error) - // Loaned queries for the amount of tokens loaned by a user by denomination. - // If the denomination is not supplied, the total for each loaned token is + // Supplied queries for the amount of tokens by a user by denomination. + // If the denomination is not specified, the total for each supplied token is // returned. - Loaned(context.Context, *QueryLoanedRequest) (*QueryLoanedResponse, error) - // LoanedValue queries for the USD value loaned by a user by token - // denomination. If the denomination is not supplied, the sum across all - // loaned tokens is returned. - LoanedValue(context.Context, *QueryLoanedValueRequest) (*QueryLoanedValueResponse, error) + Supplied(context.Context, *QuerySuppliedRequest) (*QuerySuppliedResponse, error) + // SuppliedValue queries for the USD value supplied by a user by token + // denomination. If the denomination is not specified, the sum across all + // supplied tokens is returned. + SuppliedValue(context.Context, *QuerySuppliedValueRequest) (*QuerySuppliedValueResponse, error) // AvailableBorrow queries for the available amount to borrow of a specified // denomination. AvailableBorrow(context.Context, *QueryAvailableBorrowRequest) (*QueryAvailableBorrowResponse, error) // BorrowAPY queries for the borrow APY of a specified denomination. BorrowAPY(context.Context, *QueryBorrowAPYRequest) (*QueryBorrowAPYResponse, error) - // LendAPY queries for the lend APY of a specified denomination. - LendAPY(context.Context, *QueryLendAPYRequest) (*QueryLendAPYResponse, error) + // SupplyAPY queries for the supply APY of a specified denomination. + SupplyAPY(context.Context, *QuerySupplyAPYRequest) (*QuerySupplyAPYResponse, error) // MarketSize queries for the Market Size in USD of a specified denomination, - // which is the USD value of total tokens loaned by all users plus borrow + // which is the USD value of total tokens supplied by all users plus borrow // interest owed by all users. MarketSize(context.Context, *QueryMarketSizeRequest) (*QueryMarketSizeResponse, error) // TokenMarketSize queries for the Market Size in base tokens of a specified - // denomination, which is the total tokens loaned by all users plus borrow + // denomination, which is the total tokens supplied by all users plus borrow // interest owed by all users. TokenMarketSize(context.Context, *QueryTokenMarketSizeRequest) (*QueryTokenMarketSizeResponse, error) // ReserveAmount queries for the amount reserved of a specified denomination. // If the token is not valid, the reserved amount is zero. ReserveAmount(context.Context, *QueryReserveAmountRequest) (*QueryReserveAmountResponse, error) // Collateral queries the collateral amount of a user by token denomination. - // If the denomination is not supplied, all of the user's collateral tokens + // If the denomination is not specified, all of the user's collateral tokens // are returned. Collateral(context.Context, *QueryCollateralRequest) (*QueryCollateralResponse, error) // CollateralValue queries for the total USD value of a user's collateral, or @@ -2295,7 +2294,7 @@ type QueryServer interface { // LiquidationTargets queries a list of all borrower addresses eligible for // liquidation. LiquidationTargets(context.Context, *QueryLiquidationTargetsRequest) (*QueryLiquidationTargetsResponse, error) - // MarketSummary queries a base asset's current borrowing and lending + // MarketSummary queries a base asset's current borrowing and supplying // conditions. MarketSummary(context.Context, *QueryMarketSummaryRequest) (*QueryMarketSummaryResponse, error) // TotalCollateral returns the total collateral system-wide of a given @@ -2319,11 +2318,11 @@ func (*UnimplementedQueryServer) Borrowed(ctx context.Context, req *QueryBorrowe func (*UnimplementedQueryServer) BorrowedValue(ctx context.Context, req *QueryBorrowedValueRequest) (*QueryBorrowedValueResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method BorrowedValue not implemented") } -func (*UnimplementedQueryServer) Loaned(ctx context.Context, req *QueryLoanedRequest) (*QueryLoanedResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Loaned not implemented") +func (*UnimplementedQueryServer) Supplied(ctx context.Context, req *QuerySuppliedRequest) (*QuerySuppliedResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Supplied not implemented") } -func (*UnimplementedQueryServer) LoanedValue(ctx context.Context, req *QueryLoanedValueRequest) (*QueryLoanedValueResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method LoanedValue not implemented") +func (*UnimplementedQueryServer) SuppliedValue(ctx context.Context, req *QuerySuppliedValueRequest) (*QuerySuppliedValueResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SuppliedValue not implemented") } func (*UnimplementedQueryServer) AvailableBorrow(ctx context.Context, req *QueryAvailableBorrowRequest) (*QueryAvailableBorrowResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method AvailableBorrow not implemented") @@ -2331,8 +2330,8 @@ func (*UnimplementedQueryServer) AvailableBorrow(ctx context.Context, req *Query func (*UnimplementedQueryServer) BorrowAPY(ctx context.Context, req *QueryBorrowAPYRequest) (*QueryBorrowAPYResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method BorrowAPY not implemented") } -func (*UnimplementedQueryServer) LendAPY(ctx context.Context, req *QueryLendAPYRequest) (*QueryLendAPYResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method LendAPY not implemented") +func (*UnimplementedQueryServer) SupplyAPY(ctx context.Context, req *QuerySupplyAPYRequest) (*QuerySupplyAPYResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SupplyAPY not implemented") } func (*UnimplementedQueryServer) MarketSize(ctx context.Context, req *QueryMarketSizeRequest) (*QueryMarketSizeResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method MarketSize not implemented") @@ -2444,38 +2443,38 @@ func _Query_BorrowedValue_Handler(srv interface{}, ctx context.Context, dec func return interceptor(ctx, in, info, handler) } -func _Query_Loaned_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryLoanedRequest) +func _Query_Supplied_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QuerySuppliedRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).Loaned(ctx, in) + return srv.(QueryServer).Supplied(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/umee.leverage.v1.Query/Loaned", + FullMethod: "/umee.leverage.v1.Query/Supplied", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Loaned(ctx, req.(*QueryLoanedRequest)) + return srv.(QueryServer).Supplied(ctx, req.(*QuerySuppliedRequest)) } return interceptor(ctx, in, info, handler) } -func _Query_LoanedValue_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryLoanedValueRequest) +func _Query_SuppliedValue_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QuerySuppliedValueRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).LoanedValue(ctx, in) + return srv.(QueryServer).SuppliedValue(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/umee.leverage.v1.Query/LoanedValue", + FullMethod: "/umee.leverage.v1.Query/SuppliedValue", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).LoanedValue(ctx, req.(*QueryLoanedValueRequest)) + return srv.(QueryServer).SuppliedValue(ctx, req.(*QuerySuppliedValueRequest)) } return interceptor(ctx, in, info, handler) } @@ -2516,20 +2515,20 @@ func _Query_BorrowAPY_Handler(srv interface{}, ctx context.Context, dec func(int return interceptor(ctx, in, info, handler) } -func _Query_LendAPY_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryLendAPYRequest) +func _Query_SupplyAPY_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QuerySupplyAPYRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).LendAPY(ctx, in) + return srv.(QueryServer).SupplyAPY(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/umee.leverage.v1.Query/LendAPY", + FullMethod: "/umee.leverage.v1.Query/SupplyAPY", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).LendAPY(ctx, req.(*QueryLendAPYRequest)) + return srv.(QueryServer).SupplyAPY(ctx, req.(*QuerySupplyAPYRequest)) } return interceptor(ctx, in, info, handler) } @@ -2753,12 +2752,12 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Handler: _Query_BorrowedValue_Handler, }, { - MethodName: "Loaned", - Handler: _Query_Loaned_Handler, + MethodName: "Supplied", + Handler: _Query_Supplied_Handler, }, { - MethodName: "LoanedValue", - Handler: _Query_LoanedValue_Handler, + MethodName: "SuppliedValue", + Handler: _Query_SuppliedValue_Handler, }, { MethodName: "AvailableBorrow", @@ -2769,8 +2768,8 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Handler: _Query_BorrowAPY_Handler, }, { - MethodName: "LendAPY", - Handler: _Query_LendAPY_Handler, + MethodName: "SupplyAPY", + Handler: _Query_SupplyAPY_Handler, }, { MethodName: "MarketSize", @@ -2970,7 +2969,7 @@ func (m *QueryBorrowAPYResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *QueryLendAPYRequest) Marshal() (dAtA []byte, err error) { +func (m *QuerySupplyAPYRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2980,12 +2979,12 @@ func (m *QueryLendAPYRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryLendAPYRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QuerySupplyAPYRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryLendAPYRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QuerySupplyAPYRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -3000,7 +2999,7 @@ func (m *QueryLendAPYRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *QueryLendAPYResponse) Marshal() (dAtA []byte, err error) { +func (m *QuerySupplyAPYResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -3010,12 +3009,12 @@ func (m *QueryLendAPYResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryLendAPYResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QuerySupplyAPYResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryLendAPYResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QuerySupplyAPYResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -3466,7 +3465,7 @@ func (m *QueryCollateralValueResponse) MarshalToSizedBuffer(dAtA []byte) (int, e return len(dAtA) - i, nil } -func (m *QueryLoanedRequest) Marshal() (dAtA []byte, err error) { +func (m *QuerySuppliedRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -3476,12 +3475,12 @@ func (m *QueryLoanedRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryLoanedRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QuerySuppliedRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryLoanedRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QuerySuppliedRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -3503,7 +3502,7 @@ func (m *QueryLoanedRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *QueryLoanedResponse) Marshal() (dAtA []byte, err error) { +func (m *QuerySuppliedResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -3513,20 +3512,20 @@ func (m *QueryLoanedResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryLoanedResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QuerySuppliedResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryLoanedResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QuerySuppliedResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Loaned) > 0 { - for iNdEx := len(m.Loaned) - 1; iNdEx >= 0; iNdEx-- { + if len(m.Supplied) > 0 { + for iNdEx := len(m.Supplied) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.Loaned[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Supplied[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -3540,7 +3539,7 @@ func (m *QueryLoanedResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *QueryLoanedValueRequest) Marshal() (dAtA []byte, err error) { +func (m *QuerySuppliedValueRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -3550,12 +3549,12 @@ func (m *QueryLoanedValueRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryLoanedValueRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QuerySuppliedValueRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryLoanedValueRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QuerySuppliedValueRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -3577,7 +3576,7 @@ func (m *QueryLoanedValueRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *QueryLoanedValueResponse) Marshal() (dAtA []byte, err error) { +func (m *QuerySuppliedValueResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -3587,20 +3586,20 @@ func (m *QueryLoanedValueResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryLoanedValueResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QuerySuppliedValueResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryLoanedValueResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QuerySuppliedValueResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l { - size := m.LoanedValue.Size() + size := m.SuppliedValue.Size() i -= size - if _, err := m.LoanedValue.MarshalTo(dAtA[i:]); err != nil { + if _, err := m.SuppliedValue.MarshalTo(dAtA[i:]); err != nil { return 0, err } i = encodeVarintQuery(dAtA, i, uint64(size)) @@ -4092,9 +4091,9 @@ func (m *QueryMarketSummaryResponse) MarshalToSizedBuffer(dAtA []byte) (int, err i-- dAtA[i] = 0x32 { - size := m.Lend_APY.Size() + size := m.Supply_APY.Size() i -= size - if _, err := m.Lend_APY.MarshalTo(dAtA[i:]); err != nil { + if _, err := m.Supply_APY.MarshalTo(dAtA[i:]); err != nil { return 0, err } i = encodeVarintQuery(dAtA, i, uint64(size)) @@ -4269,7 +4268,7 @@ func (m *QueryBorrowAPYResponse) Size() (n int) { return n } -func (m *QueryLendAPYRequest) Size() (n int) { +func (m *QuerySupplyAPYRequest) Size() (n int) { if m == nil { return 0 } @@ -4282,7 +4281,7 @@ func (m *QueryLendAPYRequest) Size() (n int) { return n } -func (m *QueryLendAPYResponse) Size() (n int) { +func (m *QuerySupplyAPYResponse) Size() (n int) { if m == nil { return 0 } @@ -4464,7 +4463,7 @@ func (m *QueryCollateralValueResponse) Size() (n int) { return n } -func (m *QueryLoanedRequest) Size() (n int) { +func (m *QuerySuppliedRequest) Size() (n int) { if m == nil { return 0 } @@ -4481,14 +4480,14 @@ func (m *QueryLoanedRequest) Size() (n int) { return n } -func (m *QueryLoanedResponse) Size() (n int) { +func (m *QuerySuppliedResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if len(m.Loaned) > 0 { - for _, e := range m.Loaned { + if len(m.Supplied) > 0 { + for _, e := range m.Supplied { l = e.Size() n += 1 + l + sovQuery(uint64(l)) } @@ -4496,7 +4495,7 @@ func (m *QueryLoanedResponse) Size() (n int) { return n } -func (m *QueryLoanedValueRequest) Size() (n int) { +func (m *QuerySuppliedValueRequest) Size() (n int) { if m == nil { return 0 } @@ -4513,13 +4512,13 @@ func (m *QueryLoanedValueRequest) Size() (n int) { return n } -func (m *QueryLoanedValueResponse) Size() (n int) { +func (m *QuerySuppliedValueResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = m.LoanedValue.Size() + l = m.SuppliedValue.Size() n += 1 + l + sovQuery(uint64(l)) return n } @@ -4708,7 +4707,7 @@ func (m *QueryMarketSummaryResponse) Size() (n int) { } l = m.UTokenExchangeRate.Size() n += 1 + l + sovQuery(uint64(l)) - l = m.Lend_APY.Size() + l = m.Supply_APY.Size() n += 1 + l + sovQuery(uint64(l)) l = m.Borrow_APY.Size() n += 1 + l + sovQuery(uint64(l)) @@ -5135,7 +5134,7 @@ func (m *QueryBorrowAPYResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryLendAPYRequest) Unmarshal(dAtA []byte) error { +func (m *QuerySupplyAPYRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5158,10 +5157,10 @@ func (m *QueryLendAPYRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryLendAPYRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QuerySupplyAPYRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryLendAPYRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QuerySupplyAPYRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -5217,7 +5216,7 @@ func (m *QueryLendAPYRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryLendAPYResponse) Unmarshal(dAtA []byte) error { +func (m *QuerySupplyAPYResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5240,10 +5239,10 @@ func (m *QueryLendAPYResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryLendAPYResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QuerySupplyAPYResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryLendAPYResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QuerySupplyAPYResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -6444,7 +6443,7 @@ func (m *QueryCollateralValueResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryLoanedRequest) Unmarshal(dAtA []byte) error { +func (m *QuerySuppliedRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6467,10 +6466,10 @@ func (m *QueryLoanedRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryLoanedRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QuerySuppliedRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryLoanedRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QuerySuppliedRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -6558,7 +6557,7 @@ func (m *QueryLoanedRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryLoanedResponse) Unmarshal(dAtA []byte) error { +func (m *QuerySuppliedResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6581,15 +6580,15 @@ func (m *QueryLoanedResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryLoanedResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QuerySuppliedResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryLoanedResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QuerySuppliedResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Loaned", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Supplied", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -6616,8 +6615,8 @@ func (m *QueryLoanedResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Loaned = append(m.Loaned, types.Coin{}) - if err := m.Loaned[len(m.Loaned)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Supplied = append(m.Supplied, types.Coin{}) + if err := m.Supplied[len(m.Supplied)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -6642,7 +6641,7 @@ func (m *QueryLoanedResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryLoanedValueRequest) Unmarshal(dAtA []byte) error { +func (m *QuerySuppliedValueRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6665,10 +6664,10 @@ func (m *QueryLoanedValueRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryLoanedValueRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QuerySuppliedValueRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryLoanedValueRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QuerySuppliedValueRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -6756,7 +6755,7 @@ func (m *QueryLoanedValueRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryLoanedValueResponse) Unmarshal(dAtA []byte) error { +func (m *QuerySuppliedValueResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6779,15 +6778,15 @@ func (m *QueryLoanedValueResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryLoanedValueResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QuerySuppliedValueResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryLoanedValueResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QuerySuppliedValueResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LoanedValue", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field SuppliedValue", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -6815,7 +6814,7 @@ func (m *QueryLoanedValueResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.LoanedValue.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.SuppliedValue.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -8068,7 +8067,7 @@ func (m *QueryMarketSummaryResponse) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Lend_APY", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Supply_APY", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -8096,7 +8095,7 @@ func (m *QueryMarketSummaryResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Lend_APY.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Supply_APY.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/leverage/types/query.pb.gw.go b/x/leverage/types/query.pb.gw.go index c68a3cfbb4..952fa8fe11 100644 --- a/x/leverage/types/query.pb.gw.go +++ b/x/leverage/types/query.pb.gw.go @@ -142,73 +142,73 @@ func local_request_Query_BorrowedValue_0(ctx context.Context, marshaler runtime. } var ( - filter_Query_Loaned_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + filter_Query_Supplied_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) -func request_Query_Loaned_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryLoanedRequest +func request_Query_Supplied_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QuerySuppliedRequest var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Loaned_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Supplied_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.Loaned(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.Supplied(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_Loaned_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryLoanedRequest +func local_request_Query_Supplied_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QuerySuppliedRequest var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Loaned_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Supplied_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.Loaned(ctx, &protoReq) + msg, err := server.Supplied(ctx, &protoReq) return msg, metadata, err } var ( - filter_Query_LoanedValue_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + filter_Query_SuppliedValue_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) -func request_Query_LoanedValue_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryLoanedValueRequest +func request_Query_SuppliedValue_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QuerySuppliedValueRequest var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_LoanedValue_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_SuppliedValue_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.LoanedValue(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.SuppliedValue(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_LoanedValue_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryLoanedValueRequest +func local_request_Query_SuppliedValue_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QuerySuppliedValueRequest var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_LoanedValue_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_SuppliedValue_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.LoanedValue(ctx, &protoReq) + msg, err := server.SuppliedValue(ctx, &protoReq) return msg, metadata, err } @@ -286,37 +286,37 @@ func local_request_Query_BorrowAPY_0(ctx context.Context, marshaler runtime.Mars } var ( - filter_Query_LendAPY_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + filter_Query_SupplyAPY_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) -func request_Query_LendAPY_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryLendAPYRequest +func request_Query_SupplyAPY_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QuerySupplyAPYRequest var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_LendAPY_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_SupplyAPY_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.LendAPY(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.SupplyAPY(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_LendAPY_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryLendAPYRequest +func local_request_Query_SupplyAPY_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QuerySupplyAPYRequest var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_LendAPY_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_SupplyAPY_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.LendAPY(ctx, &protoReq) + msg, err := server.SupplyAPY(ctx, &protoReq) return msg, metadata, err } @@ -761,7 +761,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_Loaned_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_Supplied_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -772,7 +772,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_Loaned_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_Supplied_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -780,11 +780,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_Loaned_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_Supplied_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_LoanedValue_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_SuppliedValue_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -795,7 +795,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_LoanedValue_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_SuppliedValue_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -803,7 +803,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_LoanedValue_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_SuppliedValue_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -853,7 +853,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_LendAPY_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_SupplyAPY_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -864,7 +864,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_LendAPY_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_SupplyAPY_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -872,7 +872,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_LendAPY_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_SupplyAPY_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1227,7 +1227,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_Loaned_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_Supplied_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -1236,18 +1236,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_Loaned_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_Supplied_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_Loaned_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_Supplied_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_LoanedValue_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_SuppliedValue_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -1256,14 +1256,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_LoanedValue_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_SuppliedValue_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_LoanedValue_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_SuppliedValue_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1307,7 +1307,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_LendAPY_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_SupplyAPY_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -1316,14 +1316,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_LendAPY_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_SupplyAPY_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_LendAPY_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_SupplyAPY_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1539,15 +1539,15 @@ var ( pattern_Query_BorrowedValue_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"umee", "leverage", "v1", "borrowed_value"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Query_Loaned_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"umee", "leverage", "v1", "loaned"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_Supplied_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"umee", "leverage", "v1", "loaned"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Query_LoanedValue_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"umee", "leverage", "v1", "loaned_value"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_SuppliedValue_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"umee", "leverage", "v1", "loaned_value"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Query_AvailableBorrow_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"umee", "leverage", "v1", "available_borrow"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Query_BorrowAPY_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"umee", "leverage", "v1", "borrow_apy"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Query_LendAPY_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"umee", "leverage", "v1", "lend_apy"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_SupplyAPY_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"umee", "leverage", "v1", "supply_apy"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Query_MarketSize_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"umee", "leverage", "v1", "market_size"}, "", runtime.AssumeColonVerbOpt(true))) @@ -1579,15 +1579,15 @@ var ( forward_Query_BorrowedValue_0 = runtime.ForwardResponseMessage - forward_Query_Loaned_0 = runtime.ForwardResponseMessage + forward_Query_Supplied_0 = runtime.ForwardResponseMessage - forward_Query_LoanedValue_0 = runtime.ForwardResponseMessage + forward_Query_SuppliedValue_0 = runtime.ForwardResponseMessage forward_Query_AvailableBorrow_0 = runtime.ForwardResponseMessage forward_Query_BorrowAPY_0 = runtime.ForwardResponseMessage - forward_Query_LendAPY_0 = runtime.ForwardResponseMessage + forward_Query_SupplyAPY_0 = runtime.ForwardResponseMessage forward_Query_MarketSize_0 = runtime.ForwardResponseMessage diff --git a/x/leverage/types/token.go b/x/leverage/types/token.go index 2c032d60df..95df9ac2e5 100644 --- a/x/leverage/types/token.go +++ b/x/leverage/types/token.go @@ -74,23 +74,23 @@ func (t Token) Validate() error { return fmt.Errorf("invalid liquidation incentive: %s", t.LiquidationIncentive) } - // Blacklisted assets cannot have borrow or lend enabled + // Blacklisted assets cannot have borrow or supply enabled if t.Blacklist { if t.EnableMsgBorrow { return fmt.Errorf("blacklisted assets cannot have borrowing enabled") } - if t.EnableMsgLend { - return fmt.Errorf("blacklisted assets cannot have lending enabled") + if t.EnableMsgSupply { + return fmt.Errorf("blacklisted assets cannot have supplying enabled") } } return nil } -// AssertLendEnabled returns an error if a token does not exist or cannot be lent. -func (t Token) AssertLendEnabled() error { - if !t.EnableMsgLend { - return sdkerrors.Wrap(ErrLendNotAllowed, t.BaseDenom) +// AssertSupplyEnabled returns an error if a token does not exist or cannot be supplied. +func (t Token) AssertSupplyEnabled() error { + if !t.EnableMsgSupply { + return sdkerrors.Wrap(ErrSupplyNotAllowed, t.BaseDenom) } return nil } diff --git a/x/leverage/types/token_test.go b/x/leverage/types/token_test.go index fcc69eb019..20cab30c4d 100644 --- a/x/leverage/types/token_test.go +++ b/x/leverage/types/token_test.go @@ -33,7 +33,7 @@ func TestUpdateRegistryProposal_String(t *testing.T) { MaxBorrowRate: sdk.NewDec(21), KinkUtilization: sdk.MustNewDecFromStr("0.25"), LiquidationIncentive: sdk.NewDec(88), - EnableMsgLend: true, + EnableMsgSupply: true, EnableMsgBorrow: true, Blacklist: false, }, @@ -53,7 +53,7 @@ registry: liquidation_incentive: "88.000000000000000000" symbol_denom: umee exponent: 6 - enable_msg_lend: true + enable_msg_supply: true enable_msg_borrow: true blacklist: false ` @@ -78,7 +78,7 @@ func TestToken_Validate(t *testing.T) { MaxBorrowRate: sdk.MustNewDecFromStr("1.0"), KinkUtilization: sdk.MustNewDecFromStr("0.75"), LiquidationIncentive: sdk.MustNewDecFromStr("0.05"), - EnableMsgLend: true, + EnableMsgSupply: true, EnableMsgBorrow: true, Blacklist: false, }, @@ -94,7 +94,7 @@ func TestToken_Validate(t *testing.T) { MaxBorrowRate: sdk.MustNewDecFromStr("1.0"), KinkUtilization: sdk.MustNewDecFromStr("0.75"), LiquidationIncentive: sdk.MustNewDecFromStr("0.05"), - EnableMsgLend: true, + EnableMsgSupply: true, EnableMsgBorrow: true, Blacklist: false, }, @@ -111,7 +111,7 @@ func TestToken_Validate(t *testing.T) { MaxBorrowRate: sdk.MustNewDecFromStr("1.0"), KinkUtilization: sdk.MustNewDecFromStr("0.75"), LiquidationIncentive: sdk.MustNewDecFromStr("0.05"), - EnableMsgLend: true, + EnableMsgSupply: true, EnableMsgBorrow: true, Blacklist: false, }, @@ -128,7 +128,7 @@ func TestToken_Validate(t *testing.T) { MaxBorrowRate: sdk.MustNewDecFromStr("1.0"), KinkUtilization: sdk.MustNewDecFromStr("0.75"), LiquidationIncentive: sdk.MustNewDecFromStr("0.05"), - EnableMsgLend: true, + EnableMsgSupply: true, EnableMsgBorrow: true, Blacklist: false, }, @@ -145,7 +145,7 @@ func TestToken_Validate(t *testing.T) { MaxBorrowRate: sdk.MustNewDecFromStr("1.0"), KinkUtilization: sdk.MustNewDecFromStr("0.75"), LiquidationIncentive: sdk.MustNewDecFromStr("0.05"), - EnableMsgLend: true, + EnableMsgSupply: true, EnableMsgBorrow: true, Blacklist: false, }, @@ -162,7 +162,7 @@ func TestToken_Validate(t *testing.T) { MaxBorrowRate: sdk.MustNewDecFromStr("1.0"), KinkUtilization: sdk.MustNewDecFromStr("0.75"), LiquidationIncentive: sdk.MustNewDecFromStr("0.05"), - EnableMsgLend: true, + EnableMsgSupply: true, EnableMsgBorrow: true, Blacklist: false, }, @@ -179,7 +179,7 @@ func TestToken_Validate(t *testing.T) { MaxBorrowRate: sdk.MustNewDecFromStr("1.0"), KinkUtilization: sdk.MustNewDecFromStr("0.75"), LiquidationIncentive: sdk.MustNewDecFromStr("0.05"), - EnableMsgLend: true, + EnableMsgSupply: true, EnableMsgBorrow: true, Blacklist: false, }, @@ -196,7 +196,7 @@ func TestToken_Validate(t *testing.T) { MaxBorrowRate: sdk.MustNewDecFromStr("1.0"), KinkUtilization: sdk.MustNewDecFromStr("0.75"), LiquidationIncentive: sdk.MustNewDecFromStr("0.05"), - EnableMsgLend: true, + EnableMsgSupply: true, EnableMsgBorrow: true, Blacklist: false, }, @@ -213,7 +213,7 @@ func TestToken_Validate(t *testing.T) { MaxBorrowRate: sdk.MustNewDecFromStr("-1.0"), KinkUtilization: sdk.MustNewDecFromStr("0.75"), LiquidationIncentive: sdk.MustNewDecFromStr("0.05"), - EnableMsgLend: true, + EnableMsgSupply: true, EnableMsgBorrow: true, Blacklist: false, }, @@ -230,7 +230,7 @@ func TestToken_Validate(t *testing.T) { MaxBorrowRate: sdk.MustNewDecFromStr("1.0"), KinkUtilization: sdk.ZeroDec(), LiquidationIncentive: sdk.MustNewDecFromStr("0.05"), - EnableMsgLend: true, + EnableMsgSupply: true, EnableMsgBorrow: true, Blacklist: false, }, @@ -247,13 +247,13 @@ func TestToken_Validate(t *testing.T) { MaxBorrowRate: sdk.MustNewDecFromStr("1.0"), KinkUtilization: sdk.MustNewDecFromStr("0.75"), LiquidationIncentive: sdk.MustNewDecFromStr("-0.05"), - EnableMsgLend: true, + EnableMsgSupply: true, EnableMsgBorrow: true, Blacklist: false, }, expectErr: true, }, - "blacklisted but lend enabled": { + "blacklisted but supply enabled": { input: types.Token{ BaseDenom: "uumee", SymbolDenom: "umee", @@ -266,7 +266,7 @@ func TestToken_Validate(t *testing.T) { MaxBorrowRate: sdk.MustNewDecFromStr("1.0"), KinkUtilization: sdk.MustNewDecFromStr("0.75"), LiquidationIncentive: sdk.MustNewDecFromStr("0.05"), - EnableMsgLend: true, + EnableMsgSupply: true, EnableMsgBorrow: false, Blacklist: true, }, @@ -285,7 +285,7 @@ func TestToken_Validate(t *testing.T) { MaxBorrowRate: sdk.MustNewDecFromStr("1.0"), KinkUtilization: sdk.MustNewDecFromStr("0.75"), LiquidationIncentive: sdk.MustNewDecFromStr("0.05"), - EnableMsgLend: false, + EnableMsgSupply: false, EnableMsgBorrow: true, Blacklist: true, }, diff --git a/x/leverage/types/tx.go b/x/leverage/types/tx.go index 69b3b94c7c..c664b39e19 100644 --- a/x/leverage/types/tx.go +++ b/x/leverage/types/tx.go @@ -5,18 +5,18 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) -func NewMsgLendAsset(lender sdk.AccAddress, amount sdk.Coin) *MsgLendAsset { - return &MsgLendAsset{ - Lender: lender.String(), - Amount: amount, +func NewMsgSupply(supplier sdk.AccAddress, amount sdk.Coin) *MsgSupply { + return &MsgSupply{ + Supplier: supplier.String(), + Amount: amount, } } -func (msg MsgLendAsset) Route() string { return ModuleName } -func (msg MsgLendAsset) Type() string { return EventTypeLoanAsset } +func (msg MsgSupply) Route() string { return ModuleName } +func (msg MsgSupply) Type() string { return EventTypeLoanAsset } -func (msg *MsgLendAsset) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(msg.GetLender()) +func (msg *MsgSupply) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.GetSupplier()) if err != nil { return err } @@ -28,29 +28,29 @@ func (msg *MsgLendAsset) ValidateBasic() error { return nil } -func (msg *MsgLendAsset) GetSigners() []sdk.AccAddress { - lender, _ := sdk.AccAddressFromBech32(msg.GetLender()) - return []sdk.AccAddress{lender} +func (msg *MsgSupply) GetSigners() []sdk.AccAddress { + supplier, _ := sdk.AccAddressFromBech32(msg.GetSupplier()) + return []sdk.AccAddress{supplier} } // GetSignBytes get the bytes for the message signer to sign on -func (msg *MsgLendAsset) GetSignBytes() []byte { +func (msg *MsgSupply) GetSignBytes() []byte { bz := ModuleCdc.MustMarshalJSON(msg) return sdk.MustSortJSON(bz) } -func NewMsgWithdrawAsset(lender sdk.AccAddress, amount sdk.Coin) *MsgWithdrawAsset { +func NewMsgWithdrawAsset(supplier sdk.AccAddress, amount sdk.Coin) *MsgWithdrawAsset { return &MsgWithdrawAsset{ - Lender: lender.String(), - Amount: amount, + Supplier: supplier.String(), + Amount: amount, } } func (msg MsgWithdrawAsset) Route() string { return ModuleName } -func (msg MsgWithdrawAsset) Type() string { return EventTypeWithdrawLoanedAsset } +func (msg MsgWithdrawAsset) Type() string { return EventTypeWithdrawAsset } func (msg *MsgWithdrawAsset) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(msg.GetLender()) + _, err := sdk.AccAddressFromBech32(msg.GetSupplier()) if err != nil { return err } @@ -63,8 +63,8 @@ func (msg *MsgWithdrawAsset) ValidateBasic() error { } func (msg *MsgWithdrawAsset) GetSigners() []sdk.AccAddress { - lender, _ := sdk.AccAddressFromBech32(msg.GetLender()) - return []sdk.AccAddress{lender} + supplier, _ := sdk.AccAddressFromBech32(msg.GetSupplier()) + return []sdk.AccAddress{supplier} } // GetSignBytes get the bytes for the message signer to sign on diff --git a/x/leverage/types/tx.pb.go b/x/leverage/types/tx.pb.go index 73ad372f8c..649fc1ab4e 100644 --- a/x/leverage/types/tx.pb.go +++ b/x/leverage/types/tx.pb.go @@ -29,26 +29,25 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// MsgLendAsset represents a lender's request to lend a base asset type to the -// module. -type MsgLendAsset struct { - // Lender is the account address supplying assets and the signer of the message. - Lender string `protobuf:"bytes,1,opt,name=lender,proto3" json:"lender,omitempty"` - Amount types.Coin `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount"` -} - -func (m *MsgLendAsset) Reset() { *m = MsgLendAsset{} } -func (m *MsgLendAsset) String() string { return proto.CompactTextString(m) } -func (*MsgLendAsset) ProtoMessage() {} -func (*MsgLendAsset) Descriptor() ([]byte, []int) { +// MsgSupply is the request structure for the Supply RPC. +type MsgSupply struct { + // Supplier is the account address supplying assets and the signer of the message. + Supplier string `protobuf:"bytes,1,opt,name=supplier,proto3" json:"supplier,omitempty"` + Amount types.Coin `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount"` +} + +func (m *MsgSupply) Reset() { *m = MsgSupply{} } +func (m *MsgSupply) String() string { return proto.CompactTextString(m) } +func (*MsgSupply) ProtoMessage() {} +func (*MsgSupply) Descriptor() ([]byte, []int) { return fileDescriptor_72683128ee6e8843, []int{0} } -func (m *MsgLendAsset) XXX_Unmarshal(b []byte) error { +func (m *MsgSupply) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgLendAsset) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgSupply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgLendAsset.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgSupply.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -58,38 +57,38 @@ func (m *MsgLendAsset) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } -func (m *MsgLendAsset) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgLendAsset.Merge(m, src) +func (m *MsgSupply) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSupply.Merge(m, src) } -func (m *MsgLendAsset) XXX_Size() int { +func (m *MsgSupply) XXX_Size() int { return m.Size() } -func (m *MsgLendAsset) XXX_DiscardUnknown() { - xxx_messageInfo_MsgLendAsset.DiscardUnknown(m) +func (m *MsgSupply) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSupply.DiscardUnknown(m) } -var xxx_messageInfo_MsgLendAsset proto.InternalMessageInfo +var xxx_messageInfo_MsgSupply proto.InternalMessageInfo -func (m *MsgLendAsset) GetLender() string { +func (m *MsgSupply) GetSupplier() string { if m != nil { - return m.Lender + return m.Supplier } return "" } -func (m *MsgLendAsset) GetAmount() types.Coin { +func (m *MsgSupply) GetAmount() types.Coin { if m != nil { return m.Amount } return types.Coin{} } -// MsgWithdrawAsset represents a lender's request to withdraw lent assets. +// MsgWithdrawAsset represents a user's request to withdraw supplied assets. // Amount must be a uToken. type MsgWithdrawAsset struct { - // Lender is the account address withdrawing assets and the signer of the message. - Lender string `protobuf:"bytes,1,opt,name=lender,proto3" json:"lender,omitempty"` - Amount types.Coin `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount"` + // Supplier is the account address withdrawing assets and the signer of the message. + Supplier string `protobuf:"bytes,1,opt,name=supplier,proto3" json:"supplier,omitempty"` + Amount types.Coin `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount"` } func (m *MsgWithdrawAsset) Reset() { *m = MsgWithdrawAsset{} } @@ -125,9 +124,9 @@ func (m *MsgWithdrawAsset) XXX_DiscardUnknown() { var xxx_messageInfo_MsgWithdrawAsset proto.InternalMessageInfo -func (m *MsgWithdrawAsset) GetLender() string { +func (m *MsgWithdrawAsset) GetSupplier() string { if m != nil { - return m.Lender + return m.Supplier } return "" } @@ -139,7 +138,7 @@ func (m *MsgWithdrawAsset) GetAmount() types.Coin { return types.Coin{} } -// MsgAddCollateral represents a lender's request to enable selected +// MsgAddCollateral represents a user's request to enable selected // uTokens as collateral. type MsgAddCollateral struct { // Borrower is the account address adding collateral and the signer of the message. @@ -194,7 +193,7 @@ func (m *MsgAddCollateral) GetCoin() types.Coin { return types.Coin{} } -// MsgRemoveCollateral represents a lender's request to disable selected +// MsgRemoveCollateral represents a user's request to disable selected // uTokens as collateral. type MsgRemoveCollateral struct { // Borrower is the account address removing collateral and the signer of the message. @@ -249,7 +248,7 @@ func (m *MsgRemoveCollateral) GetCoin() types.Coin { return types.Coin{} } -// MsgBorrowAsset represents a lender's request to borrow a base asset type +// MsgBorrowAsset represents a user's request to borrow a base asset type // from the module. type MsgBorrowAsset struct { // Borrower is the account address taking a loan and the signer @@ -305,7 +304,7 @@ func (m *MsgBorrowAsset) GetAmount() types.Coin { return types.Coin{} } -// MsgRepayAsset represents a lender's request to repay a borrowed base asset +// MsgRepayAsset represents a user's request to repay a borrowed base asset // type to the module. type MsgRepayAsset struct { // Borrower is the account address repaying a loan and the signer @@ -433,22 +432,22 @@ func (m *MsgLiquidate) GetReward() types.Coin { return types.Coin{} } -// MsgLendAssetResponse defines the Msg/LendAsset response type. -type MsgLendAssetResponse struct { +// MsgSupplyResponse defines the Msg/Supply response type. +type MsgSupplyResponse struct { } -func (m *MsgLendAssetResponse) Reset() { *m = MsgLendAssetResponse{} } -func (m *MsgLendAssetResponse) String() string { return proto.CompactTextString(m) } -func (*MsgLendAssetResponse) ProtoMessage() {} -func (*MsgLendAssetResponse) Descriptor() ([]byte, []int) { +func (m *MsgSupplyResponse) Reset() { *m = MsgSupplyResponse{} } +func (m *MsgSupplyResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSupplyResponse) ProtoMessage() {} +func (*MsgSupplyResponse) Descriptor() ([]byte, []int) { return fileDescriptor_72683128ee6e8843, []int{7} } -func (m *MsgLendAssetResponse) XXX_Unmarshal(b []byte) error { +func (m *MsgSupplyResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgLendAssetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgSupplyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgLendAssetResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgSupplyResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -458,17 +457,17 @@ func (m *MsgLendAssetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte return b[:n], nil } } -func (m *MsgLendAssetResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgLendAssetResponse.Merge(m, src) +func (m *MsgSupplyResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSupplyResponse.Merge(m, src) } -func (m *MsgLendAssetResponse) XXX_Size() int { +func (m *MsgSupplyResponse) XXX_Size() int { return m.Size() } -func (m *MsgLendAssetResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgLendAssetResponse.DiscardUnknown(m) +func (m *MsgSupplyResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSupplyResponse.DiscardUnknown(m) } -var xxx_messageInfo_MsgLendAssetResponse proto.InternalMessageInfo +var xxx_messageInfo_MsgSupplyResponse proto.InternalMessageInfo // MsgWithdrawAssetResponse defines the Msg/WithdrawAsset response type. type MsgWithdrawAssetResponse struct { @@ -717,14 +716,14 @@ func (m *MsgLiquidateResponse) GetReward() types.Coin { } func init() { - proto.RegisterType((*MsgLendAsset)(nil), "umee.leverage.v1.MsgLendAsset") + proto.RegisterType((*MsgSupply)(nil), "umee.leverage.v1.MsgSupply") proto.RegisterType((*MsgWithdrawAsset)(nil), "umee.leverage.v1.MsgWithdrawAsset") proto.RegisterType((*MsgAddCollateral)(nil), "umee.leverage.v1.MsgAddCollateral") proto.RegisterType((*MsgRemoveCollateral)(nil), "umee.leverage.v1.MsgRemoveCollateral") proto.RegisterType((*MsgBorrowAsset)(nil), "umee.leverage.v1.MsgBorrowAsset") proto.RegisterType((*MsgRepayAsset)(nil), "umee.leverage.v1.MsgRepayAsset") proto.RegisterType((*MsgLiquidate)(nil), "umee.leverage.v1.MsgLiquidate") - proto.RegisterType((*MsgLendAssetResponse)(nil), "umee.leverage.v1.MsgLendAssetResponse") + proto.RegisterType((*MsgSupplyResponse)(nil), "umee.leverage.v1.MsgSupplyResponse") proto.RegisterType((*MsgWithdrawAssetResponse)(nil), "umee.leverage.v1.MsgWithdrawAssetResponse") proto.RegisterType((*MsgAddCollateralResponse)(nil), "umee.leverage.v1.MsgAddCollateralResponse") proto.RegisterType((*MsgRemoveCollateralResponse)(nil), "umee.leverage.v1.MsgRemoveCollateralResponse") @@ -736,44 +735,45 @@ func init() { func init() { proto.RegisterFile("umee/leverage/v1/tx.proto", fileDescriptor_72683128ee6e8843) } var fileDescriptor_72683128ee6e8843 = []byte{ - // 587 bytes of a gzipped FileDescriptorProto + // 594 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x55, 0xc1, 0x6e, 0xd3, 0x40, - 0x10, 0x8d, 0xdb, 0x10, 0x91, 0x29, 0x45, 0x91, 0x29, 0x91, 0x6b, 0x84, 0x1b, 0x59, 0x02, 0x22, - 0xa4, 0xda, 0x24, 0x3d, 0x70, 0xe2, 0xd0, 0xf4, 0x86, 0x88, 0x84, 0x82, 0x04, 0x82, 0x4b, 0xb5, - 0x89, 0x07, 0xc7, 0xc2, 0xf6, 0x86, 0xdd, 0x4d, 0xd2, 0xfe, 0x01, 0x27, 0xc4, 0x37, 0x71, 0xea, - 0xb1, 0x47, 0x4e, 0x08, 0x25, 0x3f, 0x82, 0x6c, 0xc7, 0x8e, 0x6d, 0x9c, 0x26, 0x80, 0x72, 0xf3, - 0xfa, 0xbd, 0x99, 0x37, 0x33, 0xfb, 0x3c, 0x86, 0xc3, 0xb1, 0x87, 0x68, 0xba, 0x38, 0x41, 0x46, - 0x6c, 0x34, 0x27, 0x2d, 0x53, 0x5c, 0x18, 0x23, 0x46, 0x05, 0x95, 0x6b, 0x01, 0x64, 0xc4, 0x90, - 0x31, 0x69, 0xa9, 0xda, 0x80, 0x72, 0x8f, 0x72, 0xb3, 0x4f, 0x78, 0x40, 0xed, 0xa3, 0x20, 0x2d, - 0x73, 0x40, 0x1d, 0x3f, 0x8a, 0x50, 0x0f, 0x6c, 0x6a, 0xd3, 0xf0, 0xd1, 0x0c, 0x9e, 0xa2, 0xb7, - 0xfa, 0x39, 0xdc, 0xe9, 0x72, 0xfb, 0x15, 0xfa, 0xd6, 0x29, 0xe7, 0x28, 0xe4, 0x3a, 0x54, 0x5c, - 0xf4, 0x2d, 0x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42, 0xa6, 0x6c, 0xad, 0x57, 0xc8, 0x3c, 0x82, 0x37, 0x41, 0xd0, 0xd0, 0x26, 0x8e, + 0x52, 0x5a, 0xb3, 0x89, 0x29, 0x5d, 0xdf, 0x85, 0x7b, 0xe2, 0x4f, 0x69, 0x23, 0x1a, 0xe1, 0x90, + 0x22, 0x5d, 0x05, 0x65, 0xf1, 0x72, 0x2f, 0x60, 0x99, 0xfb, 0x28, 0xb0, 0x87, 0x70, 0x90, 0x73, + 0x8d, 0x04, 0xac, 0xc0, 0x83, 0xec, 0xe9, 0x0b, 0xe4, 0x35, 0xdc, 0xcf, 0x1c, 0x58, 0x02, 0x4c, + 0xfb, 0x8a, 0x6c, 0xcf, 0x89, 0xc7, 0xb9, 0x5e, 0x5f, 0x9c, 0xae, 0x7f, 0x93, 0x60, 0x2f, 0x7d, + 0x38, 0x37, 0xce, 0x98, 0x1a, 0x71, 0xf1, 0x9f, 0x46, 0xdc, 0xfc, 0x7a, 0x0b, 0xb6, 0x2c, 0xea, + 0xca, 0x67, 0x50, 0x9e, 0x39, 0xd2, 0x81, 0xb1, 0xe8, 0x73, 0x86, 0x38, 0x04, 0xf5, 0xd1, 0x35, + 0xa0, 0xe8, 0xe2, 0x03, 0xec, 0x64, 0xbd, 0x47, 0xcf, 0x8d, 0xca, 0x70, 0xd4, 0x67, 0xab, 0x39, + 0x69, 0x81, 0xac, 0xe7, 0xe4, 0x0b, 0x64, 0x38, 0x4b, 0x04, 0x72, 0xef, 0x8a, 0xdc, 0x83, 0xea, + 0x5f, 0x7e, 0xf3, 0x38, 0x37, 0x7e, 0x91, 0xa6, 0x1e, 0xad, 0x45, 0x13, 0x4a, 0xef, 0x60, 0x3b, + 0xed, 0x38, 0xb5, 0xdc, 0xe8, 0x14, 0x43, 0xad, 0xaf, 0x62, 0x88, 0xd4, 0x6f, 0x00, 0x52, 0x2e, + 0x73, 0xb8, 0xa4, 0xae, 0x84, 0xa0, 0x3e, 0x5d, 0x41, 0x10, 0x79, 0xcf, 0xa1, 0x92, 0xb2, 0x95, + 0xdc, 0x28, 0x81, 0xab, 0x4f, 0xae, 0xc7, 0x93, 0xa4, 0xad, 0xb3, 0xcb, 0xb1, 0x26, 0x5d, 0x8d, + 0x35, 0xe9, 0xf7, 0x58, 0x93, 0xbe, 0x4f, 0xb4, 0xc2, 0xd5, 0x44, 0x2b, 0xfc, 0x9c, 0x68, 0x85, + 0xf7, 0xcf, 0x5d, 0x8f, 0xf5, 0xfa, 0x1d, 0xa3, 0x8b, 0x03, 0x93, 0xe7, 0x3a, 0x0a, 0x11, 0x1b, + 0x62, 0xf2, 0x39, 0xde, 0x98, 0x83, 0xa6, 0x79, 0x31, 0x7f, 0xae, 0xd9, 0x28, 0x42, 0xb4, 0x53, + 0x8e, 0xdf, 0xd9, 0xe3, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x43, 0x08, 0xd3, 0xd5, 0xcc, 0x07, + 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -788,9 +788,9 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { - // LendAsset defines a method for lending coins to the capital facility. - LendAsset(ctx context.Context, in *MsgLendAsset, opts ...grpc.CallOption) (*MsgLendAssetResponse, error) - // WithdrawAsset defines a method for withdrawing previously loaned coins from + // Supply moves tokens from user balance to the module balance for lending or collateral. + Supply(ctx context.Context, in *MsgSupply, opts ...grpc.CallOption) (*MsgSupplyResponse, error) + // WithdrawAsset defines a method for withdrawing previously supplied coins from // the capital facility. WithdrawAsset(ctx context.Context, in *MsgWithdrawAsset, opts ...grpc.CallOption) (*MsgWithdrawAssetResponse, error) // AddCollateral defines a method for users to enable selected uTokens @@ -817,9 +817,9 @@ func NewMsgClient(cc grpc1.ClientConn) MsgClient { return &msgClient{cc} } -func (c *msgClient) LendAsset(ctx context.Context, in *MsgLendAsset, opts ...grpc.CallOption) (*MsgLendAssetResponse, error) { - out := new(MsgLendAssetResponse) - err := c.cc.Invoke(ctx, "/umee.leverage.v1.Msg/LendAsset", in, out, opts...) +func (c *msgClient) Supply(ctx context.Context, in *MsgSupply, opts ...grpc.CallOption) (*MsgSupplyResponse, error) { + out := new(MsgSupplyResponse) + err := c.cc.Invoke(ctx, "/umee.leverage.v1.Msg/Supply", in, out, opts...) if err != nil { return nil, err } @@ -882,9 +882,9 @@ func (c *msgClient) Liquidate(ctx context.Context, in *MsgLiquidate, opts ...grp // MsgServer is the server API for Msg service. type MsgServer interface { - // LendAsset defines a method for lending coins to the capital facility. - LendAsset(context.Context, *MsgLendAsset) (*MsgLendAssetResponse, error) - // WithdrawAsset defines a method for withdrawing previously loaned coins from + // Supply moves tokens from user balance to the module balance for lending or collateral. + Supply(context.Context, *MsgSupply) (*MsgSupplyResponse, error) + // WithdrawAsset defines a method for withdrawing previously supplied coins from // the capital facility. WithdrawAsset(context.Context, *MsgWithdrawAsset) (*MsgWithdrawAssetResponse, error) // AddCollateral defines a method for users to enable selected uTokens @@ -907,8 +907,8 @@ type MsgServer interface { type UnimplementedMsgServer struct { } -func (*UnimplementedMsgServer) LendAsset(ctx context.Context, req *MsgLendAsset) (*MsgLendAssetResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method LendAsset not implemented") +func (*UnimplementedMsgServer) Supply(ctx context.Context, req *MsgSupply) (*MsgSupplyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Supply not implemented") } func (*UnimplementedMsgServer) WithdrawAsset(ctx context.Context, req *MsgWithdrawAsset) (*MsgWithdrawAssetResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method WithdrawAsset not implemented") @@ -933,20 +933,20 @@ func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) } -func _Msg_LendAsset_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgLendAsset) +func _Msg_Supply_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSupply) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).LendAsset(ctx, in) + return srv.(MsgServer).Supply(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/umee.leverage.v1.Msg/LendAsset", + FullMethod: "/umee.leverage.v1.Msg/Supply", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).LendAsset(ctx, req.(*MsgLendAsset)) + return srv.(MsgServer).Supply(ctx, req.(*MsgSupply)) } return interceptor(ctx, in, info, handler) } @@ -1064,8 +1064,8 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ HandlerType: (*MsgServer)(nil), Methods: []grpc.MethodDesc{ { - MethodName: "LendAsset", - Handler: _Msg_LendAsset_Handler, + MethodName: "Supply", + Handler: _Msg_Supply_Handler, }, { MethodName: "WithdrawAsset", @@ -1096,7 +1096,7 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ Metadata: "umee/leverage/v1/tx.proto", } -func (m *MsgLendAsset) Marshal() (dAtA []byte, err error) { +func (m *MsgSupply) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1106,12 +1106,12 @@ func (m *MsgLendAsset) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgLendAsset) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgSupply) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgLendAsset) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgSupply) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1126,10 +1126,10 @@ func (m *MsgLendAsset) MarshalToSizedBuffer(dAtA []byte) (int, error) { } i-- dAtA[i] = 0x12 - if len(m.Lender) > 0 { - i -= len(m.Lender) - copy(dAtA[i:], m.Lender) - i = encodeVarintTx(dAtA, i, uint64(len(m.Lender))) + if len(m.Supplier) > 0 { + i -= len(m.Supplier) + copy(dAtA[i:], m.Supplier) + i = encodeVarintTx(dAtA, i, uint64(len(m.Supplier))) i-- dAtA[i] = 0xa } @@ -1166,10 +1166,10 @@ func (m *MsgWithdrawAsset) MarshalToSizedBuffer(dAtA []byte) (int, error) { } i-- dAtA[i] = 0x12 - if len(m.Lender) > 0 { - i -= len(m.Lender) - copy(dAtA[i:], m.Lender) - i = encodeVarintTx(dAtA, i, uint64(len(m.Lender))) + if len(m.Supplier) > 0 { + i -= len(m.Supplier) + copy(dAtA[i:], m.Supplier) + i = encodeVarintTx(dAtA, i, uint64(len(m.Supplier))) i-- dAtA[i] = 0xa } @@ -1393,7 +1393,7 @@ func (m *MsgLiquidate) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgLendAssetResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgSupplyResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1403,12 +1403,12 @@ func (m *MsgLendAssetResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgLendAssetResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgSupplyResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgLendAssetResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgSupplyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1595,13 +1595,13 @@ func encodeVarintTx(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *MsgLendAsset) Size() (n int) { +func (m *MsgSupply) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.Lender) + l = len(m.Supplier) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -1616,7 +1616,7 @@ func (m *MsgWithdrawAsset) Size() (n int) { } var l int _ = l - l = len(m.Lender) + l = len(m.Supplier) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -1706,7 +1706,7 @@ func (m *MsgLiquidate) Size() (n int) { return n } -func (m *MsgLendAssetResponse) Size() (n int) { +func (m *MsgSupplyResponse) Size() (n int) { if m == nil { return 0 } @@ -1781,7 +1781,7 @@ func sovTx(x uint64) (n int) { func sozTx(x uint64) (n int) { return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *MsgLendAsset) Unmarshal(dAtA []byte) error { +func (m *MsgSupply) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1804,15 +1804,15 @@ func (m *MsgLendAsset) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgLendAsset: wiretype end group for non-group") + return fmt.Errorf("proto: MsgSupply: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgLendAsset: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgSupply: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Lender", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Supplier", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1840,7 +1840,7 @@ func (m *MsgLendAsset) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Lender = string(dAtA[iNdEx:postIndex]) + m.Supplier = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { @@ -1927,7 +1927,7 @@ func (m *MsgWithdrawAsset) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Lender", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Supplier", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1955,7 +1955,7 @@ func (m *MsgWithdrawAsset) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Lender = string(dAtA[iNdEx:postIndex]) + m.Supplier = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { @@ -2651,7 +2651,7 @@ func (m *MsgLiquidate) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgLendAssetResponse) Unmarshal(dAtA []byte) error { +func (m *MsgSupplyResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2674,10 +2674,10 @@ func (m *MsgLendAssetResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgLendAssetResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgSupplyResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgLendAssetResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgSupplyResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: