keeper

package
v0.0.8-testnet Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2023 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 {
	// 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,
) *Keeper

func (Keeper) AddInvestorToPool

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

AddInvestorToPool add investors to the give pool

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) 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) GetInvestorToPool

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

func (Keeper) GetParams

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

GetParams get all parameters as types.Params

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) 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) ListPools

func (Keeper) Logger

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

func (Keeper) Params

func (Keeper) QueryPool

func (Keeper) RunSurplusAuctions added in v0.0.6

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

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) 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

Jump to

Keyboard shortcuts

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