keeper

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2023 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 storetypes.StoreKey,
	transientStoreKey storetypes.StoreKey,
	assetsKeeper types.AssetsKeeper,
	bankKeeper types.BankKeeper,
	feeTiersKeeper types.FeeTiersKeeper,
	pricesKeeper types.PricesKeeper,
	authorities []string,
) *Keeper

func (Keeper) AddRewardShareToAddress

func (k Keeper) AddRewardShareToAddress(
	ctx sdk.Context,
	address string,
	weight *big.Int,
)

AddRewardShareToAddress adds a reward share to an address. If the address has a previous reward share, increment weight. If not, create new reward share with given weight.

func (Keeper) AddRewardSharesForFill

func (k Keeper) AddRewardSharesForFill(
	ctx sdk.Context,
	takerAddress string,
	makerAddress string,
	bigFillQuoteQuantums *big.Int,
	bigTakerFeeQuoteQuantums *big.Int,
	bigMakerFeeQuoteQuantums *big.Int,
)

Add reward shares for the maker and taker of a fill. Intended for being called in `x/clob` when a fill is persisted.

Within each block, total reward share score for an address is defined as:

reward_share_score = total_taker_fees_paid - max_possible_maker_rebate*taker_volume + total_positive_maker_fees

Hence, for each fill, increment reward share score as follow:

  • For maker address, positive maker fees are added directly.
  • For taker address, positive taker fees are reduced by the largest possible maker rebate in x/fee-tiers multiplied by quote quantums of the fill.

func (Keeper) GetParams

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

GetParams returns the Params in state.

func (Keeper) GetRewardShare

func (k Keeper) GetRewardShare(
	ctx sdk.Context,
	address string,
) (val types.RewardShare)

Get `RewardShare` for a given address. If the address does not have existing reward share, return a `RewardShare` with 0 weight.

func (Keeper) HasAuthority

func (k Keeper) HasAuthority(authority string) bool

func (Keeper) InitializeForGenesis

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

func (Keeper) Logger

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

func (Keeper) Params

func (Keeper) ProcessRewardsForBlock

func (k Keeper) ProcessRewardsForBlock(
	ctx sdk.Context,
) error

ProcessRewardsForBlock processes rewards for all fills that happened in a block. The amount A of the reward token to be distributed to traders is defined as:

A = min(F, T)

where:

`T` is the amount of available reward tokens in the `treasury_account`.
`F` = fee_multiplier * (total_positive_maker_fees +
	                    total taker fees -
	                    maximum possible maker rebate * total taker volume)
                     / reward_token_price

func (Keeper) SetParams

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

SetParams updates the Params in state. Returns an error iff validation fails.

func (Keeper) SetRewardShare

func (k Keeper) SetRewardShare(
	ctx sdk.Context,
	rewardShare types.RewardShare,
)

SetRewardShare set a reward share object under rewardShare.Address.

Jump to

Keyboard shortcuts

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