metoken

package
v6.1.0-rc1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 3, 2023 License: Apache-2.0 Imports: 36 Imported by: 0

README

meToken Module

Abstract

This document specifies the x/metoken module of the Umee chain.

meToken is a new Token that represents an Index composed of assets used for swaps and redemptions. It can be minted during the swap of the Index accepted assets and burned to redeem any Index accepted asset. Each Index will have a unique name for the meToken that represents it. Its price is determined by the average price of the assets in the Index.

The metoken module allows users to swap and redeem accepted assets for an Index meToken. The Index meToken will maintain the parity between underlying assets given a specific configuration. The module transfers part of the supplied assets to the leverage module in order to accrue interest.

The metoken module depends directly on x/leverage for supplying and withdrawing assets, x/oracle for assets prices and the cosmos x/bank module for balance updates (coins).

Contents

  1. Concepts
  2. State
  3. Queries
  4. Messages
  5. Update Registry Proposal
  6. Events
  7. Parameters
  8. EndBlock

Concepts

Accepted Assets

At the foundation of the metoken module is the Index Registry, which contains a list of Indexes with their meTokens, accepted assets and other parameters.

This list is controlled by the chain governance. Assets that are not in the index registry are not available for swapping or redeeming for the Index meToken.

Once an asset is added to an Index, it cannot be removed. However, its target_allocation can be changed to incentivize or disincentivize its presence in the Index.

Index Parameters

The Index will have the following parameters:

  • meToken denom: a denom of the meToken Index that will be given to user in exchange for accepted assets.
  • meToken max supply: the maximum amount of meTokens (in specific Index) that can be minted. A swap that requires to mint more meToken than this value will result in an error.
  • Fees: every fee is calculated and charged to the user in the asset that is used in the operation. The calculation will be explained below, the following values will be used as parameters for that calculation:
    • Min fee: the minimum fee to be charged to the user. The applied fee will tend to decrease down to this value, when the accepted asset is undersupplied in the index. It must be less than Balanced and Max fees. Valid values: [0-1].
    • Balanced fee: the fee to be charged to the user when the index is balanced. It must be greater than Min fee and lower than Max fee, it cannot be 0. Valid values: [0-1].
    • Max fee: the maximum fee to be charged to the user. The applied fee will tend to increase up to this value, when the accepted asset is oversupplied in the index. It must be greater than Min and Balanced fees. Valid values: [0-1].
  • Accepted Assets: a list where each asset will have the following parameters:
    • Asset denom.
    • Reserve portion: the portion of swapped assets that will be transferred to metoken module as reserves, and the minimum portion that will be taken from metoken module reserves when a redemption occurs. Valid values: [0-1].
    • Target allocation: the portion of an accepted asset the Index is targeting to have. The sum of target_allocation of every accepted asset in the Index should be equal to 1. Valid values: [0-1].
Dynamic meToken Price

Every meToken will have a dynamic price. It will be based on the underlying assets total value, divided by the amount of minted meTokens, and calculated for every operation. The formula for the price is as follows:

metoken_price = 
  (asset1_amount * asset1_price + asset2_amount * asset2_price + assetN_amount * assetN_price) / metoken_minted

As an example, using the following Index:
 - 2.5        WETH at price:      1858.5 USD
 - 6140       USDT at price:     0.99415 USD 
 - 1.75013446 WBTC at price: 28140.50585 USD
 - 6 minted meTokens
 
The price of meToken would be:
metoken_price = (2.5 * 1858.5 + 6140 * 0.99415 + 1.75013446 * 28140.50585) / 6
metoken_price = 10000 USD
Initial price

The initial price for the first transaction will be determined by the average price of the underlying assets, divided by the quantity of accepted assets in the Index, using the following formula:

metoken_price = (asset1_price + asset2_price + assetN_price) / N

As an example for an Index composed of:
 - USDC at price: 1.018 USD
 - USDT at price: 0.983 USD
 - IST  at price: 1.035 USD
 
The price of meToken for the initial swap would be:
metoken_price = (1.018 + 0.983 + 1.035) / 3
metoken_price = 1.012 USD
Swapping and Redeeming

Users have the following actions available to them:

  • Swap accepted asset for Index meToken. Every accepted asset can be swapped for the Index meToken. The exchange rate will be determined using prices from x/oracle module for the accepted assets and the Index meToken dynamic price. The user will need to pay a Dynamic Fee for the swap. The fee will be charged in the accepted asset the Index meToken is offered for.

    Index meToken amount needed for the swap will be minted and transferred to the user's account, while the accepted asset for the swap will be transferred to the leverage module pools and the metoken module reserves. The portion to be transferred to each one is determined by the Index Registry configuration of each accepted asset.

    In case the defined portion to transfer to the x/leverage is not possible, because of the leverage module max supply cap for a particular token, the remaining part will be transferred to x/metoken reserves.

  • Redeem Index meToken for accepted asset. Index meToken can be redeemed for every accepted asset. The exchange rate will be determined using prices from x/oracle module for the accepted assets and the Index meToken dynamic price. The user will need to pay a Dynamic Fee for the redemption. The fee will be charged in the accepted asset the Index meToken is redeemed for.

    Index meToken amount needed for the redemption will be withdrawn from the user's account and burned, while the chosen asset to redeem will be transferred from the leverage module pools and the metoken module reserves to the user's account. The portion to be withdrawn from each one is determined by the Index Registry configuration of each accepted asset.

    When it is not possible to withdraw the needed portion from the leverage module given its own constraints, the part taken from the reserves will increase in order to complete the redemption, if possible.

Derived Values

Some important quantities that govern the behavior of the metoken module are derived from a combination of parameters. The math and reasoning behind these values are presented below.

As a reminder, the following values are always available as a basis for calculations:

  • Account Token balances, available through the bank module.
  • Index parameters from the Index Registry.
  • Total reserves of any tokens, saved in metoken module reserve balance.
  • Total amount of any tokens transferred to the leverage module, stored in metoken module State.
  • The price of every underlying asset taken from oracle module.

The more complex derived values must use the values above as basis.

Dynamic Fee

The fee to be applied for the swap or the redemption will be dynamic and based on the deviation from the target_allocation of an asset and its current allocation in the Index. Every charged fee to the user will be transferred to the metoken module balance and the value will be added to the State. In that way it is possible to discriminate between the reserves, fees and interest saved on the metoken module balance. The formula for calculating the dynamic fee is as follows:

dynamic_fee = balanced_fee + [allocation_delta * (balanced_fee / 100)]

If the dynamic_fee is lower than min_fee   -> dynamic_fee = min_fee
If the dynamic_fee is greater than max_fee -> dynamic_fee = max_fee

where: 
allocation_delta for the swap = (current_allocation - target_allocation) / target_allocation
allocation_delta for the redemption = (target_allocation - current_allocation) / target_allocation

Example for the meUSD index, and the following fee and accepted assets:

- Fee:
  - Min: 0.001
  - Balanced: 0.2
  - Max: 0.5

- USDT:
  - reserve_portion: 0.2
  - target_allocation: 0.33333
- USDC: 
  - reserve_portion: 0.2
  - target_allocation: 0.33333
- IST: 
  - reserve_portion: 0.2
  - target_allocation: 0.33333
  
After several swaps the index has 1200 USDT, 760 USDC and 3000 IST. Total supply: 4960.
  
Prices:
 - USDT = 0.998 USD
 - USDC = 1.0   USD
 - IST  = 1.02  USD
 - meUSD_price = (1200 * 0.998 + 760 * 1.0 + 3000 * 1.02) / 4960 = 1.011612903

Calculations for swap:
- USDT allocation_delta: (0.24193 - 0.33333)/0.33333 = -0.2742027
- USDC allocation_delta: (0.15322 - 0.33333)/0.33333 = -0.5403354
- IST  allocation_delta: (0.60483 - 0.33333)/0.33333 =  0.8145081

- USDT fee: 0.2 - 0.2742027*0.2 = 0.14515
- USDC fee: 0.2 - 0.5403354*0.2 = 0.09193
- IST  fee: 0.2 + 0.8145081*0.2 = 0.36290

Following this values, let's simulate a swap. A user wants to buy meUSD for 10 USDT.

meUSD = 10 * (0.998 / 1.011612903) * (1 - 0.14515)
meUSD = 8.433465976

The user will receive 8.433465976 meUSD. 1.14515 USDT is the fee and 8.5485 USDT will be split 
between the reserves and the liquidity for the leverage module based on the reserve_portion.
6.8388 USDT will be transferred to the leverage module and 1.7097 USDT will be transferred to reserves.

Calculations for redemption:
- USDT allocation_delta: (0.33333 - 0.24193)/0.33333 =  0.2742027
- USDC allocation_delta: (0.33333 - 0.15322)/0.33333 =  0.5403354
- IST  allocation_delta: (0.33333 - 0.60483)/0.33333 = -0.8145081

- USDT fee: 0.2 + 0.2742027*0.2 = 0.25484
- USDC fee: 0.2 + 0.5403354*0.2 = 0.30806
- IST  fee: 0.2 - 0.8145081*0.2 = 0.03709

Following this values, let's simulate a redemption. A user wants to sell 20 meUSD for IST.

IST = 20 * (1.011612903 / 1.02) * (1 - 0.03709)
IST = 19.09984668

The user will receive 19.09984668 IST. 0.7357004428 IST will be the total saved fee. 20 meUSD will be taken from the 
user's account and burned.
The total value to be withdrawn is 19.83554712 IST and it will be split between the reserves and the liquidity from the
leverage module based on the reserve_portion.
15.8684377 IST will be taken from leverage module and 3.967109424 IST from the reserves.

Another example with an edge case where the min and max fee are used:

- Fee:
  - Min: 0.01
  - Balanced: 0.3
  - Max: 0.8

- USDT:
  - reserve_portion: 0.3
  - target_allocation: 0.25
- USDC: 
  - reserve_portion: 0.3
  - target_allocation: 0.25
- IST: 
  - reserve_portion: 0.3
  - target_allocation: 0.25
- MSK:
  - reserve_portion: 0.3 
  - target_allocation: 0.25
  
After several swaps the index has 3500 USDT, 100 USDC, 300 IST and 0 MSK. Total supply: 3900. 
  
Prices:
 - USDT = 0.998   USD
 - USDC = 0.99993 USD
 - IST  = 1.02    USD
 - MSK  = 1.0     USD
 - meUSD_price = (3500 * 0.998 + 100 * 0.99993 + 300 * 1.02 + 0 * 1.0) / 3900 = 0.9997417949

Calculations for swap:
- USDT allocation_delta: (0.89743 - 0.25)/0.25 =  2.58972
- USDC allocation_delta: (0.02564 - 0.25)/0.25 = -0.89744
- IST  allocation_delta: (0.07692 - 0.25)/0.25 = -0.69232
- MSK  allocation_delta: (0.0 - 0.25)/0.25     = -1.0

- USDT fee: 0.3 + 2.58972*0.3 = 1.07691 -> This exceedes the max fee (0.8). In this case the max fee will be used.
- USDC fee: 0.3 - 0.89744*0.3 = 0.03076
- IST  fee: 0.3 - 0.69232*0.3 = 0.09230
- MSK  fee: 0.3 - 1.0*0.3     = 0       -> This is below the min fee (0.01). For this swap the min fee will be applied.

Following this values, let's simulate a swap. A user wants to buy meUSD for 10 MSK.

meUSD = 10 * (1.0 / 0.9997417949) * (1 - 0.01)
meUSD = 9.902556891

The user will receive 9.902556891 meUSD. 0.1 MSK will be the total saved fee and 9.9 MSK will be splitted 
between the reserves and the liquidity for the leverage module based on the reserve_portion.
6.93 MSK will be transferred to the leverage module and 2.97 MSK will be transferred to reserves.

Calculations for redemption:
- USDT allocation_delta: (0.25 - 0.89743)/0.25 = -2.58972
- USDC allocation_delta: (0.25 - 0.02564)/0.25 =  0.8974358
- IST  allocation_delta: (0.25 - 0.07692)/0.25 =  0.69232
- MSK  allocation_delta: (0.25 - 0.0)/0.25     =  1.0

