types

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: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModuleName   = "commerciomint"
	StoreKey     = ModuleName
	RouterKey    = ModuleName
	QuerierRoute = ModuleName

	CdpStorePrefix       = ":cdp:"
	CreditsDenomStoreKey = "creditsDenom"

	QueryGetCdp  = "cdp"
	QueryGetCdps = "cdps"

	MsgTypeOpenCdp  = "openCdp"
	MsgTypeCloseCdp = "closeCdp"
)

Variables

View Source
var ModuleCdc *codec.Codec

Functions

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers concrete types on wire codec

Types

type Cdp

type Cdp struct {
	Owner           sdk.AccAddress `json:"owner"`
	DepositedAmount sdk.Coins      `json:"deposited_amount"`
	CreditsAmount   sdk.Coins      `json:"credits_amount"`
	Timestamp       int64          `json:"timestamp"` // Block height at which the CDP has been created
}

Cdp represents a Collateralized Debt position that is open from a user in order to convert any currently priced token into stable Commercio Cash Credits

func NewCdp

func NewCdp(owner sdk.AccAddress, depositAmount sdk.Coins, liquidityAmount sdk.Coins, timeStamp int64) Cdp

func (Cdp) Equals

func (current Cdp) Equals(cdp Cdp) bool

Equals returns true if and only if the two CDPs instances contain the same data

func (Cdp) Validate

func (current Cdp) Validate() error

Validate verifies that the data contained inside this CDP are all valid, returning an error is something isn't valid

type Cdps

type Cdps []Cdp

Cdps represents a slice of CDP objects

func (Cdps) AppendIfMissing

func (cdps Cdps) AppendIfMissing(cdp Cdp) (Cdps, bool)

AppendIfMissing appends the given cdp to the list of cdps if it does not exist inside it yet, returning also true if the object has been appended successfully

func (Cdps) RemoveWhenFound

func (cdps Cdps) RemoveWhenFound(timestamp int64) (Cdps, bool)

RemoveWhenFound filters a slice without allocating a new underlying array

type MsgCloseCdp

type MsgCloseCdp struct {
	Signer    sdk.AccAddress `json:"signer"`
	Timestamp int64          `json:"cdp_timestamp"` // Block height at which the CDP has been created
}

func NewMsgCloseCdp

func NewMsgCloseCdp(signer sdk.AccAddress, timestamp int64) MsgCloseCdp

func (MsgCloseCdp) GetSignBytes

func (msg MsgCloseCdp) GetSignBytes() []byte

GetSignBytes Implements Msg.

func (MsgCloseCdp) GetSigners

func (msg MsgCloseCdp) GetSigners() []sdk.AccAddress

GetSigners Implements Msg.

func (MsgCloseCdp) Route

func (msg MsgCloseCdp) Route() string

Route Implements Msg.

func (MsgCloseCdp) Type

func (msg MsgCloseCdp) Type() string

Type Implements Msg.

func (MsgCloseCdp) ValidateBasic

func (msg MsgCloseCdp) ValidateBasic() sdk.Error

type MsgOpenCdp

type MsgOpenCdp struct {
	Depositor       sdk.AccAddress `json:"depositor"`
	DepositedAmount sdk.Coins      `json:"deposit_amount"`
}

func NewMsgOpenCdp

func NewMsgOpenCdp(depositAmount sdk.Coins, depositor sdk.AccAddress) MsgOpenCdp

func (MsgOpenCdp) GetSignBytes

func (msg MsgOpenCdp) GetSignBytes() []byte

GetSignBytes Implements Msg.

func (MsgOpenCdp) GetSigners

func (msg MsgOpenCdp) GetSigners() []sdk.AccAddress

GetSigners Implements Msg.

func (MsgOpenCdp) Route

func (msg MsgOpenCdp) Route() string

Route Implements Msg.

func (MsgOpenCdp) Type

func (msg MsgOpenCdp) Type() string

Type Implements Msg.

func (MsgOpenCdp) ValidateBasic

func (msg MsgOpenCdp) ValidateBasic() sdk.Error

Jump to

Keyboard shortcuts

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