keeper

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OneWeek  = 7 * 24 * 3600
	OneYear  = OneWeek * 52
	OneMonth = OneWeek * 4
	BASE     = 1
)

Variables

This section is empty.

Functions

func CalculateInterestAmount

func CalculateInterestAmount(apy sdk.Dec, payFreq int) (sdk.Dec, error)

func CalculateInterestFactor

func CalculateInterestFactor(perSecondInterestRate sdk.Dec, secondsElapsed sdkmath.Int) sdk.Dec

CalculateInterestFactor calculates the simple interest scaling factor, which is equal to: (per-second interest rate * number of seconds elapsed) Will return 1.000x, multiply by principal to get new principal with added interest

func CalculateInterestRate

func CalculateInterestRate(apy sdk.Dec, payFreq int) sdk.Dec

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 {
	NftKeeper types.NFTKeeper
	// contains filtered or unexported fields
}

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	storeKey,
	memKey storetypes.StoreKey,
	ps paramtypes.Subspace,
	kycKeeper types.KycKeeper,
	bankKeeper types.BankKeeper,
	accKeeper types.AccountKeeper,
	nftKeeper types.NFTKeeper,
	pricefeedkeeper types.PriceFeedKeeper,
	auctionKeeper types.AuctionKeeper,
	incentiveKeeper types.IncentiveKeeper,
) *Keeper

func (Keeper) AddInvestorToPool

func (k Keeper) AddInvestorToPool(ctx sdk.Context, poolWithInvestors *types.PoolWithInvestors)

AddInvestorToPool add investors to the give pool

func (Keeper) AfterSPVInterestPaid added in v0.1.0

func (k Keeper) AfterSPVInterestPaid(ctx sdk.Context, poolID string, amt sdkmath.Int)

AfterSPVInterestPaid - call hook if registered to update the pool's incentives

func (Keeper) ArchieveDepositor added in v0.1.0

func (k Keeper) ArchieveDepositor(ctx sdk.Context, depositor types.DepositorInfo)

ArchieveDepositor archives the depositor

func (Keeper) ArchiveClass added in v0.1.0

func (k Keeper) ArchiveClass(ctx sdk.Context, classID string)

ArchiveClass archives the class

func (Keeper) ArchiveNFT added in v0.1.0

func (k Keeper) ArchiveNFT(ctx sdk.Context, classID, nftID string) error

ArchiveNFT archives the NFT

func (Keeper) ArchivePool added in v0.1.0

func (k Keeper) ArchivePool(ctx sdk.Context, poolInfo types.PoolInfo)

ArchivePool archives the pool

func (Keeper) BeforeNFTBurned added in v0.1.0

func (k Keeper) BeforeNFTBurned(ctx sdk.Context, poolIndex string, walletAddress string, linkednfts []string) error

func (Keeper) DelDepositor

func (k Keeper) DelDepositor(ctx sdk.Context, depositor types.DepositorInfo)

DelDepositor sets the depositor

func (Keeper) DelPool

func (k Keeper) DelPool(ctx sdk.Context, index string)

func (Keeper) Depositor

func (Keeper) DepositorHistory added in v0.1.0

func (Keeper) GetDepositor

func (k Keeper) GetDepositor(ctx sdk.Context, poolIndex string, walletAddress sdk.AccAddress) (depositor types.DepositorInfo, found bool)

func (Keeper) GetDepositorHistory

func (k Keeper) GetDepositorHistory(ctx sdk.Context, timeStamp time.Time, poolIndex string, addr sdk.AccAddress) (types.DepositorInfo, bool)

GetDepositorHistory sets the depositor to history store

func (Keeper) GetDepositorTotalBorrowedAmount added in v0.1.0

func (k Keeper) GetDepositorTotalBorrowedAmount(ctx sdk.Context, depositor sdk.AccAddress, poolID string) (borrowed math.Int, found bool)

func (Keeper) GetHistoryPools added in v0.1.0

func (k Keeper) GetHistoryPools(ctx sdk.Context, index string) (poolInfo types.PoolInfo, ok bool)

GetHistoryPools gets the poolInfo with given pool index

func (Keeper) GetInvestorToPool

func (k Keeper) GetInvestorToPool(ctx sdk.Context, poolIndex string) (currentInvestorPool types.PoolWithInvestors, found bool)

func (Keeper) GetOrCreate added in v0.1.0

func (k Keeper) GetOrCreate(ctx sdk.Context, classID string) (nfttypes.Class, error)

func (Keeper) GetParams

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

GetParams get all parameters as types.Params

func (Keeper) GetParamsV21 added in v0.1.0

func (k Keeper) GetParamsV21(ctx sdk.Context) sdkmath.Int

GetParams get all parameters as types.Params

func (Keeper) GetPoolBorrowed added in v0.1.0

func (k Keeper) GetPoolBorrowed(ctx sdk.Context, poolIndex string) (borrowed math.Int, ok bool)

func (Keeper) GetPools