- USDT fee: 0.3 - 2.58972*0.3 = -0.47691 -> This is below the min fee (0.01) and also the fee can't be negative. For this swap the min fee will be applied.
- USDC fee: 0.3 + 0.89744*0.3 = 0.56923
- IST  fee: 0.3 + 0.69232(0.3 = 0.50769
- MSK  fee: 0.3 + 1.0*0.3     = 0.6      -> In this case the redeption is not possible since there is no MSK liquidity anyway.

Following this values, let's simulate a redemption. A user wants to sell 20 meUSD for USDC.

USDC = 20 * (0.9997417949 / 0.99993) * (1 - 0.56923)
USDC = 8.613778424

The user will receive 8.613778424 USDC. 11.38245721 USDC will be the total saved fee. 20 meUSD will be taken from the 
user's account and burned.
The total value to be withdrawn is 19.99623563 USDC and it will be splitted between the reserves and the liquidity from the
leverage module based on the reserve_portion.
13.99736494 USDC will be taken from leverage module and 5.99887069 USDC from the reserves.
Reserves

The metoken module will have its own reserves to stabilize the processing of the withdrawals. A portion of every swap will be transferred to the reserves and a percentage of every withdrawal will be taken from the reserves. This portion is determined by the parameters of every asset in the Index.

All the reserves will be saved to the metoken module balance along with all the fees and the claimed interest. The amount of fees for every asset will be saved to the metoken module State as well as the amount of the interests claimed from the leverage module. The reserves are equal to balance - fee - interest for every asset.

Reserves Re-balancing

The frequency of the Reserves Re-balancing will be determined by module parameter rebalancing_frequency. The workflow for every asset of each Index is as follows:

  1. Get the amount of Token transferred to the leverage module, stored in metoken module State.
  2. Get the amount of Token maintained in the metoken module balance and deduct it by the fee amount and the interests amount, both stored in metoken module State. The result is the amount of Token reserves.
  3. Check if the portion of reserves is below the desired and transfer the missing amount from leverage module to metoken reserves, or vice versa if required.
  4. Update next_rebalancing_time, stored in the metoken module State adding the rebalancing_frequency to the current block time.
Interest

Every supply of liquidity to leverage module will produce interests. The interest will be accruing based on the settings of the supplied Token in the Token Registry and the Supplying APY. Its usage will be decided in future iterations.

Claiming Interests

Every claim_interests_frequency a process that withdraws all the accrued interest of every asset supplied to the leverage module will be triggered. This process consists of the following steps:

  1. Get the amount of Token existing in the leverage module, stored in the leverage module balance for metoken module address and Token denom.
  2. Get the amount of Token transferred to the leverage module, stored in metoken module State.
  3. Calculate the delta 1) - 2), this will be the accrued interest.
  4. Withdraw accrued interest from leverage module.
  5. Update the claimed interest in the metoken module State.
  6. Update next_interest_claiming_time, stored in the metoken module State adding the claim_interests_frequency to the current block time.

State

The x/metoken module keeps the following objects in state:

  • Index Registry: 0x01 | index_name -> Index
  • Module Balances of every Index: 0x02 | metoken_denom -> Balance, where Balance is:
    • metoken_supply: total meToken Supply.
    • leveraged: transferred to leverage module Amount.
    • reserved: total metoken module reserves.
    • fees: total fees saved in reserves.
    • interests: total interest claimed from x/leverage.
  • Next Time (unix timestamp) for Reserves Re-balancing: 0x03 -> int64
  • Next Time (unix timestamp) for Claiming Interests: 0x04 -> int64

The following serialization methods are used unless otherwise stated:

  • sdk.Dec.Marshal() and sdk.Int.Marshal() for numeric types
  • cdc.Marshal and cdc.Unmarshal for gogoproto/types.Int64Value wrapper around int64

Queries

See (LINK TO BE ADDED) for list of supported queries.

Messages

See (LINK TO BE ADDED) for list of supported messages.

Update Registry Proposal

Update-Registry gov proposal will add the new index to index registry or update the existing index with new settings.

CLI
umeed tx gov submit-proposal [path-to-proposal-json] [flags]

Example:

umeed tx gov submit-proposal /path/to/proposal.json --from umee1..

# Note `authority` will be gov module account address in proposal.json
umeed q auth module-accounts -o json | jq '.accounts[] | select(.name=="gov") | .base_account.address'

where proposal.json contains:

{
  "messages": [
    {
      "@type": "/umeenetwork.umee.metoken.v1.MsgGovUpdateRegistry",
      "authority": "umee10d07y265gmmuvt4z0w9aw880jnsr700jg5w6jp",
      "title": "Update the meToken Index Registry",
      "description": "Add me/USD Index, Update me/EUR Index",
      "add_indexes": [
        {
          "metoken_denom": "me/USD",
          "metoken_max_supply": "2000000",
          "fee": {
            "min": "0.01",
            "balanced": "0.2",
            "max": "0.6"
          },
          "accepted_assets": [
            {
              "asset_denom": "USDT",
              "reserve_portion": "0.2",
              "total_allocation": "0.333"
            },
            {
              "asset_denom": "USDC",
              "reserve_portion": "0.2",
              "total_allocation": "0.334"
            },
            {
              "asset_denom": "IST",
              "reserve_portion": "0.2",
              "total_allocation": "0.333"
            }
          ]
        }
      ],
      "update_indexes": [
        {
          "metoken_denom": "me/EUR",
          "metoken_max_supply": "2000000",
          "fee": {
            "min": "0.001",
            "balanced": "0.3",
            "max": "0.9"
          },
          "accepted_assets": [
            {
              "asset_denom": "EURC",
              "reserve_portion": "0.3",
              "total_allocation": "0.333"
            }
          ]
        }
      ]
    }
  ],
  "metadata": "",
  "deposit": "100uumee"
}

Events

See (LINK TO BE ADDED) for list of supported events.

Params

See (LINK TO BE ADDED) for list of supported module params.

End Block

Every block, the metoken module runs the following steps in order:

  • Re-balance Reserves if at or after next_rebalancing_time.
  • Claim interests from the leverage module if at or after next_interest_claiming_time.

Documentation

Overview

Package metoken is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	// ModuleName defines the module name
	ModuleName = "metoken"

	// StoreKey defines the primary module store key
	StoreKey = ModuleName
)
View Source
const (
	// MeTokenPrefix defines the meToken denomination prefix for all meToken Indexes.
	MeTokenPrefix = "me/"
)

Variables

View Source
var (
	ErrInvalidLengthEvents        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowEvents          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupEvents = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthGenesis        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowGenesis          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthMetoken        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowMetoken          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupMetoken = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthQuery        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowQuery          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthTx        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTx          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (

	// ModuleCdc references the global x/metoken module codec. Note, the codec
	// should ONLY be used in certain instances of tests and for JSON encoding as
	// Amino is still used for that purpose.
	ModuleCdc = codec.NewAminoCodec(amino)
)

Functions

func ExponentFactor

func ExponentFactor(initialExponent, resultExponent uint32) (sdk.Dec, error)

ExponentFactor calculates the factor to multiply by which the assets with different exponents. If there is no such difference the result will be 1.

func IsMeToken

func IsMeToken(denom string) bool

IsMeToken detects the meToken prefix on a denom.

func Rate added in v6.1.0

func Rate(fromPrice, toPrice sdk.Dec, fromExponent, toExponent uint32) (sdk.Dec, error)

func RegisterInterfaces

func RegisterInterfaces(registry cdctypes.InterfaceRegistry)

func RegisterLegacyAminoCodec

func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino)

RegisterLegacyAminoCodec registers the necessary x/metoken interfaces and concrete types on the provided LegacyAmino codec. These types are used for Amino JSON serialization.

func RegisterMsgServer

func RegisterMsgServer(s grpc1.Server, srv MsgServer)

func RegisterQueryHandler

func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterQueryHandler registers the http handlers for service Query to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterQueryHandlerClient

func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error

RegisterQueryHandlerClient registers the http handlers for service Query to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "QueryClient" to call the correct interceptors.

func RegisterQueryHandlerFromEndpoint

func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterQueryHandlerServer

func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error

RegisterQueryHandlerServer registers the http handlers for service Query to "mux". UnaryRPC :call QueryServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead.

func RegisterQueryServer

func RegisterQueryServer(s grpc1.Server, srv QueryServer)

Types

type AcceptedAsset

type AcceptedAsset struct {
	// Denom is the denomination of the underlying asset. Must be the base
	// denom as registered in the Bank module (so IBC denom for IBC tokens).
	Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"`
	// Reserve portion is the portion of swapped assets that will be kept in the metoken module as reserves,
	// instead of supplied to the leverage module. It is also the
	// portion that will be taken from metoken module reserves when a redemption occurs.
	// Valid values: 0-1.
	ReservePortion github_com_cosmos_cosmos_sdk_types.Dec `` /* 143-byte string literal not displayed */
	// Target allocation is the portion of an accepted asset the Index is targeting to have. The sum of
	// target allocations of every accepted asset in the Index should be equal to 1.
	// Valid values: 0-1.
	TargetAllocation github_com_cosmos_cosmos_sdk_types.Dec `` /* 149-byte string literal not displayed */
}

AcceptedAsset is an asset that is accepted to participate in the Index's swaps and redemptions, along with its metadata and parameters

func NewAcceptedAsset

func NewAcceptedAsset(denom string, reservePortion, targetAllocation sdk.Dec) AcceptedAsset

NewAcceptedAsset creates a new AcceptedAsset object

func (*AcceptedAsset) Descriptor

func (*AcceptedAsset) Descriptor() ([]byte, []int)

func (*AcceptedAsset) Equal

func (this *AcceptedAsset) Equal(that interface{}) bool

func (*AcceptedAsset) GetDenom

func (m *AcceptedAsset) GetDenom() string

func (*AcceptedAsset) Marshal

func (m *AcceptedAsset) Marshal() (dAtA []byte, err error)

func (*AcceptedAsset) MarshalTo

func (m *AcceptedAsset) MarshalTo(dAtA []byte) (int, error)

func (*AcceptedAsset) MarshalToSizedBuffer

func (m *AcceptedAsset) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*AcceptedAsset) ProtoMessage

func (*AcceptedAsset) ProtoMessage()

func (*AcceptedAsset) Reset

func (m *AcceptedAsset) Reset()

func (*AcceptedAsset) Size

func (m *AcceptedAsset) Size() (n int)

func (*AcceptedAsset) String

func (m *AcceptedAsset) String() string

func (*AcceptedAsset) Unmarshal

func (m *AcceptedAsset) Unmarshal(dAtA []byte) error

func (AcceptedAsset) Validate

func (aa AcceptedAsset) Validate() error

Validate perform basic validation of the AcceptedAsset

func (*AcceptedAsset) XXX_DiscardUnknown

func (m *AcceptedAsset) XXX_DiscardUnknown()

func (*AcceptedAsset) XXX_Marshal

func (m *AcceptedAsset) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*AcceptedAsset) XXX_Merge

func (m *AcceptedAsset) XXX_Merge(src proto.Message)

func (*AcceptedAsset) XXX_Size

func (m *AcceptedAsset) XXX_Size() int

func (*AcceptedAsset) XXX_Unmarshal

func (m *AcceptedAsset) XXX_Unmarshal(b []byte) error

type AssetBalance

type AssetBalance struct {
	Denom     string                `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"`
	Leveraged cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=leveraged,proto3,customtype=cosmossdk.io/math.Int" json:"leveraged"`
	Reserved  cosmossdk_io_math.Int `protobuf:"bytes,3,opt,name=reserved,proto3,customtype=cosmossdk.io/math.Int" json:"reserved"`
	Fees      cosmossdk_io_math.Int `protobuf:"bytes,4,opt,name=fees,proto3,customtype=cosmossdk.io/math.Int" json:"fees"`
	Interest  cosmossdk_io_math.Int `protobuf:"bytes,5,opt,name=interest,proto3,customtype=cosmossdk.io/math.Int" json:"interest"`
}

AssetBalance tracks how much of a single asset is held in leverage, reserves, fees and interest account.

func NewAssetBalance

func NewAssetBalance(denom string, inLeverage, inReserves, inFees, inInterest sdkmath.Int) AssetBalance

NewAssetBalance creates a new AssetBalance object.

func NewZeroAssetBalance

func NewZeroAssetBalance(denom string) AssetBalance

NewZeroAssetBalance creates a new AssetBalance object with all balances in zero.

func (AssetBalance) AvailableSupply

func (ab AssetBalance) AvailableSupply() sdkmath.Int

AvailableSupply returns reserved plus leveraged

func (*AssetBalance) Descriptor

func (*AssetBalance) Descriptor() ([]byte, []int)

func (*AssetBalance) GetDenom

func (m *AssetBalance) GetDenom() string

func (*AssetBalance) Marshal

func (m *AssetBalance) Marshal() (dAtA []byte, err error)

func (*AssetBalance) MarshalTo

func (m *AssetBalance) MarshalTo(dAtA []byte) (int, error)

func (*AssetBalance) MarshalToSizedBuffer

func (m *AssetBalance) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*AssetBalance) ProtoMessage

func (*AssetBalance) ProtoMessage()

func (*AssetBalance) Reset

func (m *AssetBalance) Reset()

func (*AssetBalance) Size

func (m *AssetBalance) Size() (n int)

func (*AssetBalance) String

func (m *AssetBalance) String() string

func (*AssetBalance) Unmarshal

func (m *AssetBalance) Unmarshal(dAtA []byte) error

func (AssetBalance) Validate

func (ab AssetBalance) Validate() error

Validate perform basic validation of the AssetBalance

func (*AssetBalance) XXX_DiscardUnknown

func (m *AssetBalance) XXX_DiscardUnknown()

func (*AssetBalance) XXX_Marshal

func (m *AssetBalance) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*AssetBalance) XXX_Merge

func (m *AssetBalance) XXX_Merge(src proto.Message)

func (*AssetBalance) XXX_Size

