keeper

package
v0.10.0-externliq Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalcMTPInterestLiabilities added in v0.10.0

func CalcMTPInterestLiabilities(mtp *types.MTP, interestRate sdk.Dec, epochPosition, epochLength int64) sdk.Int

func GetEpochPosition added in v0.10.0

func GetEpochPosition(ctx sdk.Context, epochLength int64) int64

get position of current block in epoch

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 {
	types.AuthorizationChecker
	types.PositionChecker
	types.PoolChecker
	types.OpenLongChecker
	// contains filtered or unexported fields
}

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	storeKey,
	memKey storetypes.StoreKey,
	authority string,
	amm types.AmmKeeper,
	bk types.BankKeeper,
	oracleKeeper ammtypes.OracleKeeper,
) *Keeper

func (Keeper) Borrow added in v0.10.0

func (k Keeper) Borrow(ctx sdk.Context, collateralAsset string, collateralAmount sdk.Int, custodyAmount sdk.Int, mtp *types.MTP, ammPool *ammtypes.Pool, pool *types.Pool, eta sdk.Dec) error

func (Keeper) CalculatePoolHealth added in v0.10.0

func (k Keeper) CalculatePoolHealth(ctx sdk.Context, pool *types.Pool) sdk.Dec

func (Keeper) CheckIfWhitelisted added in v0.10.0

func (k Keeper) CheckIfWhitelisted(ctx sdk.Context, address string) bool

func (Keeper) CheckMaxOpenPositions added in v0.10.0

func (k Keeper) CheckMaxOpenPositions(ctx sdk.Context) error

func (Keeper) CheckMinLiabilities added in v0.10.0

func (k Keeper) CheckMinLiabilities(ctx sdk.Context, collateralAmount sdk.Coin, eta sdk.Dec, pool types.Pool, ammPool ammtypes.Pool, custodyAsset string) error

func (Keeper) CheckPoolHealth added in v0.10.0

func (k Keeper) CheckPoolHealth(ctx sdk.Context, poolId uint64) error

func (Keeper) CheckUserAuthorization added in v0.10.0

func (k Keeper) CheckUserAuthorization(ctx sdk.Context, msg *types.MsgOpen) error

func (Keeper) DestroyMTP added in v0.10.0

func (k Keeper) DestroyMTP(ctx sdk.Context, mtpAddress string, id uint64) error

func (Keeper) DewhitelistAddress added in v0.10.0

func (k Keeper) DewhitelistAddress(ctx sdk.Context, address string)

func (Keeper) EmitFundPayment added in v0.10.0

func (k Keeper) EmitFundPayment(ctx sdk.Context, mtp *types.MTP, takeAmount sdk.Int, takeAsset string, paymentType string)

func (Keeper) EstimateSwap added in v0.10.0

func (k Keeper) EstimateSwap(ctx sdk.Context, tokenInAmount sdk.Coin, tokenOutDenom string, ammPool ammtypes.Pool) (sdk.Int, error)

Swap estimation using amm CalcOutAmtGivenIn function

func (Keeper) GenerateOpenEvent added in v0.10.0

func (k Keeper) GenerateOpenEvent(mtp *types.MTP) sdk.Event

func (Keeper) GetAllMTPs added in v0.10.0

func (k Keeper) GetAllMTPs(ctx sdk.Context) []types.MTP

func (Keeper) GetAllPools added in v0.10.0

func (k Keeper) GetAllPools(ctx sdk.Context) (list []types.Pool)

GetAllPool returns all pool

func (Keeper) GetAllWhitelistedAddress added in v0.10.0

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

func (Keeper) GetAmmPool added in v0.10.0

func (k Keeper) GetAmmPool(ctx sdk.Context, poolId uint64, nonNativeAsset string) (ammtypes.Pool, error)

func (Keeper) GetAmmPoolBalance added in v0.10.0

func (k Keeper) GetAmmPoolBalance(ctx sdk.Context, ammPool ammtypes.Pool, assetDenom string) (sdk.Int, error)

Get balance of a denom

func (Keeper) GetEnabledPools added in v0.10.0

func (k Keeper) GetEnabledPools(ctx sdk.Context) []uint64

func (Keeper) GetEpochLength added in v0.10.0

func (k Keeper) GetEpochLength(ctx sdk.Context) int64

func (Keeper) GetFirstValidPool added in v0.10.0

func (k Keeper) GetFirstValidPool(ctx sdk.Context, borrowAsset string) (uint64, error)

func (Keeper) GetForceCloseFundAddress added in v0.10.0

func (k Keeper) GetForceCloseFundAddress(ctx sdk.Context) sdk.AccAddress

func (Keeper) GetForceCloseFundPercentage added in v0.10.0

func (k Keeper) GetForceCloseFundPercentage(ctx sdk.Context) sdk.Dec

func (Keeper) GetHealthGainFactor added in v0.10.0

func (k Keeper) GetHealthGainFactor(ctx sdk.Context) sdk.Dec

