keeper

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2020 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CdpsForExistingPrice added in v1.5.0

func CdpsForExistingPrice(k Keeper) sdk.Invariant

CdpsForExistingPrice checks that each Cdp currently opened refers to an existing token priced by x/pricefeed.

func LiquidityPoolAmountEqualsCdps added in v1.5.0

func LiquidityPoolAmountEqualsCdps(k Keeper) sdk.Invariant

LiquidityPoolAmountEqualsCdps checks that the value of all the opened cdps equals the liquidity pool amount.

func NewHandler

func NewHandler(keeper Keeper) sdk.Handler

func NewQuerier

func NewQuerier(keeper Keeper) sdk.Querier

func RegisterInvariants added in v1.5.0

func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)

Types

type Keeper

type Keeper struct {
	// contains filtered or unexported fields
}

func NewKeeper

func NewKeeper(cdc *codec.Codec, key sdk.StoreKey, supplyKeeper supply.Keeper, pk pricefeed.Keeper) Keeper

func SetupTestInput

func SetupTestInput() (sdk.Context, bank.Keeper, pricefeed.Keeper, Keeper)

func (Keeper) AddCdp

func (k Keeper) AddCdp(ctx sdk.Context, cdp types.Cdp)

AddCdp adds a Cdp to the user's Cdps list

func (Keeper) CloseCdp

func (k Keeper) CloseCdp(ctx sdk.Context, user sdk.AccAddress, timestamp int64) sdk.Error

CloseCdp subtract the Cdp's liquidity amount (commercio cash credits) from user's wallet, after that sends the deposited amount back to it. If these two operations ends without errors, the Cdp get closed. Errors occurs if:k.GetCdpsByOwner(ctx, testCdpOwner) - cdp doesnt exist - subtracting or adding fund to account don't end well

func (Keeper) GetCdpByOwnerAndTimeStamp

func (k Keeper) GetCdpByOwnerAndTimeStamp(ctx sdk.Context, owner sdk.AccAddress, timestamp int64) (cdp types.Cdp, found bool)

func (Keeper) GetCdps

func (k Keeper) GetCdps(ctx sdk.Context) types.Cdps

func (Keeper) GetCdpsByOwner

func (k Keeper) GetCdpsByOwner(ctx sdk.Context, owner sdk.AccAddress) (cdps types.Cdps)

func (Keeper) GetCreditsDenom

func (k Keeper) GetCreditsDenom(ctx sdk.Context) string

func (Keeper) GetLiquidityPoolAmount

func (k Keeper) GetLiquidityPoolAmount(ctx sdk.Context) sdk.Coins

GetLiquidityPoolAmount returns the current liquidity pool amount

func (Keeper) GetMintModuleAccount

func (k Keeper) GetMintModuleAccount(ctx sdk.Context) exported.ModuleAccountI

GetMintModuleAccount returns the commerciomint ModuleAccount

func (Keeper) OpenCdp

func (k Keeper) OpenCdp(ctx sdk.Context, depositor sdk.AccAddress, depositAmount sdk.Coins) sdk.Error

OpenCdp subtract the given token's amount from user's wallet and deposit it into the liquidity pool then, sending him the corresponding credits amount. If all these operations are done correctly, a Collateralized Debt Position is opened. Errors occurs if: 1) deposited tokens haven't been priced yet, or are negatives or invalid; 2) signer's funds are not enough

func (Keeper) SetCreditsDenom

func (k Keeper) SetCreditsDenom(ctx sdk.Context, den string)

Jump to

Keyboard shortcuts

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