func (m *AssetBalance) XXX_Size() int

func (*AssetBalance) XXX_Unmarshal

func (m *AssetBalance) XXX_Unmarshal(b []byte) error

type AssetPrice

type AssetPrice struct {
	BaseDenom   string `protobuf:"bytes,1,opt,name=base_denom,json=baseDenom,proto3" json:"base_denom,omitempty"`
	SymbolDenom string `protobuf:"bytes,2,opt,name=symbol_denom,json=symbolDenom,proto3" json:"symbol_denom,omitempty"`
	// Price in USD of one unit of asset, expressed in decimals.
	Price github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=price,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"price"`
	// Exponent is the power of ten by which to multiply, in order to convert
	// an amount of the asset for the exchange operations.
	Exponent uint32 `protobuf:"varint,4,opt,name=exponent,proto3" json:"exponent,omitempty"`
	// SwapRate used for exchange calculations asset -> meToken.
	SwapRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=swap_rate,json=swapRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"swap_rate"`
	// RedeemRate used for exchange calculations meToken -> asset.
	RedeemRate github_com_cosmos_cosmos_sdk_types.Dec `` /* 131-byte string literal not displayed */
}

AssetPrice information related to the index operations.

func (*AssetPrice) Descriptor

func (*AssetPrice) Descriptor() ([]byte, []int)

func (*AssetPrice) Equal

func (this *AssetPrice) Equal(that interface{}) bool

func (*AssetPrice) GetBaseDenom

func (m *AssetPrice) GetBaseDenom() string

func (*AssetPrice) GetExponent

func (m *AssetPrice) GetExponent() uint32

func (*AssetPrice) GetSymbolDenom

func (m *AssetPrice) GetSymbolDenom() string

func (*AssetPrice) Marshal

func (m *AssetPrice) Marshal() (dAtA []byte, err error)

func (*AssetPrice) MarshalTo

func (m *AssetPrice) MarshalTo(dAtA []byte) (int, error)

func (*AssetPrice) MarshalToSizedBuffer

func (m *AssetPrice) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*AssetPrice) ProtoMessage

func (*AssetPrice) ProtoMessage()

func (*AssetPrice) Reset

func (m *AssetPrice) Reset()

func (*AssetPrice) Size

func (m *AssetPrice) Size() (n int)

func (*AssetPrice) String

func (m *AssetPrice) String() string

func (*AssetPrice) Unmarshal

func (m *AssetPrice) Unmarshal(dAtA []byte) error

func (*AssetPrice) XXX_DiscardUnknown

func (m *AssetPrice) XXX_DiscardUnknown()

func (*AssetPrice) XXX_Marshal

func (m *AssetPrice) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*AssetPrice) XXX_Merge

func (m *AssetPrice) XXX_Merge(src proto.Message)

func (*AssetPrice) XXX_Size

func (m *AssetPrice) XXX_Size() int

func (*AssetPrice) XXX_Unmarshal

func (m *AssetPrice) XXX_Unmarshal(b []byte) error

type BankKeeper

type BankKeeper interface {
	MintCoins(ctx sdk.Context, moduleName string, amounts sdk.Coins) error
	BurnCoins(ctx sdk.Context, moduleName string, amounts sdk.Coins) error
	SendCoinsFromModuleToAccount(
		ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins,
	) error
	SendCoinsFromAccountToModule(
		ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins,
	) error
}

BankKeeper defines the expected x/bank keeper interface.

type EventInterestClaim

type EventInterestClaim struct {
	// The denom and amount of successfully claimed interest
	ClaimedAsset []types.Coin `protobuf:"bytes,1,rep,name=claimed_asset,json=claimedAsset,proto3" json:"claimed_asset"`
}

EventInterestClaim is emitted when the accrued interest was claimed from x/leverage

func (*EventInterestClaim) Descriptor

func (*EventInterestClaim) Descriptor() ([]byte, []int)

func (*EventInterestClaim) Marshal

func (m *EventInterestClaim) Marshal() (dAtA []byte, err error)

func (*EventInterestClaim) MarshalTo

func (m *EventInterestClaim) MarshalTo(dAtA []byte) (int, error)

func (*EventInterestClaim) MarshalToSizedBuffer

func (m *EventInterestClaim) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*EventInterestClaim) ProtoMessage

func (*EventInterestClaim) ProtoMessage()

func (*EventInterestClaim) Reset

func (m *EventInterestClaim) Reset()

func (*EventInterestClaim) Size

func (m *EventInterestClaim) Size() (n int)

func (*EventInterestClaim) String

func (m *EventInterestClaim) String() string

func (*EventInterestClaim) Unmarshal

func (m *EventInterestClaim) Unmarshal(dAtA []byte) error

func (*EventInterestClaim) XXX_DiscardUnknown

func (m *EventInterestClaim) XXX_DiscardUnknown()

func (*EventInterestClaim) XXX_Marshal

func (m *EventInterestClaim) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*EventInterestClaim) XXX_Merge

func (m *EventInterestClaim) XXX_Merge(src proto.Message)

func (*EventInterestClaim) XXX_Size

func (m *EventInterestClaim) XXX_Size() int

func (*EventInterestClaim) XXX_Unmarshal

func (m *EventInterestClaim) XXX_Unmarshal(b []byte) error

type EventRebalancing

type EventRebalancing struct {
	// RebalancingResults of every asset in every Index.
	Results []RebalancingResult `protobuf:"bytes,1,rep,name=results,proto3" json:"results"`
}

EventRebalancing is emitted when a reserve re-balancing occurs.

func (*EventRebalancing) Descriptor

func (*EventRebalancing) Descriptor() ([]byte, []int)

func (*EventRebalancing) Marshal

func (m *EventRebalancing) Marshal() (dAtA []byte, err error)

func (*EventRebalancing) MarshalTo

func (m *EventRebalancing) MarshalTo(dAtA []byte) (int, error)

func (*EventRebalancing) MarshalToSizedBuffer

func (m *EventRebalancing) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*EventRebalancing) ProtoMessage

func (*EventRebalancing) ProtoMessage()

func (*EventRebalancing) Reset

func (m *EventRebalancing) Reset()

func (*EventRebalancing) Size

func (m *EventRebalancing) Size() (n int)

func (*EventRebalancing) String

func (m *EventRebalancing) String() string

func (*EventRebalancing) Unmarshal

func (m *EventRebalancing) Unmarshal(dAtA []byte) error

func (*EventRebalancing) XXX_DiscardUnknown

func (m *EventRebalancing) XXX_DiscardUnknown()

func (*EventRebalancing) XXX_Marshal

func (m *EventRebalancing) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*EventRebalancing) XXX_Merge

func (m *EventRebalancing) XXX_Merge(src proto.Message)

func (*EventRebalancing) XXX_Size

func (m *EventRebalancing) XXX_Size() int

func (*EventRebalancing) XXX_Unmarshal

func (m *EventRebalancing) XXX_Unmarshal(b []byte) error

type EventRedeem

type EventRedeem struct {
	// Asset recipient bech32 address.
	Recipient string `protobuf:"bytes,1,opt,name=recipient,proto3" json:"recipient,omitempty"`
	// meToken provided for the redemption.
	Metoken types.Coin `protobuf:"bytes,2,opt,name=metoken,proto3" json:"metoken"`
	// Asset received by the recipient in exchange for the provided meToken.
	Asset types.Coin `protobuf:"bytes,3,opt,name=asset,proto3" json:"asset"`
	// Fee provided for the redemption.
	Fee types.Coin `protobuf:"bytes,4,opt,name=fee,proto3" json:"fee"`
}

EventRedeem is emitted on Msg/Redeem

func (*EventRedeem) Descriptor

func (*EventRedeem) Descriptor() ([]byte, []int)

func (*EventRedeem) Marshal

func (m *EventRedeem) Marshal() (dAtA []byte, err error)

func (*EventRedeem) MarshalTo

func (m *EventRedeem) MarshalTo(dAtA []byte) (int, error)

func (*EventRedeem) MarshalToSizedBuffer

func (m *EventRedeem) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*EventRedeem) ProtoMessage

func (*EventRedeem) ProtoMessage()

func (*EventRedeem) Reset

func (m *EventRedeem) Reset()

func (*EventRedeem) Size

func (m *EventRedeem) Size() (n int)

func (*EventRedeem) String

func (m *EventRedeem) String() string

func (*EventRedeem) Unmarshal

func (m *EventRedeem) Unmarshal(dAtA []byte) error

func (*EventRedeem) XXX_DiscardUnknown

func (m *EventRedeem) XXX_DiscardUnknown()

func (*EventRedeem) XXX_Marshal

func (m *EventRedeem) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*EventRedeem) XXX_Merge

func (m *EventRedeem) XXX_Merge(src proto.Message)

func (*EventRedeem) XXX_Size

func (m *EventRedeem) XXX_Size() int

func (*EventRedeem) XXX_Unmarshal

func (m *EventRedeem) XXX_Unmarshal(b []byte) error

type EventSwap

type EventSwap struct {
	// meToken recipient bech32 address.
	Recipient string `protobuf:"bytes,1,opt,name=recipient,proto3" json:"recipient,omitempty"`
	// Asset provided for the swap.
	Asset types.Coin `protobuf:"bytes,2,opt,name=asset,proto3" json:"asset"`
	// meToken received by the recipient in exchange for the provided asset.
	Metoken types.Coin `protobuf:"bytes,3,opt,name=metoken,proto3" json:"metoken"`
	// Fee provided for the swap.
	Fee types.Coin `protobuf:"bytes,4,opt,name=fee,proto3" json:"fee"`
}

EventSwap is emitted on Msg/Swap

func (*EventSwap) Descriptor

func (*EventSwap) Descriptor() ([]byte, []int)

func (*EventSwap) Marshal

func (m *EventSwap) Marshal() (dAtA []byte, err error)

func (*EventSwap) MarshalTo

func (m *EventSwap) MarshalTo(dAtA []byte) (int, error)

func (*EventSwap) MarshalToSizedBuffer

func (m *EventSwap) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*EventSwap) ProtoMessage

func (*EventSwap) ProtoMessage()

func (*EventSwap) Reset

func (m *EventSwap) Reset()

func (*EventSwap) Size

func (m *EventSwap) Size() (n int)

func (*EventSwap) String

func (m *EventSwap) String() string

func (*EventSwap) Unmarshal

func (m *EventSwap) Unmarshal(dAtA []byte) error

func (*EventSwap) XXX_DiscardUnknown

func (m *EventSwap) XXX_DiscardUnknown()

func (*EventSwap) XXX_Marshal

func (m *EventSwap) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*EventSwap) XXX_Merge

func (m *EventSwap) XXX_Merge(src proto.Message)

func (*EventSwap) XXX_Size

func (m *EventSwap) XXX_Size() int

func (*EventSwap) XXX_Unmarshal

func (m *EventSwap) XXX_Unmarshal(b []byte) error

type Fee

type Fee struct {
	// Min fee is the minimum fee to be charged to the user. The applied fee will tend to decrease down to this value,
	// when the accepted asset is undersupplied in the index. It must be less than Balanced and Max fees.
	// Valid values: 0-1.
	MinFee github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=min_fee,json=minFee,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"min_fee"`
	// Balanced fee is the fee to be charged to the user when the index is balanced. It must be greater than min_fee and
	// lower than max_fee
	// Valid values: 0-1.
	BalancedFee github_com_cosmos_cosmos_sdk_types.Dec `` /* 134-byte string literal not displayed */
	// Max fee is the maximum fee to be charged to the user. The applied fee will tend to increase up to this value,
	// when the accepted asset is oversupplied in the index. It must be greater than Min and Balanced fee.
	// Valid values: 0-1.
	MaxFee github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=max_fee,json=maxFee,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"max_fee"`
}

Fee are the parameters used for the calculation of the fee to be applied for swaps and redemptions and charged to the user. The usage of these parameters is explained here: https://github.com/umee-network/umee/tree/main/x/metoken#dynamic-fee

func NewFee

func NewFee(minFee, balancedFee, maxFee sdk.Dec) Fee

NewFee creates a new Fee object

func (Fee) CalculateFee

func (f Fee) CalculateFee(allocationDeviation sdk.Dec) sdk.Dec

CalculateFee based on its settings and allocation deviation.

func (*Fee) Descriptor

func (*Fee) Descriptor() ([]byte, []int)

func (*Fee) Equal

func (this *Fee) Equal(that interface{}) bool

func (*Fee) Marshal

func (m *Fee) Marshal() (dAtA []byte, err error)

func (*Fee) MarshalTo

func (m *Fee) MarshalTo(dAtA []byte) (int, error)

func (*Fee) MarshalToSizedBuffer

func (m *Fee) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Fee) ProtoMessage

func (*Fee) ProtoMessage()

func (*Fee) Reset

func (m *Fee) Reset()

func (*Fee) Size

func (m *Fee) Size() (n int)

func (*Fee) String

func (m *Fee) String() string

func (*Fee) Unmarshal

func (m *Fee) Unmarshal(dAtA []byte) error

