Documentation ¶
Index ¶
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- type Keeper
- func (k Keeper) AddRewardShareToAddress(ctx sdk.Context, address string, weight *big.Int)
- func (k Keeper) AddRewardSharesForFill(ctx sdk.Context, takerAddress string, makerAddress string, ...)
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) GetRewardShare(ctx sdk.Context, address string) (val types.RewardShare)
- func (k Keeper) HasAuthority(authority string) bool
- func (k Keeper) InitializeForGenesis(ctx sdk.Context)
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (k Keeper) ProcessRewardsForBlock(ctx sdk.Context) error
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params) error
- func (k Keeper) SetRewardShare(ctx sdk.Context, rewardShare types.RewardShare)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMsgServerImpl ¶
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 ¶
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) GetRewardShare ¶
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 (Keeper) InitializeForGenesis ¶
func (Keeper) Params ¶
func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
func (Keeper) ProcessRewardsForBlock ¶
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 ¶
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.