keeper

package
v0.0.0-...-3315d20 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalPoolUnit

func CalPoolUnit(oldPoolUnit, baseTokenBalance, tokenBalance, baseTokenAmount, tokenAmount sdk.Int) (totalUnit, addUnit sdk.Int)

F = pool baseToken Balance (before) R = poo token Balance (before) f = baseToken added; r = token added P = existing Pool Units slipAdjustment = (1 - ABS((F r - f R)/((f + F) (r + R)))) units = ((P (r F + R f))/(2 R F))*slipAdjustment

func CalRemoveAmount

func CalRemoveAmount(poolUnit, rmUnit, swapUnit, baseTokenBalance, tokenBalance sdk.Int, inputIsBase bool) (baseTokenAmount, tokenAmount, swapAmount sdk.Int)

func CalSwapResult

func CalSwapResult(baseTokenBalance, tokenBalance, inputAmount sdk.Int, inputIsBase bool) (y, fee sdk.Int)

y = (x * X * Y) / (x + X)^2 fee = (x^2 * Y)/(x + X)^2

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

NewMsgServerImpl returns an implementation of the MsgServer interface for the provided Keeper.

Types

type Keeper

type Keeper struct {
	// contains filtered or unexported fields
}

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	storeKey,
	memKey sdk.StoreKey,
	ps paramtypes.Subspace,
	bankKeeper types.BankKeeper,
	sudoKeeper types.SudoKeeper,
) *Keeper

func (Keeper) AddPoolCreator

func (k Keeper) AddPoolCreator(ctx sdk.Context, addr sdk.AccAddress)

func (Keeper) AddProvider

func (k Keeper) AddProvider(ctx sdk.Context, addr sdk.AccAddress)

func (Keeper) GetParams

func (k Keeper) GetParams(ctx sdk.Context) types.Params

GetParams get all parameters as types.Params

func (Keeper) GetPoolCreatorList

func (k Keeper) GetPoolCreatorList(ctx sdk.Context) []string

func (Keeper) GetProviderList

func (k Keeper) GetProviderList(ctx sdk.Context) []string

func (Keeper) GetProviderSwitch

func (k Keeper) GetProviderSwitch(ctx sdk.Context) bool

func (Keeper) GetSwapPool

func (k Keeper) GetSwapPool(ctx sdk.Context, denom string) (*types.SwapPool, bool)

func (Keeper) GetSwapPoolList

func (k Keeper) GetSwapPoolList(ctx sdk.Context) []*types.SwapPool

func (Keeper) GetSwapPoolNextIndex

func (k Keeper) GetSwapPoolNextIndex(ctx sdk.Context) uint32

func (Keeper) HasPoolCreator

func (k Keeper) HasPoolCreator(ctx sdk.Context, addr sdk.AccAddress) bool

func (Keeper) HasProvider

func (k Keeper) HasProvider(ctx sdk.Context, addr sdk.AccAddress) bool

func (Keeper) IsRDexLpToken

func (k Keeper) IsRDexLpToken(ctx sdk.Context, denom string) bool

func (Keeper) Logger

func (k Keeper) Logger(ctx sdk.Context) log.Logger

func (Keeper) Params

func (Keeper) RemovePoolCreator

func (k Keeper) RemovePoolCreator(ctx sdk.Context, addr sdk.AccAddress)

func (Keeper) RemoveProvider

func (k Keeper) RemoveProvider(ctx sdk.Context, addr sdk.AccAddress)

func (Keeper) SetParams

func (k Keeper) SetParams(ctx sdk.Context, params types.Params)

SetParams set the params

func (Keeper) SetProviderSwitch

func (k Keeper) SetProviderSwitch(ctx sdk.Context, isOpen bool)

func (Keeper) SetSwapPool

func (k Keeper) SetSwapPool(ctx sdk.Context, denom string, swapPool *types.SwapPool)

func (Keeper) SetSwapPoolIndex

func (k Keeper) SetSwapPoolIndex(ctx sdk.Context, index uint32)

func (Keeper) ToggleProviderSwitch

func (k Keeper) ToggleProviderSwitch(ctx sdk.Context)

Jump to

Keyboard shortcuts

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