func (Fee) Validate

func (f Fee) Validate() error

Validate perform basic validation of the Fee

func (*Fee) XXX_DiscardUnknown

func (m *Fee) XXX_DiscardUnknown()

func (*Fee) XXX_Marshal

func (m *Fee) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Fee) XXX_Merge

func (m *Fee) XXX_Merge(src proto.Message)

func (*Fee) XXX_Size

func (m *Fee) XXX_Size() int

func (*Fee) XXX_Unmarshal

func (m *Fee) XXX_Unmarshal(b []byte) error

type GenesisState

type GenesisState struct {
	Params                Params          `protobuf:"bytes,1,opt,name=params,proto3" json:"params"`
	Registry              []Index         `protobuf:"bytes,2,rep,name=registry,proto3" json:"registry"`
	Balances              []IndexBalances `protobuf:"bytes,3,rep,name=balances,proto3" json:"balances"`
	NextRebalancingTime   time.Time       `protobuf:"bytes,4,opt,name=next_rebalancing_time,json=nextRebalancingTime,proto3,stdtime" json:"next_rebalancing_time"`
	NextInterestClaimTime time.Time       `` /* 126-byte string literal not displayed */
}

GenesisState defines the x/metoken module's genesis state.

func DefaultGenesisState

func DefaultGenesisState() *GenesisState

DefaultGenesisState creates a new default GenesisState object

func NewGenesisState

func NewGenesisState(
	params Params,
	registry []Index,
	balances []IndexBalances,
	nextRebalancingTime time.Time,
	nextInterestClaimTime time.Time,
) *GenesisState

NewGenesisState creates a new GenesisState object

func (*GenesisState) Descriptor

func (*GenesisState) Descriptor() ([]byte, []int)

func (*GenesisState) GetBalances

func (m *GenesisState) GetBalances() []IndexBalances

func (*GenesisState) GetNextInterestClaimTime

func (m *GenesisState) GetNextInterestClaimTime() time.Time

func (*GenesisState) GetNextRebalancingTime

func (m *GenesisState) GetNextRebalancingTime() time.Time

func (*GenesisState) GetParams

func (m *GenesisState) GetParams() Params

func (*GenesisState) GetRegistry

func (m *GenesisState) GetRegistry() []Index

func (*GenesisState) Marshal

func (m *GenesisState) Marshal() (dAtA []byte, err error)

func (*GenesisState) MarshalTo

func (m *GenesisState) MarshalTo(dAtA []byte) (int, error)

func (*GenesisState) MarshalToSizedBuffer

func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*GenesisState) ProtoMessage

func (*GenesisState) ProtoMessage()

func (*GenesisState) Reset

func (m *GenesisState) Reset()

func (*GenesisState) Size

func (m *GenesisState) Size() (n int)

func (*GenesisState) String

func (m *GenesisState) String() string

func (*GenesisState) Unmarshal

func (m *GenesisState) Unmarshal(dAtA []byte) error

func (GenesisState) Validate

func (gs GenesisState) Validate() error

Validate perform basic validation of the GenesisState

func (*GenesisState) XXX_DiscardUnknown

func (m *GenesisState) XXX_DiscardUnknown()

func (*GenesisState) XXX_Marshal

func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GenesisState) XXX_Merge

func (m *GenesisState) XXX_Merge(src proto.Message)

func (*GenesisState) XXX_Size

func (m *GenesisState) XXX_Size() int

func (*GenesisState) XXX_Unmarshal

func (m *GenesisState) XXX_Unmarshal(b []byte) error

type Index

type Index struct {
	// Denom is the denomination of the Index's meToken denom that will be given to user in exchange of accepted
	// assets.
	Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"`
	// MaxSupply is the maximum amount of Index's meTokens can be minted.
	// A swap that requires to mint more Index's meToken than this value will result in an error.
	// Must be a non negative value. 0 means that there is no limit.
	MaxSupply cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=max_supply,json=maxSupply,proto3,customtype=cosmossdk.io/math.Int" json:"max_supply"`
	// Exponent is the power of ten by which to multiply, in order to convert
	// an amount of the meToken for the exchange operations.
	// Valid value: must be the same as the oracle.Denom.exponent.
	Exponent uint32 `protobuf:"varint,3,opt,name=exponent,proto3" json:"exponent,omitempty"`
	// Fee contains fee parameters used for swap and redemption fee calculations for all underlying
	// assets in this index.
	Fee Fee `protobuf:"bytes,4,opt,name=fee,proto3" json:"fee"`
	// Accepted Assets is the list of underlying Tokens that can be swapped and redeemed for the Index's meToken,
	// along with their token-specific parameters.
	AcceptedAssets []AcceptedAsset `protobuf:"bytes,5,rep,name=accepted_assets,json=acceptedAssets,proto3" json:"accepted_assets"`
}

Index defines an index of assets that are allowed to swap and redeem for the Index's meToken, along with its metadata and parameters.

func NewIndex

func NewIndex(denom string, maxSupply sdkmath.Int, exponent uint32, fee Fee, acceptedAssets []AcceptedAsset) Index

NewIndex creates a new Index object

func (Index) AcceptedAsset

func (i Index) AcceptedAsset(denom string) (AcceptedAsset, int)

AcceptedAsset returns an accepted asset and its index in the list, given a specific denom. If it isn't present, returns -1.

func (*Index) Descriptor

func (*Index) Descriptor() ([]byte, []int)

func (*Index) Equal

func (this *Index) Equal(that interface{}) bool

func (*Index) GetAcceptedAssets

func (m *Index) GetAcceptedAssets() []AcceptedAsset

func (*Index) GetDenom

func (m *Index) GetDenom() string

func (*Index) GetExponent

func (m *Index) GetExponent() uint32

func (*Index) GetFee

func (m *Index) GetFee() Fee

func (Index) HasAcceptedAsset

func (i Index) HasAcceptedAsset(denom string) bool

HasAcceptedAsset returns true if an accepted asset is present in the index. Otherwise returns false.

func (*Index) Marshal

func (m *Index) Marshal() (dAtA []byte, err error)

func (*Index) MarshalTo

func (m *Index) MarshalTo(dAtA []byte) (int, error)

func (*Index) MarshalToSizedBuffer

func (m *Index) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Index) ProtoMessage

func (*Index) ProtoMessage()

func (*Index) Reset

func (m *Index) Reset()

func (*Index) SetAcceptedAsset

func (i *Index) SetAcceptedAsset(acceptedAsset AcceptedAsset)

SetAcceptedAsset overrides an accepted asset if exists in the list, otherwise add it to the list.

func (*Index) Size

func (m *Index) Size() (n int)

func (*Index) String

func (m *Index) String() string

func (*Index) Unmarshal

func (m *Index) Unmarshal(dAtA []byte) error

func (Index) Validate

func (i Index) Validate() error

Validate perform basic validation of the Index

func (*Index) XXX_DiscardUnknown

func (m *Index) XXX_DiscardUnknown()

func (*Index) XXX_Marshal

func (m *Index) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Index) XXX_Merge

func (m *Index) XXX_Merge(src proto.Message)

func (*Index) XXX_Size

func (m *Index) XXX_Size() int

func (*Index) XXX_Unmarshal

func (m *Index) XXX_Unmarshal(b []byte) error

type IndexBalances

type IndexBalances struct {
	MetokenSupply types.Coin     `protobuf:"bytes,1,opt,name=metoken_supply,json=metokenSupply,proto3" json:"metoken_supply"`
	AssetBalances []AssetBalance `protobuf:"bytes,2,rep,name=asset_balances,json=assetBalances,proto3" json:"asset_balances"`
}

IndexBalances is the state of an Index, containing its meToken supply and all underlying asset balances.

func NewIndexBalances

func NewIndexBalances(meTokenSupply sdk.Coin, assetBalances []AssetBalance) IndexBalances

NewIndexBalances creates a new IndexBalances object.

func (IndexBalances) AssetBalance

func (ib IndexBalances) AssetBalance(denom string) (AssetBalance, int)

AssetBalance returns an asset balance and its index from balances, given a specific denom. If it isn't present, -1 as index.

func (*IndexBalances) Descriptor

func (*IndexBalances) Descriptor() ([]byte, []int)

func (*IndexBalances) GetAssetBalances

func (m *IndexBalances) GetAssetBalances() []AssetBalance

func (*IndexBalances) GetMetokenSupply

func (m *IndexBalances) GetMetokenSupply() types.Coin

func (*IndexBalances) Marshal

func (m *IndexBalances) Marshal() (dAtA []byte, err error)

func (*IndexBalances) MarshalTo

func (m *IndexBalances) MarshalTo(dAtA []byte) (int, error)

func (*IndexBalances) MarshalToSizedBuffer

func (m *IndexBalances) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*IndexBalances) ProtoMessage

func (*IndexBalances) ProtoMessage()

func (*IndexBalances) Reset

func (m *IndexBalances) Reset()

func (*IndexBalances) SetAssetBalance

func (ib *IndexBalances) SetAssetBalance(balance AssetBalance)

SetAssetBalance overrides an asset balance if exists in the list, otherwise add it to the list.

func (*IndexBalances) Size

func (m *IndexBalances) Size() (n int)

func (*IndexBalances) String

func (m *IndexBalances) String() string

func (*IndexBalances) Unmarshal

func (m *IndexBalances) Unmarshal(dAtA []byte) error

func (IndexBalances) Validate

func (ib IndexBalances) Validate() error

Validate perform basic validation of the IndexBalances

func (*IndexBalances) XXX_DiscardUnknown

func (m *IndexBalances) XXX_DiscardUnknown()

func (*IndexBalances) XXX_Marshal

func (m *IndexBalances) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*IndexBalances) XXX_Merge

func (m *IndexBalances) XXX_Merge(src proto.Message)

func (*IndexBalances) XXX_Size

func (m *IndexBalances) XXX_Size() int

func (*IndexBalances) XXX_Unmarshal

func (m *IndexBalances) XXX_Unmarshal(b []byte) error

type IndexPrices

type IndexPrices struct {
	// meToken denom.
	Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"`
	// Price in USD of one unit of meToken, expressed in decimals.
	Price github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=price,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"price"`
	// Exponent is the power of ten by which to multiply, in order to convert
	// an amount of the meToken for the exchange operations.
	Exponent uint32       `protobuf:"varint,3,opt,name=exponent,proto3" json:"exponent,omitempty"`
	Assets   []AssetPrice `protobuf:"bytes,4,rep,name=assets,proto3" json:"assets"`
}

IndexPrices provides meToken price related index information.

func EmptyIndexPrices

func EmptyIndexPrices(index Index) IndexPrices

func (*IndexPrices) Descriptor

func (*IndexPrices) Descriptor() ([]byte, []int)

func (*IndexPrices) Equal

func (this *IndexPrices) Equal(that interface{}) bool

func (*IndexPrices) GetAssets

func (m *IndexPrices) GetAssets() []AssetPrice

func (*IndexPrices) GetDenom

func (m *IndexPrices) GetDenom() string

func (*IndexPrices) GetExponent

func (m *IndexPrices) GetExponent() uint32

func (*IndexPrices) Marshal

func (m *IndexPrices) Marshal() (dAtA []byte, err error)

func (*IndexPrices) MarshalTo

func (m *IndexPrices) MarshalTo(dAtA []byte) (int, error)

func (*IndexPrices) MarshalToSizedBuffer

func (m *IndexPrices) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (IndexPrices) PriceByBaseDenom

func (ip IndexPrices) PriceByBaseDenom(denom string) (AssetPrice, error)

PriceByBaseDenom returns a AssetPrice given a specific base_denom.

func (*IndexPrices) ProtoMessage

func (*IndexPrices) ProtoMessage()

func (IndexPrices) RedeemRate

func (ip IndexPrices) RedeemRate(from sdk.Coin, to string) (sdkmath.Int, error)

RedeemRate converts meToken to an asset applying exchange_rate and normalizing the exponent.

func (*IndexPrices) Reset

func (m *IndexPrices) Reset()

func (*IndexPrices) SetPrice

func (ip *IndexPrices) SetPrice(price AssetPrice)

SetPrice to the IndexPrices.

func (*IndexPrices) Size

func (m *IndexPrices) Size() (n int)

func (*IndexPrices) String

func (m *IndexPrices) String() string

func (IndexPrices) SwapRate

func (ip IndexPrices) SwapRate(from sdk.Coin) (sdkmath.Int, error)

SwapRate converts an asset to meToken applying exchange_rate and normalizing the exponent.

func (*IndexPrices) Unmarshal

func (m *IndexPrices) Unmarshal(dAtA []byte) error

func (*IndexPrices) XXX_DiscardUnknown

func (m *IndexPrices) XXX_DiscardUnknown()

func (*IndexPrices) XXX_Marshal

func (m *IndexPrices) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*IndexPrices) XXX_Merge

func (m *IndexPrices) XXX_Merge(src proto.Message)

func (*IndexPrices) XXX_Size

func (m *IndexPrices) XXX_Size() int

func (*IndexPrices) XXX_Unmarshal

func (m *IndexPrices) XXX_Unmarshal(b []byte) error

type LeverageKeeper

type LeverageKeeper interface {
	GetTokenSettings(ctx sdk.Context, denom string) (ltypes.Token, error)
	ToUToken(ctx sdk.Context, token sdk.Coin) (sdk.Coin, error)
	ToToken(ctx sdk.Context, uToken sdk.Coin) (sdk.Coin, error)
	SupplyFromModule(ctx sdk.Context, fromModule string, coin sdk.Coin) (sdk.Coin, bool, error)
	WithdrawToModule(ctx sdk.Context, toModule string, uToken sdk.Coin) (sdk.Coin, bool, error)
	ModuleMaxWithdraw(ctx sdk.Context, spendableUTokens sdk.Coin) (sdkmath.Int, error)
	GetTotalSupply(ctx sdk.Context, denom string) (sdk.Coin, error)
	GetAllSupplied(ctx sdk.Context, supplierAddr sdk.AccAddress) (sdk.Coins, error)
}

LeverageKeeper interface for interacting with x/leverage

type MsgClient

type MsgClient interface {
	// Swap defines a method for swapping an accepted asset for Index's meToken.
	Swap(ctx context.Context, in *MsgSwap, opts ...grpc.CallOption) (*MsgSwapResponse, error)
	// Redeem defines a method for redeeming Index's meToken for an accepted asset.
	Redeem(ctx context.Context, in *MsgRedeem, opts ...grpc.CallOption) (*MsgRedeemResponse, error)
	// GovSetParams is used by governance proposals to update parameters.
	GovSetParams(ctx context.Context, in *MsgGovSetParams, opts ...grpc.CallOption) (*MsgGovSetParamsResponse, error)
	// GovUpdateRegistry adds new index to the index registry or
	// updates existing index with new settings.
	GovUpdateRegistry(ctx context.Context, in *MsgGovUpdateRegistry, opts ...grpc.CallOption) (*MsgGovUpdateRegistryResponse, error)
}

MsgClient is the client API for Msg service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewMsgClient

func NewMsgClient(cc grpc1.ClientConn) MsgClient

type MsgGovSetParams

type MsgGovSetParams struct {
	// authority must be the address of the governance account.
	Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"`
	Params    Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"`
}