func (Keeper) GetIncrementalInterestPaymentEnabled added in v0.10.0

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

func (Keeper) GetIncrementalInterestPaymentFundAddress added in v0.10.0

func (k Keeper) GetIncrementalInterestPaymentFundAddress(ctx sdk.Context) sdk.AccAddress

func (Keeper) GetIncrementalInterestPaymentFundPercentage added in v0.10.0

func (k Keeper) GetIncrementalInterestPaymentFundPercentage(ctx sdk.Context) sdk.Dec

func (Keeper) GetInterestRateDecrease added in v0.10.0

func (k Keeper) GetInterestRateDecrease(ctx sdk.Context) sdk.Dec

func (Keeper) GetInterestRateIncrease added in v0.10.0

func (k Keeper) GetInterestRateIncrease(ctx sdk.Context) sdk.Dec

func (Keeper) GetInterestRateMax added in v0.10.0

func (k Keeper) GetInterestRateMax(ctx sdk.Context) sdk.Dec

func (Keeper) GetInterestRateMin added in v0.10.0

func (k Keeper) GetInterestRateMin(ctx sdk.Context) sdk.Dec

func (Keeper) GetMTP added in v0.10.0

func (k Keeper) GetMTP(ctx sdk.Context, mtpAddress string, id uint64) (types.MTP, error)

func (Keeper) GetMTPCount added in v0.10.0

func (k Keeper) GetMTPCount(ctx sdk.Context) uint64

func (Keeper) GetMTPIterator added in v0.10.0

func (k Keeper) GetMTPIterator(ctx sdk.Context) sdk.Iterator

func (Keeper) GetMTPs added in v0.10.0

func (k Keeper) GetMTPs(ctx sdk.Context, pagination *query.PageRequest) ([]*types.MTP, *query.PageResponse, error)

func (Keeper) GetMTPsForAddress added in v0.10.0

func (k Keeper) GetMTPsForAddress(ctx sdk.Context, mtpAddress sdk.Address, pagination *query.PageRequest) ([]*types.MTP, *query.PageResponse, error)

func (Keeper) GetMTPsForPool added in v0.10.0

func (k Keeper) GetMTPsForPool(ctx sdk.Context, ammPoolId uint64, pagination *query.PageRequest) ([]*types.MTP, *query.PageResponse, error)

func (Keeper) GetMaxLeverageParam added in v0.10.0

func (k Keeper) GetMaxLeverageParam(ctx sdk.Context) sdk.Dec

func (Keeper) GetMaxOpenPositions added in v0.10.0

func (k Keeper) GetMaxOpenPositions(ctx sdk.Context) int64

func (Keeper) GetNonNativeAsset added in v0.10.0

func (k Keeper) GetNonNativeAsset(collateralAsset string, borrowAsset string) string

func (Keeper) GetOpenMTPCount added in v0.10.0

func (k Keeper) GetOpenMTPCount(ctx sdk.Context) uint64

func (Keeper) GetParams

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

GetParams get all parameters as types.Params

func (Keeper) GetPool added in v0.10.0

func (k Keeper) GetPool(
	ctx sdk.Context,
	poolId uint64,

) (val types.Pool, found bool)

GetPool returns a pool from its index

func (Keeper) GetPoolOpenThreshold added in v0.10.0

func (k Keeper) GetPoolOpenThreshold(ctx sdk.Context) sdk.Dec

func (Keeper) GetPositions added in v0.10.0

func (k Keeper) GetPositions(goCtx context.Context, req *types.PositionsRequest) (*types.PositionsResponse, error)

func (Keeper) GetPositionsByPool added in v0.10.0

func (k Keeper) GetPositionsByPool(goCtx context.Context, req *types.PositionsByPoolRequest) (*types.PositionsByPoolResponse, error)

func (Keeper) GetPositionsForAddress added in v0.10.0

func (Keeper) GetRemovalQueueThreshold added in v0.10.0

func (k Keeper) GetRemovalQueueThreshold(ctx sdk.Context) sdk.Dec

func (Keeper) GetSafetyFactor added in v0.10.0

func (k Keeper) GetSafetyFactor(ctx sdk.Context) sdk.Dec

func (Keeper) GetSqModifier added in v0.10.0

func (k Keeper) GetSqModifier(ctx sdk.Context) sdk.Dec

func (Keeper) GetStatus added in v0.10.0

func (k Keeper) GetStatus(goCtx context.Context, req *types.StatusRequest) (*types.StatusResponse, error)

func (Keeper) GetWhitelist added in v0.10.0

func (k Keeper) GetWhitelist(goCtx context.Context, req *types.WhitelistRequest) (*types.WhitelistResponse, error)

func (Keeper) GetWhitelistAddressIterator added in v0.10.0

func (k Keeper) GetWhitelistAddressIterator(ctx sdk.Context) sdk.Iterator

func (Keeper) GetWhitelistedAddress added in v0.10.0