func (k Keeper) GetPools(ctx sdk.Context, index string) (poolInfo types.PoolInfo, ok bool)

GetPools gets the poolInfo with given pool index

func (Keeper) GetReserve

func (k Keeper) GetReserve(ctx sdk.Context, denom string) (amount sdk.Coin, ok bool)

GetReserve gets the poolInfo with given pool index

func (Keeper) HandleInterest

func (k Keeper) HandleInterest(ctx sdk.Context, poolInfo *types.PoolInfo) error

func (Keeper) HandlePartialPrincipalPayment

func (k Keeper) HandlePartialPrincipalPayment(ctx sdk.Context, poolInfo *types.PoolInfo, withdrawAccounts []sdk.AccAddress) bool

func (Keeper) HandlePrincipalPayment

func (k Keeper) HandlePrincipalPayment(ctx sdk.Context, poolInfo *types.PoolInfo) bool

func (Keeper) HandleTransfer

func (k Keeper) HandleTransfer(ctx sdk.Context, poolInfo *types.PoolInfo) bool

HandleTransfer if the pool have enough withdrawal amount, we can return the full amount of the investors otherwise, we can only return the partial of the principal

func (*Keeper) IsHookSet added in v0.1.0

func (k *Keeper) IsHookSet() bool

func (Keeper) IterSPVReserve added in v0.1.2

func (k Keeper) IterSPVReserve(ctx sdk.Context, cb func(coin sdk.Coin) (stop bool))

func (Keeper) IterateDepositors

func (k Keeper) IterateDepositors(ctx sdk.Context, poolIndex string, cb func(depositor types.DepositorInfo) (stop bool))

IterateDepositors iterates over all deposit objects in the store and performs a callback function

func (Keeper) IterateInvestorPools

func (k Keeper) IterateInvestorPools(ctx sdk.Context, cb func(poolWithInvestors types.PoolWithInvestors) (stop bool))

IterateInvestorPools iterates over all pools objects in the store and performs a callback function

func (Keeper) IteratePool

func (k Keeper) IteratePool(ctx sdk.Context, cb func(poolInfo types.PoolInfo) (stop bool))

IteratePool iterates over all deposit objects in the store and performs a callback function

func (Keeper) IterateReserve

func (k Keeper) IterateReserve(ctx sdk.Context, cb func(coin sdk.Coin) (stop bool))

IterateReserve get the spv reserve token

func (Keeper) IteratorAllDepositorHistory added in v0.1.0

func (k Keeper) IteratorAllDepositorHistory(ctx sdk.Context, poolIndex string, cb func(depositor types.DepositorInfo) (stop bool))

IteratorAllDepositorHistory gets all the depositor to history store

func (Keeper) ListHistoryPools added in v0.1.0

func (k Keeper) ListHistoryPools(goCtx context.Context, req *types.QueryListPoolsRequest) (*types.QueryListPoolsResponse, error)

func (Keeper) ListPools

func (Keeper) Logger

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

func (Keeper) Params

func (Keeper) QueryHistoryPool added in v0.1.0

func (k Keeper) QueryHistoryPool(goCtx context.Context, req *types.QueryQueryPoolRequest) (*types.QueryQueryPoolResponse, error)

func (Keeper) QueryPool

func (Keeper) RunSurplusAuctions added in v0.0.6

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

RunSurplusAuctions nets the surplus and debt balances and then creates surplus or debt auctions if the remaining balance is above the auction threshold parameter

func (Keeper) SetDepositor

func (k Keeper) SetDepositor(ctx sdk.Context, depositor types.DepositorInfo)

SetDepositor sets the depositor

func (Keeper) SetDepositorHistory

func (k Keeper) SetDepositorHistory(ctx sdk.Context, depositor types.DepositorInfo)

SetDepositorHistory sets the depositor to history store

func (Keeper) SetHistoryPool

func (k Keeper) SetHistoryPool(ctx sdk.Context, poolInfo types.PoolInfo)

SetHistoryPool sets the pool

func (*Keeper) SetHooks added in v0.1.0

func (k *Keeper) SetHooks(sh types.SPVHooks) *Keeper

SetHooks adds hooks to the keeper.

func (*Keeper) SetIncentiveKeeper added in v0.1.2

func (k *Keeper) SetIncentiveKeeper(incentiveKeeper types.IncentiveKeeper) *Keeper

func (Keeper) SetParams

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

SetParams set the params

func (Keeper) SetPool

func (k Keeper) SetPool(ctx sdk.Context, poolInfo types.PoolInfo)

SetPool sets the pool

func (Keeper) SetReserve

func (k Keeper) SetReserve(ctx sdk.Context, reserved sdk.Coin)

SetReserve sets the pool

func (Keeper) UpdateIncentive added in v0.1.2

func (k Keeper) UpdateIncentive(ctx sdk.Context, poolInfo types.PoolInfo)

UpdateIncentive updates the incentive for the pool to the incentive module

Jump to

Keyboard shortcuts

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