MsgGovSetParams defines the Msg/GovSetParams request type.

func NewMsgGovSetParams

func NewMsgGovSetParams(authority string, params Params) *MsgGovSetParams

func (*MsgGovSetParams) Descriptor

func (*MsgGovSetParams) Descriptor() ([]byte, []int)

func (*MsgGovSetParams) Equal

func (this *MsgGovSetParams) Equal(that interface{}) bool

func (MsgGovSetParams) GetSignBytes

func (msg MsgGovSetParams) GetSignBytes() []byte

func (*MsgGovSetParams) GetSigners

func (msg *MsgGovSetParams) GetSigners() []sdk.AccAddress

GetSigners implements Msg

func (*MsgGovSetParams) Marshal

func (m *MsgGovSetParams) Marshal() (dAtA []byte, err error)

func (*MsgGovSetParams) MarshalTo

func (m *MsgGovSetParams) MarshalTo(dAtA []byte) (int, error)

func (*MsgGovSetParams) MarshalToSizedBuffer

func (m *MsgGovSetParams) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*MsgGovSetParams) ProtoMessage

func (*MsgGovSetParams) ProtoMessage()

func (*MsgGovSetParams) Reset

func (m *MsgGovSetParams) Reset()

func (MsgGovSetParams) Route

func (msg MsgGovSetParams) Route() string

LegacyMsg.Type implementations

func (*MsgGovSetParams) Size

func (m *MsgGovSetParams) Size() (n int)

func (*MsgGovSetParams) String

func (m *MsgGovSetParams) String() string

func (MsgGovSetParams) Type

func (msg MsgGovSetParams) Type() string

func (*MsgGovSetParams) Unmarshal

func (m *MsgGovSetParams) Unmarshal(dAtA []byte) error

func (*MsgGovSetParams) ValidateBasic

func (msg *MsgGovSetParams) ValidateBasic() error

ValidateBasic implements Msg

func (*MsgGovSetParams) XXX_DiscardUnknown

func (m *MsgGovSetParams) XXX_DiscardUnknown()

func (*MsgGovSetParams) XXX_Marshal

func (m *MsgGovSetParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MsgGovSetParams) XXX_Merge

func (m *MsgGovSetParams) XXX_Merge(src proto.Message)

func (*MsgGovSetParams) XXX_Size

func (m *MsgGovSetParams) XXX_Size() int

func (*MsgGovSetParams) XXX_Unmarshal

func (m *MsgGovSetParams) XXX_Unmarshal(b []byte) error

type MsgGovSetParamsResponse

type MsgGovSetParamsResponse struct {
}

MsgGovSetParamsResponse defines the Msg/GovSetParams response type.

func (*MsgGovSetParamsResponse) Descriptor

func (*MsgGovSetParamsResponse) Descriptor() ([]byte, []int)

func (*MsgGovSetParamsResponse) Marshal

func (m *MsgGovSetParamsResponse) Marshal() (dAtA []byte, err error)

func (*MsgGovSetParamsResponse) MarshalTo

func (m *MsgGovSetParamsResponse) MarshalTo(dAtA []byte) (int, error)

func (*MsgGovSetParamsResponse) MarshalToSizedBuffer

func (m *MsgGovSetParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*MsgGovSetParamsResponse) ProtoMessage

func (*MsgGovSetParamsResponse) ProtoMessage()

func (*MsgGovSetParamsResponse) Reset

func (m *MsgGovSetParamsResponse) Reset()

func (*MsgGovSetParamsResponse) Size

func (m *MsgGovSetParamsResponse) Size() (n int)

func (*MsgGovSetParamsResponse) String

func (m *MsgGovSetParamsResponse) String() string

func (*MsgGovSetParamsResponse) Unmarshal

func (m *MsgGovSetParamsResponse) Unmarshal(dAtA []byte) error

func (*MsgGovSetParamsResponse) XXX_DiscardUnknown

func (m *MsgGovSetParamsResponse) XXX_DiscardUnknown()

func (*MsgGovSetParamsResponse) XXX_Marshal

func (m *MsgGovSetParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MsgGovSetParamsResponse) XXX_Merge

func (m *MsgGovSetParamsResponse) XXX_Merge(src proto.Message)

func (*MsgGovSetParamsResponse) XXX_Size

func (m *MsgGovSetParamsResponse) XXX_Size() int

func (*MsgGovSetParamsResponse) XXX_Unmarshal

func (m *MsgGovSetParamsResponse) XXX_Unmarshal(b []byte) error

type MsgGovUpdateRegistry

type MsgGovUpdateRegistry struct {
	// authority is the address of the governance account.
	Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"`
	// add_index defines new index settings.
	AddIndex []Index `protobuf:"bytes,2,rep,name=add_index,json=addIndex,proto3" json:"add_index"`
	// update_index defines the new settings for existing index.
	UpdateIndex []Index `protobuf:"bytes,3,rep,name=update_index,json=updateIndex,proto3" json:"update_index"`
}

MsgGovUpdateRegistry defines the Msg/GovUpdateRegistry request type.

func NewMsgGovUpdateRegistry

func NewMsgGovUpdateRegistry(authority string, addIndex, updateIndex []Index) *MsgGovUpdateRegistry

func (*MsgGovUpdateRegistry) Descriptor

func (*MsgGovUpdateRegistry) Descriptor() ([]byte, []int)

func (*MsgGovUpdateRegistry) Equal

func (this *MsgGovUpdateRegistry) Equal(that interface{}) bool

func (MsgGovUpdateRegistry) GetSignBytes

func (msg MsgGovUpdateRegistry) GetSignBytes() []byte

func (*MsgGovUpdateRegistry) GetSigners

func (msg *MsgGovUpdateRegistry) GetSigners() []sdk.AccAddress

GetSigners implements Msg

func (*MsgGovUpdateRegistry) Marshal

func (m *MsgGovUpdateRegistry) Marshal() (dAtA []byte, err error)

func (*MsgGovUpdateRegistry) MarshalTo

func (m *MsgGovUpdateRegistry) MarshalTo(dAtA []byte) (int, error)

func (*MsgGovUpdateRegistry) MarshalToSizedBuffer

func (m *MsgGovUpdateRegistry) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*MsgGovUpdateRegistry) ProtoMessage

func (*MsgGovUpdateRegistry) ProtoMessage()

func (*MsgGovUpdateRegistry) Reset

func (m *MsgGovUpdateRegistry) Reset()

func (MsgGovUpdateRegistry) Route

func (msg MsgGovUpdateRegistry) Route() string

LegacyMsg.Type implementations

func (*MsgGovUpdateRegistry) Size

func (m *MsgGovUpdateRegistry) Size() (n int)

func (*MsgGovUpdateRegistry) String

func (m *MsgGovUpdateRegistry) String() string

func (MsgGovUpdateRegistry) Type

func (msg MsgGovUpdateRegistry) Type() string

func (*MsgGovUpdateRegistry) Unmarshal

func (m *MsgGovUpdateRegistry) Unmarshal(dAtA []byte) error

func (*MsgGovUpdateRegistry) ValidateBasic

func (msg *MsgGovUpdateRegistry) ValidateBasic() error

ValidateBasic implements Msg

func (*MsgGovUpdateRegistry) XXX_DiscardUnknown

func (m *MsgGovUpdateRegistry) XXX_DiscardUnknown()

func (*MsgGovUpdateRegistry) XXX_Marshal

func (m *MsgGovUpdateRegistry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MsgGovUpdateRegistry) XXX_Merge

func (m *MsgGovUpdateRegistry) XXX_Merge(src proto.Message)

func (*MsgGovUpdateRegistry) XXX_Size

func (m *MsgGovUpdateRegistry) XXX_Size() int

func (*MsgGovUpdateRegistry) XXX_Unmarshal

func (m *MsgGovUpdateRegistry) XXX_Unmarshal(b []byte) error

type MsgGovUpdateRegistryResponse

type MsgGovUpdateRegistryResponse struct {
}

MsgGovUpdateRegistryResponse defines the Msg/GovUpdateRegistry response type.

func (*MsgGovUpdateRegistryResponse) Descriptor

func (*MsgGovUpdateRegistryResponse) Descriptor() ([]byte, []int)

func (*MsgGovUpdateRegistryResponse) Marshal

func (m *MsgGovUpdateRegistryResponse) Marshal() (dAtA []byte, err error)

func (*MsgGovUpdateRegistryResponse) MarshalTo

func (m *MsgGovUpdateRegistryResponse) MarshalTo(dAtA []byte) (int, error)

func (*MsgGovUpdateRegistryResponse) MarshalToSizedBuffer

func (m *MsgGovUpdateRegistryResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*MsgGovUpdateRegistryResponse) ProtoMessage

func (*MsgGovUpdateRegistryResponse) ProtoMessage()

func (*MsgGovUpdateRegistryResponse) Reset

func (m *MsgGovUpdateRegistryResponse) Reset()

func (*MsgGovUpdateRegistryResponse) Size

func (m *MsgGovUpdateRegistryResponse) Size() (n int)

func (*MsgGovUpdateRegistryResponse) String

func (*MsgGovUpdateRegistryResponse) Unmarshal

func (m *MsgGovUpdateRegistryResponse) Unmarshal(dAtA []byte) error

func (*MsgGovUpdateRegistryResponse) XXX_DiscardUnknown

func (m *MsgGovUpdateRegistryResponse) XXX_DiscardUnknown()

func (*MsgGovUpdateRegistryResponse) XXX_Marshal

func (m *MsgGovUpdateRegistryResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MsgGovUpdateRegistryResponse) XXX_Merge

func (m *MsgGovUpdateRegistryResponse) XXX_Merge(src proto.Message)

func (*MsgGovUpdateRegistryResponse) XXX_Size

func (m *MsgGovUpdateRegistryResponse) XXX_Size() int

func (*MsgGovUpdateRegistryResponse) XXX_Unmarshal

func (m *MsgGovUpdateRegistryResponse) XXX_Unmarshal(b []byte) error

type MsgRedeem