func (k Keeper) GetWhitelistedAddress(ctx sdk.Context, pagination *query.PageRequest) ([]string, *query.PageResponse, error)

func (Keeper) HandleInterestPayment added in v0.10.0

func (k Keeper) HandleInterestPayment(ctx sdk.Context, interestPayment sdk.Int, mtp *types.MTP, pool *types.Pool, ammPool ammtypes.Pool) sdk.Int

func (Keeper) HasSufficientPoolBalance added in v0.10.0

func (k Keeper) HasSufficientPoolBalance(ctx sdk.Context, ammPool ammtypes.Pool, assetDenom string, requiredAmount sdk.Int) bool

Check if amm pool has sufficcient balance

func (Keeper) IncrementalInterestPayment added in v0.10.0

func (k Keeper) IncrementalInterestPayment(ctx sdk.Context, interestPayment sdk.Int, mtp *types.MTP, pool *types.Pool, ammPool ammtypes.Pool) (sdk.Int, error)

func (Keeper) InterestRateComputation added in v0.10.0

func (k Keeper) InterestRateComputation(ctx sdk.Context, pool types.Pool, ammPool ammtypes.Pool) (sdk.Dec, error)

func (Keeper) IsPoolClosed added in v0.10.0

func (k Keeper) IsPoolClosed(ctx sdk.Context, poolId uint64) bool

func (Keeper) IsPoolEnabled added in v0.10.0

func (k Keeper) IsPoolEnabled(ctx sdk.Context, poolId uint64) bool

func (Keeper) IsWhitelisted added in v0.10.0

func (Keeper) IsWhitelistingEnabled added in v0.10.0

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

func (Keeper) Logger

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

func (Keeper) MTP added in v0.10.0

func (k Keeper) MTP(goCtx context.Context, req *types.MTPRequest) (*types.MTPResponse, error)

func (Keeper) OpenLong added in v0.10.0

func (k Keeper) OpenLong(ctx sdk.Context, poolId uint64, msg *types.MsgOpen) (*types.MTP, error)

func (Keeper) Params

func (k Keeper) Params(goCtx context.Context, req *types.ParamsRequest) (*types.ParamsResponse, error)

func (Keeper) Pool added in v0.10.0

func (Keeper) Pools added in v0.10.0

func (Keeper) RemovePool added in v0.10.0

func (k Keeper) RemovePool(
	ctx sdk.Context,
	index uint64,

)

RemovePool removes a pool from the store

func (Keeper) Repay added in v0.10.0

func (k Keeper) Repay(ctx sdk.Context, mtp *types.MTP, pool *types.Pool, ammPool ammtypes.Pool, repayAmount sdk.Int, takeFundPayment bool) error

func (Keeper) SetEnabledPools added in v0.10.0

func (k Keeper) SetEnabledPools(ctx sdk.Context, pools []uint64)

func (Keeper) SetMTP added in v0.10.0

func (k Keeper) SetMTP(ctx sdk.Context, mtp *types.MTP) error

func (Keeper) SetMTPCount added in v0.10.0

func (k Keeper) SetMTPCount(ctx sdk.Context, count uint64)

Set MTP count

func (Keeper) SetOpenMTPCount added in v0.10.0

func (k Keeper) SetOpenMTPCount(ctx sdk.Context, count uint64)

Set Open MTP count

func (Keeper) SetParams

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

SetParams set the params

func (Keeper) SetPool added in v0.10.0

func (k Keeper) SetPool(ctx sdk.Context, pool types.Pool)

SetPool set a specific pool in the store from its index

func (Keeper) TakeFundPayment added in v0.10.0

func (k Keeper) TakeFundPayment(ctx sdk.Context, returnAmount sdk.Int, returnAsset string, takePercentage sdk.Dec, fundAddr sdk.AccAddress, ammPool *ammtypes.Pool) (sdk.Int, error)

func (Keeper) TakeInCustody added in v0.10.0

func (k Keeper) TakeInCustody(ctx sdk.Context, mtp types.MTP, pool *types.Pool) error

func (Keeper) TakeOutCustody added in v0.10.0

func (k Keeper) TakeOutCustody(ctx sdk.Context, mtp types.MTP, pool *types.Pool) error

func (Keeper) UpdateMTPHealth added in v0.10.0

func (k Keeper) UpdateMTPHealth(ctx sdk.Context, mtp types.MTP, ammPool ammtypes.Pool) (sdk.Dec, error)

func (Keeper) UpdatePoolHealth added in v0.10.0

func (k Keeper) UpdatePoolHealth(ctx sdk.Context, pool *types.Pool) error

func (Keeper) ValidateCollateralAsset added in v0.10.0

func (k Keeper) ValidateCollateralAsset(collateralAsset string) error

func (Keeper) WhitelistAddress added in v0.10.0

func (k Keeper) WhitelistAddress(ctx sdk.Context, address string)

Jump to

Keyboard shortcuts

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