type MsgRedeem struct {
	// User is the account address redeeming assets and the signer of the message.
	User       string     `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
	Metoken    types.Coin `protobuf:"bytes,2,opt,name=metoken,proto3" json:"metoken"`
	AssetDenom string     `protobuf:"bytes,3,opt,name=asset_denom,json=assetDenom,proto3" json:"asset_denom,omitempty"`
}

MsgRedeem represents a user's request to redeem Index's meTokens for one of the accepted assets.

func NewMsgRedeem

func NewMsgRedeem(user sdk.AccAddress, metoken sdk.Coin, assetDenom string) *MsgRedeem

func (*MsgRedeem) Descriptor

func (*MsgRedeem) Descriptor() ([]byte, []int)

func (MsgRedeem) GetSignBytes

func (msg MsgRedeem) GetSignBytes() []byte

func (*MsgRedeem) GetSigners

func (msg *MsgRedeem) GetSigners() []sdk.AccAddress

GetSigners implements Msg

func (*MsgRedeem) Marshal

func (m *MsgRedeem) Marshal() (dAtA []byte, err error)

func (*MsgRedeem) MarshalTo

func (m *MsgRedeem) MarshalTo(dAtA []byte) (int, error)

func (*MsgRedeem) MarshalToSizedBuffer

func (m *MsgRedeem) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*MsgRedeem) ProtoMessage

func (*MsgRedeem) ProtoMessage()

func (*MsgRedeem) Reset

func (m *MsgRedeem) Reset()

func (MsgRedeem) Route

func (msg MsgRedeem) Route() string

LegacyMsg.Type implementations

func (*MsgRedeem) Size

func (m *MsgRedeem) Size() (n int)

func (*MsgRedeem) String

func (m *MsgRedeem) String() string

func (MsgRedeem) Type

func (msg MsgRedeem) Type() string

func (*MsgRedeem) Unmarshal

func (m *MsgRedeem) Unmarshal(dAtA []byte) error

func (*MsgRedeem) ValidateBasic

func (msg *MsgRedeem) ValidateBasic() error

ValidateBasic implements Msg

func (*MsgRedeem) XXX_DiscardUnknown

func (m *MsgRedeem) XXX_DiscardUnknown()

func (*MsgRedeem) XXX_Marshal

func (m *MsgRedeem) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MsgRedeem) XXX_Merge

func (m *MsgRedeem) XXX_Merge(src proto.Message)

func (*MsgRedeem) XXX_Size

func (m *MsgRedeem) XXX_Size() int

func (*MsgRedeem) XXX_Unmarshal

func (m *MsgRedeem) XXX_Unmarshal(b []byte) error

type MsgRedeemResponse

type MsgRedeemResponse struct {
	// Returned is the amount of accepted asset returned to the user.
	Returned types.Coin `protobuf:"bytes,1,opt,name=returned,proto3" json:"returned"`
	// Fee is the amount of accepted asset charged to the user as the fee for the transaction.
	Fee types.Coin `protobuf:"bytes,2,opt,name=fee,proto3" json:"fee"`
}

MsgRedeemResponse defines the Msg/Redeem response type.

func (*MsgRedeemResponse) Descriptor

func (*MsgRedeemResponse) Descriptor() ([]byte, []int)

func (*MsgRedeemResponse) Marshal

func (m *MsgRedeemResponse) Marshal() (dAtA []byte, err error)

func (*MsgRedeemResponse) MarshalTo

func (m *MsgRedeemResponse) MarshalTo(dAtA []byte) (int, error)

func (*MsgRedeemResponse) MarshalToSizedBuffer

func (m *MsgRedeemResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*MsgRedeemResponse) ProtoMessage

func (*MsgRedeemResponse) ProtoMessage()

func (*MsgRedeemResponse) Reset

func (m *MsgRedeemResponse) Reset()

func (*MsgRedeemResponse) Size

func (m *MsgRedeemResponse) Size() (n int)

func (*MsgRedeemResponse) String

func (m *MsgRedeemResponse) String() string

func (*MsgRedeemResponse) Unmarshal

func (m *MsgRedeemResponse) Unmarshal(dAtA []byte) error

func (*MsgRedeemResponse) XXX_DiscardUnknown

func (m *MsgRedeemResponse) XXX_DiscardUnknown()

func (*MsgRedeemResponse) XXX_Marshal

func (m *MsgRedeemResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MsgRedeemResponse) XXX_Merge

func (m *MsgRedeemResponse) XXX_Merge(src proto.Message)

func (*MsgRedeemResponse) XXX_Size

func (m *MsgRedeemResponse) XXX_Size() int

func (*MsgRedeemResponse) XXX_Unmarshal

func (m *MsgRedeemResponse) XXX_Unmarshal(b []byte) error

type MsgServer

type MsgServer interface {
	// Swap defines a method for swapping an accepted asset for Index's meToken.
	Swap(context.Context, *MsgSwap) (*MsgSwapResponse, error)
	// Redeem defines a method for redeeming Index's meToken for an accepted asset.
	Redeem(context.Context, *MsgRedeem) (*MsgRedeemResponse, error)
	// GovSetParams is used by governance proposals to update parameters.
	GovSetParams(context.Context, *MsgGovSetParams) (*MsgGovSetParamsResponse, error)
	// GovUpdateRegistry adds new index to the index registry or
	// updates existing index with new settings.
	GovUpdateRegistry(context.Context, *MsgGovUpdateRegistry) (*MsgGovUpdateRegistryResponse, error)
}

MsgServer is the server API for Msg service.

type MsgSwap

type MsgSwap struct {
	// User is the account address swapping assets and the signer of the message.
	User         string     `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
	Asset        types.Coin `protobuf:"bytes,2,opt,name=asset,proto3" json:"asset"`
	MetokenDenom string     `protobuf:"bytes,3,opt,name=metoken_denom,json=metokenDenom,proto3" json:"metoken_denom,omitempty"`
}

MsgSwap represents a user's request to swap assets for Index's meToken.

func NewMsgSwap

func NewMsgSwap(user sdk.AccAddress, asset sdk.Coin, metokenDenom string) *MsgSwap

func (*MsgSwap) Descriptor

func (*MsgSwap) Descriptor() ([]byte, []int)

func (MsgSwap) GetSignBytes

func (msg MsgSwap) GetSignBytes() []byte

func (*MsgSwap) GetSigners

func (msg *MsgSwap) GetSigners() []sdk.AccAddress

GetSigners implements Msg

func (*MsgSwap) Marshal

func (m *MsgSwap) Marshal() (dAtA []byte, err error)

func (*MsgSwap) MarshalTo

func (m *MsgSwap) MarshalTo(dAtA []byte) (int, error)

func (*MsgSwap) MarshalToSizedBuffer

func (m *MsgSwap) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*MsgSwap) ProtoMessage

func (*MsgSwap) ProtoMessage()

func (*MsgSwap) Reset

func (m *MsgSwap) Reset()

func (MsgSwap) Route

func (msg MsgSwap) Route() string

LegacyMsg.Type implementations

func (*MsgSwap) Size

func (m *MsgSwap) Size() (n int)

func (*MsgSwap) String

func (m *MsgSwap) String() string

func (MsgSwap) Type

func (msg MsgSwap) Type() string

func (*MsgSwap) Unmarshal

func (m *MsgSwap) Unmarshal(dAtA []byte) error

func (*MsgSwap) ValidateBasic

func (msg *MsgSwap) ValidateBasic() error

ValidateBasic implements Msg

func (*MsgSwap) XXX_DiscardUnknown

func (m *MsgSwap) XXX_DiscardUnknown()

func (*MsgSwap) XXX_Marshal

func (m *MsgSwap) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MsgSwap) XXX_Merge

func (m *MsgSwap) XXX_Merge(src proto.Message)

func (*MsgSwap) XXX_Size

func (m *MsgSwap) XXX_Size() int

func (*MsgSwap) XXX_Unmarshal

func (m *MsgSwap) XXX_Unmarshal(b []byte) error

type MsgSwapResponse

type MsgSwapResponse struct {
	// Fee is the amount of accepted asset charged to the user as the fee for the transaction.
	Fee types.Coin `protobuf:"bytes,1,opt,name=fee,proto3" json:"fee"`
	// Returned is the amount of Index's meToken minted and returned to the user.
	Returned types.Coin `protobuf:"bytes,2,opt,name=returned,proto3" json:"returned"`
}

MsgSwapResponse defines the Msg/Swap response type.

func (*MsgSwapResponse) Descriptor

func (*MsgSwapResponse) Descriptor() ([]byte, []int)

func (*MsgSwapResponse) Marshal

func (m *MsgSwapResponse) Marshal() (dAtA []byte, err error)

func (*MsgSwapResponse) MarshalTo

func (m *MsgSwapResponse) MarshalTo(dAtA []byte) (int, error)

func (*MsgSwapResponse) MarshalToSizedBuffer

func (m *MsgSwapResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*MsgSwapResponse) ProtoMessage

func (*MsgSwapResponse) ProtoMessage()

func (*MsgSwapResponse) Reset

func (m *MsgSwapResponse) Reset()

func (*MsgSwapResponse) Size

func (m *MsgSwapResponse) Size() (n int)

func (*MsgSwapResponse) String

func (m *MsgSwapResponse) String() string

func (*MsgSwapResponse) Unmarshal

func (m *MsgSwapResponse) Unmarshal(dAtA []byte) error

func (*MsgSwapResponse) XXX_DiscardUnknown

func (m *MsgSwapResponse) XXX_DiscardUnknown()

func (*MsgSwapResponse) XXX_Marshal

func (m *MsgSwapResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MsgSwapResponse) XXX_Merge

func (m *MsgSwapResponse) XXX_Merge(src proto.Message)

func (*MsgSwapResponse) XXX_Size

func (m *MsgSwapResponse) XXX_Size() int

func (*MsgSwapResponse) XXX_Unmarshal

func (m *MsgSwapResponse) XXX_Unmarshal(b []byte) error

type OracleKeeper

type OracleKeeper interface {
	AllMedianPrices(ctx sdk.Context) otypes.Prices
}

OracleKeeper interface for price feed.

type Params

type Params struct {
	// Reserves Re-balancing Frequency in seconds, determines how often the re-balancing of the module reserves will be
	// triggered
	RebalancingFrequency int64 `protobuf:"varint,1,opt,name=rebalancing_frequency,json=rebalancingFrequency,proto3" json:"rebalancing_frequency,omitempty"`
	// Interest claiming frequency in seconds, determines how often metoken module will claim accrued interest from
	// leverage module
	ClaimingFrequency int64 `protobuf:"varint,2,opt,name=claiming_frequency,json=claimingFrequency,proto3" json:"claiming_frequency,omitempty"`
}

Params defines the parameters for the metoken module.

func DefaultParams

func DefaultParams() Params

DefaultParams returns default genesis params

func (*Params) Descriptor

func (*Params) Descriptor() ([]byte, []int)

func (*Params) Equal

func (this *Params) Equal(that interface{}) bool

func (*Params) GetClaimingFrequency

func (m *Params) GetClaimingFrequency() int64

func (*Params) GetRebalancingFrequency

func (m *Params) GetRebalancingFrequency() int64

func (*Params) Marshal

func (m *Params) Marshal() (dAtA []byte, err error)

func (*Params) MarshalTo

func (m *Params) MarshalTo(dAtA []byte) (int, error)

func (*Params) MarshalToSizedBuffer

func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Params) ProtoMessage

func (*Params) ProtoMessage()

func (*Params) Reset

func (m *Params) Reset()

func (*Params) Size

func (m *Params) Size() (n int)

func (*Params) String

func (m *Params) String() string

func (*Params) Unmarshal

func (m *Params) Unmarshal(dAtA []byte) error

func (*Params) XXX_DiscardUnknown

func (m *Params) XXX_DiscardUnknown()

func (*Params) XXX_Marshal

func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Params) XXX_Merge

func (m *Params) XXX_Merge(src proto.Message)

func (*Params) XXX_Size

func (m *Params) XXX_Size() int

func (*Params) XXX_Unmarshal

func (m *Params) XXX_Unmarshal(b []byte) error

type QueryClient

type QueryClient interface {
	// Params queries the parameters of the x/metoken module.
	Params(ctx context.Context, in *QueryParams, opts ...grpc.CallOption) (*QueryParamsResponse, error)
	// Indexes queries for a specific or all the registered indexes.
	Indexes(ctx context.Context, in *QueryIndexes, opts ...grpc.CallOption) (*QueryIndexesResponse, error)
	// SwapFee computes fee that would be applied when executing MsgSwap.
	SwapFee(ctx context.Context, in *QuerySwapFee, opts ...grpc.CallOption) (*QuerySwapFeeResponse, error)
	// RedeemFee computes a fee that would be applied when executing MsgRedeem.
	RedeemFee(ctx context.Context, in *QueryRedeemFee, opts ...grpc.CallOption) (*QueryRedeemFeeResponse, error)
	// IndexBalances queries for Index's balances of a specific or all the registered indexes.
	IndexBalances(ctx context.Context, in *QueryIndexBalances, opts ...grpc.CallOption) (*QueryIndexBalancesResponse, error)
	// IndexPrices queries for Index's price of a specific or all the registered indexes. It also includes the
	// underlying assets prices as well as swap and redeem rates.
	IndexPrices(ctx context.Context, in *QueryIndexPrices, opts ...grpc.CallOption) (*QueryIndexPricesResponse, error)
}

QueryClient is the client API for Query service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewQueryClient

func NewQueryClient(cc grpc1.ClientConn) QueryClient

type QueryIndexBalances

type QueryIndexBalances struct {
	MetokenDenom string `protobuf:"bytes,1,opt,name=metoken_denom,json=metokenDenom,proto3" json:"metoken_denom,omitempty"`
}

QueryIndexBalances defines the request structure for the IndexBalances gRPC service handler. metoken_denom param is optional, if it is not informed the query will return all the Indexes.

func (*QueryIndexBalances) Descriptor

func (*QueryIndexBalances) Descriptor() ([]byte, []int)

func (*QueryIndexBalances) Marshal

func (m *QueryIndexBalances) Marshal() (dAtA []byte, err error)

func (*QueryIndexBalances) MarshalTo

func (m *QueryIndexBalances) MarshalTo(dAtA []byte) (int, error)

func (*QueryIndexBalances) MarshalToSizedBuffer

func (m *QueryIndexBalances) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*QueryIndexBalances) ProtoMessage

func (*QueryIndexBalances) ProtoMessage()

func (*QueryIndexBalances) Reset

func (m *QueryIndexBalances) Reset()

func (*QueryIndexBalances) Size

func (m *QueryIndexBalances) Size() (n int)

func (*QueryIndexBalances) String

func (m *QueryIndexBalances) String() string

func (*QueryIndexBalances) Unmarshal

func (m *QueryIndexBalances) Unmarshal(dAtA []byte) error

func (*QueryIndexBalances) XXX_DiscardUnknown

func (m *QueryIndexBalances) XXX_DiscardUnknown()

func (*QueryIndexBalances) XXX_Marshal

func (m *QueryIndexBalances) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QueryIndexBalances) XXX_Merge

func (m *QueryIndexBalances) XXX_Merge(src proto.Message)

func (*QueryIndexBalances) XXX_Size

func (m *QueryIndexBalances) XXX_Size() int

func (*QueryIndexBalances) XXX_Unmarshal

func (m *QueryIndexBalances) XXX_Unmarshal(b []byte) error

type QueryIndexBalancesResponse

type QueryIndexBalancesResponse struct {
	IndexBalances []IndexBalances `protobuf:"bytes,1,rep,name=index_balances,json=indexBalances,proto3" json:"index_balances"`
	Prices        []IndexPrices   `protobuf:"bytes,2,rep,name=prices,proto3" json:"prices"`
}

QueryIndexBalanceResponse defines the response structure for the IndexBalances gRPC service handler.

func (*QueryIndexBalancesResponse) Descriptor

func (*QueryIndexBalancesResponse) Descriptor() ([]byte, []int)

func (*QueryIndexBalancesResponse) Marshal

func (m *QueryIndexBalancesResponse) Marshal() (dAtA []byte, err error)

func (*QueryIndexBalancesResponse) MarshalTo

func (m *QueryIndexBalancesResponse) MarshalTo(dAtA []byte) (int, error)

func (*QueryIndexBalancesResponse) MarshalToSizedBuffer

func (m *QueryIndexBalancesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*QueryIndexBalancesResponse) ProtoMessage

func (*QueryIndexBalancesResponse) ProtoMessage()

func (*QueryIndexBalancesResponse) Reset

func (m *QueryIndexBalancesResponse) Reset()

func (*QueryIndexBalancesResponse) Size

func (m *QueryIndexBalancesResponse) Size() (n int)

func (*QueryIndexBalancesResponse) String

func (m *QueryIndexBalancesResponse) String() string

func (*QueryIndexBalancesResponse) Unmarshal

func (m *QueryIndexBalancesResponse) Unmarshal(dAtA []byte) error

func (*QueryIndexBalancesResponse) XXX_DiscardUnknown

func (m *QueryIndexBalancesResponse) XXX_DiscardUnknown()

func (*QueryIndexBalancesResponse) XXX_Marshal

func (m *QueryIndexBalancesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QueryIndexBalancesResponse) XXX_Merge

func (m *QueryIndexBalancesResponse) XXX_Merge(src proto.Message)

func (*QueryIndexBalancesResponse) XXX_Size

func (m *QueryIndexBalancesResponse) XXX_Size() int

func (*QueryIndexBalancesResponse) XXX_Unmarshal

func (m *QueryIndexBalancesResponse) XXX_Unmarshal(b []byte) error

type QueryIndexPrices

type QueryIndexPrices struct {
	MetokenDenom string `protobuf:"bytes,1,opt,name=metoken_denom,json=metokenDenom,proto3" json:"metoken_denom,omitempty"`
}

QueryIndexPrices defines the request structure for the IndexPrice gRPC service handler. metoken_denom param is optional, if it is not informed the query will return all the Index's prices.

func (*QueryIndexPrices) Descriptor

func (*QueryIndexPrices) Descriptor() ([]byte, []int)

func (*QueryIndexPrices) Marshal

func (m *QueryIndexPrices) Marshal() (dAtA []byte, err error)

func (*QueryIndexPrices) MarshalTo

func (m *QueryIndexPrices) MarshalTo(dAtA []byte) (int, error)

func (*QueryIndexPrices) MarshalToSizedBuffer

func (m *QueryIndexPrices) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*QueryIndexPrices) ProtoMessage

func (*QueryIndexPrices) ProtoMessage()

func (*QueryIndexPrices) Reset

func (m *QueryIndexPrices) Reset()

func (*QueryIndexPrices) Size

func (m *QueryIndexPrices) Size() (n int)

func (*QueryIndexPrices) String

func (m *QueryIndexPrices) String() string

func (*QueryIndexPrices) Unmarshal

func (m *QueryIndexPrices) Unmarshal(dAtA []byte) error

func (*QueryIndexPrices) XXX_DiscardUnknown

func (m *QueryIndexPrices) XXX_DiscardUnknown()

func (*QueryIndexPrices) XXX_Marshal

func (m *QueryIndexPrices) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QueryIndexPrices) XXX_Merge

func (m *QueryIndexPrices) XXX_Merge(src proto.Message)

func (*QueryIndexPrices) XXX_Size

func (m *QueryIndexPrices) XXX_Size() int

func (*QueryIndexPrices) XXX_Unmarshal

func (m *QueryIndexPrices) XXX_Unmarshal(b []byte) error

type QueryIndexPricesResponse

type QueryIndexPricesResponse struct {
	Prices []IndexPrices `protobuf:"bytes,1,rep,name=prices,proto3" json:"prices"`
}

QueryIndexPriceResponses defines the response structure for the IndexPrice gRPC service handler.

func (*QueryIndexPricesResponse) Descriptor

func (*QueryIndexPricesResponse) Descriptor() ([]byte, []int)

func (*QueryIndexPricesResponse) Marshal

func (m *QueryIndexPricesResponse) Marshal() (dAtA []byte, err error)

func (*QueryIndexPricesResponse) MarshalTo

func (m *QueryIndexPricesResponse) MarshalTo(dAtA []byte) (int, error)

func (*QueryIndexPricesResponse) MarshalToSizedBuffer

func (m *QueryIndexPricesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*QueryIndexPricesResponse) ProtoMessage

func (*QueryIndexPricesResponse) ProtoMessage()

func (*QueryIndexPricesResponse) Reset

func (m *QueryIndexPricesResponse) Reset()

func (*QueryIndexPricesResponse) Size

func (m *QueryIndexPricesResponse) Size() (n int)

func (*QueryIndexPricesResponse) String

func (m *QueryIndexPricesResponse) String() string

func (*QueryIndexPricesResponse) Unmarshal

func (m *QueryIndexPricesResponse) Unmarshal(dAtA []byte) error

func (*QueryIndexPricesResponse) XXX_DiscardUnknown

func (m *QueryIndexPricesResponse) XXX_DiscardUnknown()

func (*QueryIndexPricesResponse) XXX_Marshal

func (m *QueryIndexPricesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QueryIndexPricesResponse) XXX_Merge

func (m *QueryIndexPricesResponse) XXX_Merge(src proto.Message)

func (*QueryIndexPricesResponse) XXX_Size

func (m *QueryIndexPricesResponse) XXX_Size() int

func (*QueryIndexPricesResponse) XXX_Unmarshal

func (m *QueryIndexPricesResponse) XXX_Unmarshal(b []byte) error

type QueryIndexes

type QueryIndexes struct {
	MetokenDenom string `protobuf:"bytes,1,opt,name=metoken_denom,json=metokenDenom,proto3" json:"metoken_denom,omitempty"`
}

QueryIndexes defines the request structure for the Indexes gRPC service handler. metoken_denom param is optional, if it is not informed the query will return all the Indexes.

func (*QueryIndexes) Descriptor

func (*QueryIndexes) Descriptor() ([]byte, []int)

func (*QueryIndexes) Marshal

func (m *QueryIndexes) Marshal() (dAtA []byte, err error)

func (*QueryIndexes) MarshalTo

func (m *QueryIndexes) MarshalTo(dAtA []byte) (int, error)

func (*QueryIndexes) MarshalToSizedBuffer

func (m *QueryIndexes) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*QueryIndexes) ProtoMessage

func (*QueryIndexes) ProtoMessage()

func (*QueryIndexes) Reset

func (m *QueryIndexes) Reset()

func (*QueryIndexes) Size

func (m *QueryIndexes) Size() (n int)

func (*QueryIndexes) String

func (m *QueryIndexes) String() string

func (*QueryIndexes) Unmarshal

func (m *QueryIndexes) Unmarshal(dAtA []byte) error

func (*QueryIndexes) XXX_DiscardUnknown

func (m *QueryIndexes) XXX_DiscardUnknown()

func (*QueryIndexes) XXX_Marshal

func (m *QueryIndexes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QueryIndexes) XXX_Merge

func (m *QueryIndexes) XXX_Merge(src proto.Message)

func (*QueryIndexes) XXX_Size

func (m *QueryIndexes) XXX_Size() int

func (*QueryIndexes) XXX_Unmarshal

func (m *QueryIndexes) XXX_Unmarshal(b []byte) error

type QueryIndexesResponse

type QueryIndexesResponse struct {
	Registry []Index `protobuf:"bytes,1,rep,name=registry,proto3" json:"registry"`
}

QueryIndexesResponse defines the response structure for the Indexes gRPC service handler.

func (*QueryIndexesResponse) Descriptor

func (*QueryIndexesResponse) Descriptor() ([]byte, []int)

func (*QueryIndexesResponse) Marshal

func (m *QueryIndexesResponse) Marshal() (dAtA []byte, err error)

func (*QueryIndexesResponse) MarshalTo

func (m *QueryIndexesResponse) MarshalTo(dAtA []byte) (int, error)

func (*QueryIndexesResponse) MarshalToSizedBuffer

func (m *QueryIndexesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*QueryIndexesResponse) ProtoMessage

func (*QueryIndexesResponse) ProtoMessage()

func (*QueryIndexesResponse) Reset

func (m *QueryIndexesResponse) Reset()

func (*QueryIndexesResponse) Size

func (m *QueryIndexesResponse) Size() (n int)

func (*QueryIndexesResponse) String

func (m *QueryIndexesResponse) String() string

func (*QueryIndexesResponse) Unmarshal

func (m *QueryIndexesResponse) Unmarshal(dAtA []byte) error

func (*QueryIndexesResponse) XXX_DiscardUnknown

func (m *QueryIndexesResponse) XXX_DiscardUnknown()

func (*QueryIndexesResponse) XXX_Marshal

func (m *QueryIndexesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QueryIndexesResponse) XXX_Merge

func (m *QueryIndexesResponse) XXX_Merge(src proto.Message)

func (*QueryIndexesResponse) XXX_Size

func (m *QueryIndexesResponse) XXX_Size() int

func (*QueryIndexesResponse) XXX_Unmarshal

func (m *QueryIndexesResponse) XXX_Unmarshal(b []byte) error

type QueryParams

type QueryParams struct {
}

QueryParams defines the request structure for the Params gRPC service handler.

func (*QueryParams) Descriptor

func (*QueryParams) Descriptor() ([]byte, []int)

func (*QueryParams) Marshal

func (m *QueryParams) Marshal() (dAtA []byte, err error)

func (*QueryParams) MarshalTo

func (m *QueryParams) MarshalTo(dAtA []byte) (int, error)

func (*QueryParams) MarshalToSizedBuffer

func (m *QueryParams) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*QueryParams) ProtoMessage

func (*QueryParams) ProtoMessage()

func (*QueryParams) Reset

func (m *QueryParams) Reset()

func (*QueryParams) Size

func (m *QueryParams) Size() (n int)

func (*QueryParams) String

func (m *QueryParams) String() string

func (*QueryParams) Unmarshal

func (m *QueryParams) Unmarshal(dAtA []byte) error

func (*QueryParams) XXX_DiscardUnknown

func (m *QueryParams) XXX_DiscardUnknown()

func (*QueryParams) XXX_Marshal

func (m *QueryParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QueryParams) XXX_Merge

func (m *QueryParams) XXX_Merge(src proto.Message)

func (*QueryParams) XXX_Size

func (m *QueryParams) XXX_Size() int

func (*QueryParams) XXX_Unmarshal

func (m *QueryParams) XXX_Unmarshal(b []byte) error

type QueryParamsResponse

type QueryParamsResponse struct {
	Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"`
}

QueryParamsResponse defines the response structure for the Params gRPC service handler.

func (*QueryParamsResponse) Descriptor

func (*QueryParamsResponse) Descriptor() ([]byte, []int)

func (*QueryParamsResponse) Marshal

func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error)

func (*QueryParamsResponse) MarshalTo

func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error)

func (*QueryParamsResponse) MarshalToSizedBuffer

func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*QueryParamsResponse) ProtoMessage

func (*QueryParamsResponse) ProtoMessage()

func (*QueryParamsResponse) Reset

func (m *QueryParamsResponse) Reset()

func (*QueryParamsResponse) Size

func (m *QueryParamsResponse) Size() (n int)

func (*QueryParamsResponse) String

func (m *QueryParamsResponse) String() string

func (*QueryParamsResponse) Unmarshal

func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error

func (*QueryParamsResponse) XXX_DiscardUnknown

func (m *QueryParamsResponse) XXX_DiscardUnknown()

func (*QueryParamsResponse) XXX_Marshal

func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QueryParamsResponse) XXX_Merge

func (m *QueryParamsResponse) XXX_Merge(src proto.Message)

func (*QueryParamsResponse) XXX_Size

func (m *QueryParamsResponse) XXX_Size() int

func (*QueryParamsResponse) XXX_Unmarshal

func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error

type QueryRedeemFee

type QueryRedeemFee struct {
	Metoken    string `protobuf:"bytes,1,opt,name=metoken,proto3" json:"metoken,omitempty"`
	AssetDenom string `protobuf:"bytes,2,opt,name=asset_denom,json=assetDenom,proto3" json:"asset_denom,omitempty"`
}

QueryRedeemFee defines the request structure for the RedeemFee gRPC service handler.

func (*QueryRedeemFee) Descriptor

func (*QueryRedeemFee) Descriptor() ([]byte, []int)

func (*QueryRedeemFee) Marshal

func (m *QueryRedeemFee) Marshal() (dAtA []byte, err error)

func (*QueryRedeemFee) MarshalTo

func (m *QueryRedeemFee) MarshalTo(dAtA []byte) (int, error)

func (*QueryRedeemFee) MarshalToSizedBuffer

func (m *QueryRedeemFee) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*QueryRedeemFee) ProtoMessage

func (*QueryRedeemFee) ProtoMessage()

func (*QueryRedeemFee) Reset

func (m *QueryRedeemFee) Reset()

func (*QueryRedeemFee) Size

func (m *QueryRedeemFee) Size() (n int)

func (*QueryRedeemFee) String

func (m *QueryRedeemFee) String() string

func (*QueryRedeemFee) Unmarshal

func (m *QueryRedeemFee) Unmarshal(dAtA []byte) error

func (*QueryRedeemFee) XXX_DiscardUnknown

func (m *QueryRedeemFee) XXX_DiscardUnknown()

func (*QueryRedeemFee) XXX_Marshal

func (m *QueryRedeemFee) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QueryRedeemFee) XXX_Merge

func (m *QueryRedeemFee) XXX_Merge(src proto.Message)

func (*QueryRedeemFee) XXX_Size

func (m *QueryRedeemFee) XXX_Size() int

func (*QueryRedeemFee) XXX_Unmarshal

func (m *QueryRedeemFee) XXX_Unmarshal(b []byte) error

type QueryRedeemFeeResponse

type QueryRedeemFeeResponse struct {
	Asset types.Coin `protobuf:"bytes,1,opt,name=asset,proto3" json:"asset"`
}

QueryRedeemFeeResponse defines the response structure for the RedeemFee gRPC service handler.

func (*QueryRedeemFeeResponse) Descriptor

func (*QueryRedeemFeeResponse) Descriptor() ([]byte, []int)

func (*QueryRedeemFeeResponse) Marshal

func (m *QueryRedeemFeeResponse) Marshal() (dAtA []byte, err error)

func (*QueryRedeemFeeResponse) MarshalTo

func (m *QueryRedeemFeeResponse) MarshalTo(dAtA []byte) (int, error)

func (*QueryRedeemFeeResponse) MarshalToSizedBuffer

func (m *QueryRedeemFeeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*QueryRedeemFeeResponse) ProtoMessage

func (*QueryRedeemFeeResponse) ProtoMessage()

func (*QueryRedeemFeeResponse) Reset

func (m *QueryRedeemFeeResponse) Reset()

func (*QueryRedeemFeeResponse) Size

func (m *QueryRedeemFeeResponse) Size() (n int)

func (*QueryRedeemFeeResponse) String

func (m *QueryRedeemFeeResponse) String() string

func (*QueryRedeemFeeResponse) Unmarshal

func (m *QueryRedeemFeeResponse) Unmarshal(dAtA []byte) error

func (*QueryRedeemFeeResponse) XXX_DiscardUnknown

func (m *QueryRedeemFeeResponse) XXX_DiscardUnknown()

func (*QueryRedeemFeeResponse) XXX_Marshal

func (m *QueryRedeemFeeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QueryRedeemFeeResponse) XXX_Merge

func (m *QueryRedeemFeeResponse) XXX_Merge(src proto.Message)

func (*QueryRedeemFeeResponse) XXX_Size

func (m *QueryRedeemFeeResponse) XXX_Size() int

func (*QueryRedeemFeeResponse) XXX_Unmarshal

func (m *QueryRedeemFeeResponse) XXX_Unmarshal(b []byte) error

type QueryServer

type QueryServer interface {
	// Params queries the parameters of the x/metoken module.
	Params(context.Context, *QueryParams) (*QueryParamsResponse, error)
	// Indexes queries for a specific or all the registered indexes.
	Indexes(context.Context, *QueryIndexes) (*QueryIndexesResponse, error)
	// SwapFee computes fee that would be applied when executing MsgSwap.
	SwapFee(context.Context, *QuerySwapFee) (*QuerySwapFeeResponse, error)
	// RedeemFee computes a fee that would be applied when executing MsgRedeem.
	RedeemFee(context.Context, *QueryRedeemFee) (*QueryRedeemFeeResponse, error)
	// IndexBalances queries for Index's balances of a specific or all the registered indexes.
	IndexBalances(context.Context, *QueryIndexBalances) (*QueryIndexBalancesResponse, error)
	// IndexPrices queries for Index's price of a specific or all the registered indexes. It also includes the
	// underlying assets prices as well as swap and redeem rates.
	IndexPrices(context.Context, *QueryIndexPrices) (*QueryIndexPricesResponse, error)
}

QueryServer is the server API for Query service.

type QuerySwapFee

type QuerySwapFee struct {
	Asset        string `protobuf:"bytes,1,opt,name=asset,proto3" json:"asset,omitempty"`
	MetokenDenom string `protobuf:"bytes,2,opt,name=metoken_denom,json=metokenDenom,proto3" json:"metoken_denom,omitempty"`
}

QuerySwapFee defines the request structure for the SwapFee gRPC service handler.

func (*QuerySwapFee) Descriptor

func (*QuerySwapFee) Descriptor() ([]byte, []int)

func (*QuerySwapFee) Marshal

func (m *QuerySwapFee) Marshal() (dAtA []byte, err error)

func (*QuerySwapFee) MarshalTo

func (m *QuerySwapFee) MarshalTo(dAtA []byte) (int, error)

func (*QuerySwapFee) MarshalToSizedBuffer

func (m *QuerySwapFee) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*QuerySwapFee) ProtoMessage

func (*QuerySwapFee) ProtoMessage()

func (*QuerySwapFee) Reset

func (m *QuerySwapFee) Reset()

func (*QuerySwapFee) Size

func (m *QuerySwapFee) Size() (n int)

func (*QuerySwapFee) String

func (m *QuerySwapFee) String() string

func (*QuerySwapFee) Unmarshal

func (m *QuerySwapFee) Unmarshal(dAtA []byte) error

func (*QuerySwapFee) XXX_DiscardUnknown

func (m *QuerySwapFee) XXX_DiscardUnknown()

func (*QuerySwapFee) XXX_Marshal

func (m *QuerySwapFee) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QuerySwapFee) XXX_Merge

func (m *QuerySwapFee) XXX_Merge(src proto.Message)

func (*QuerySwapFee) XXX_Size

func (m *QuerySwapFee) XXX_Size() int

func (*QuerySwapFee) XXX_Unmarshal

func (m *QuerySwapFee) XXX_Unmarshal(b []byte) error

type QuerySwapFeeResponse

type QuerySwapFeeResponse struct {
	Asset types.Coin `protobuf:"bytes,1,opt,name=asset,proto3" json:"asset"`
}

QuerySwapFeeResponse defines the response structure for the SwapFee gRPC service handler.

func (*QuerySwapFeeResponse) Descriptor

func (*QuerySwapFeeResponse) Descriptor() ([]byte, []int)

func (*QuerySwapFeeResponse) Marshal

func (m *QuerySwapFeeResponse) Marshal() (dAtA []byte, err error)

func (*QuerySwapFeeResponse) MarshalTo

func (m *QuerySwapFeeResponse) MarshalTo(dAtA []byte) (int, error)

func (*QuerySwapFeeResponse) MarshalToSizedBuffer

func (m *QuerySwapFeeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*QuerySwapFeeResponse) ProtoMessage

func (*QuerySwapFeeResponse) ProtoMessage()

func (*QuerySwapFeeResponse) Reset

func (m *QuerySwapFeeResponse) Reset()

func (*QuerySwapFeeResponse) Size

func (m *QuerySwapFeeResponse) Size() (n int)

func (*QuerySwapFeeResponse) String

func (m *QuerySwapFeeResponse) String() string

func (*QuerySwapFeeResponse) Unmarshal

func (m *QuerySwapFeeResponse) Unmarshal(dAtA []byte) error

func (*QuerySwapFeeResponse) XXX_DiscardUnknown

func (m *QuerySwapFeeResponse) XXX_DiscardUnknown()

func (*QuerySwapFeeResponse) XXX_Marshal

func (m *QuerySwapFeeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QuerySwapFeeResponse) XXX_Merge

func (m *QuerySwapFeeResponse) XXX_Merge(src proto.Message)

func (*QuerySwapFeeResponse) XXX_Size

func (m *QuerySwapFeeResponse) XXX_Size() int

func (*QuerySwapFeeResponse) XXX_Unmarshal

func (m *QuerySwapFeeResponse) XXX_Unmarshal(b []byte) error

type RebalancingResult

type RebalancingResult struct {
	MetokenDenom string `protobuf:"bytes,1,opt,name=metoken_denom,json=metokenDenom,proto3" json:"metoken_denom,omitempty"`
	//Initial balance of an asset in the Index before re-balancing.
	InitialBalance []types.Coin `protobuf:"bytes,2,rep,name=initial_balance,json=initialBalance,proto3" json:"initial_balance"`
	// Result balance of an asset in the Index after re-balancing.
	ResultBalance []types.Coin `protobuf:"bytes,3,rep,name=result_balance,json=resultBalance,proto3" json:"result_balance"`
}

RebalancingResult of a specific Index with initial and result balances of underlying assets.

func (*RebalancingResult) Descriptor

func (*RebalancingResult) Descriptor() ([]byte, []int)

func (*RebalancingResult) Marshal

func (m *RebalancingResult) Marshal() (dAtA []byte, err error)

func (*RebalancingResult) MarshalTo

func (m *RebalancingResult) MarshalTo(dAtA []byte) (int, error)

func (*RebalancingResult) MarshalToSizedBuffer

func (m *RebalancingResult) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*RebalancingResult) ProtoMessage

func (*RebalancingResult) ProtoMessage()

func (*RebalancingResult) Reset

func (m *RebalancingResult) Reset()

func (*RebalancingResult) Size

func (m *RebalancingResult) Size() (n int)

func (*RebalancingResult) String

func (m *RebalancingResult) String() string

func (*RebalancingResult) Unmarshal

func (m *RebalancingResult) Unmarshal(dAtA []byte) error

func (*RebalancingResult) XXX_DiscardUnknown

func (m *RebalancingResult) XXX_DiscardUnknown()

func (*RebalancingResult) XXX_Marshal

func (m *RebalancingResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*RebalancingResult) XXX_Merge

func (m *RebalancingResult) XXX_Merge(src proto.Message)

func (*RebalancingResult) XXX_Size

func (m *RebalancingResult) XXX_Size() int

func (*RebalancingResult) XXX_Unmarshal

func (m *RebalancingResult) XXX_Unmarshal(b []byte) error

type UnimplementedMsgServer

type UnimplementedMsgServer struct {
}

UnimplementedMsgServer can be embedded to have forward compatible implementations.

func (*UnimplementedMsgServer) GovSetParams

func (*UnimplementedMsgServer) GovUpdateRegistry

func (*UnimplementedMsgServer) Redeem

func (*UnimplementedMsgServer) Swap

type UnimplementedQueryServer

type UnimplementedQueryServer struct {
}

UnimplementedQueryServer can be embedded to have forward compatible implementations.

func (*UnimplementedQueryServer) IndexBalances

func (*UnimplementedQueryServer) IndexPrices

func (*UnimplementedQueryServer) Indexes

func (*UnimplementedQueryServer) Params

func (*UnimplementedQueryServer) RedeemFee

func (*UnimplementedQueryServer) SwapFee

Directories

Path Synopsis
client
cli
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL