types

package
v0.2.2-0...-13ba25a Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2020 License: Apache-2.0 Imports: 6 Imported by: 65

Documentation

Index

Constants

View Source
const (
	// Bech32PrefixAccAddr defines the Bech32 prefix of an account's address
	Bech32MainPrefix = "commit"

	// PrefixValidator is the prefix for validator keys
	PrefixValidator = "val"
	// PrefixConsensus is the prefix for consensus keys
	PrefixConsensus = "cons"
	// PrefixPublic is the prefix for public keys
	PrefixPublic = "pub"
	// PrefixOperator is the prefix for operator keys
	PrefixOperator = "oper"

	// Bech32PrefixAccAddr defines the Bech32 prefix of an account's address
	Bech32PrefixAccAddr = Bech32MainPrefix
	// Bech32PrefixAccPub defines the Bech32 prefix of an account's public key
	Bech32PrefixAccPub = Bech32MainPrefix + PrefixPublic
	// Bech32PrefixValAddr defines the Bech32 prefix of a validator's operator address
	Bech32PrefixValAddr = Bech32MainPrefix + PrefixValidator + PrefixOperator
	// Bech32PrefixValPub defines the Bech32 prefix of a validator's operator public key
	Bech32PrefixValPub = Bech32MainPrefix + PrefixValidator + PrefixOperator + PrefixPublic
	// Bech32PrefixConsAddr defines the Bech32 prefix of a consensus node address
	Bech32PrefixConsAddr = Bech32MainPrefix + PrefixValidator + PrefixConsensus
	// Bech32PrefixConsPub defines the Bech32 prefix of a consensus node public key
	Bech32PrefixConsPub = Bech32MainPrefix + PrefixValidator + PrefixConsensus + PrefixPublic
)
View Source
const (
	CodeSendDisabled                cTypes.CodeType = 101
	CodeInvalidInputsOutputs        cTypes.CodeType = 102
	CodeNegativeAmount              cTypes.CodeType = 103
	CodeGoValidation                cTypes.CodeType = 104
	CodeFromName                    cTypes.CodeType = 105
	CodeZoneIDFromString            cTypes.CodeType = 106
	CodeAccAddressFromBech32        cTypes.CodeType = 107
	CodeOrganizationIDFromString    cTypes.CodeType = 108
	CodeInvalidOrganization         cTypes.CodeType = 109
	CodeInvalidOrganizationWithZone cTypes.CodeType = 110
	CodeInvalidACLAccount           cTypes.CodeType = 111
	CodeUnAuthorizedTransaction     cTypes.CodeType = 112
	CodeInvalidQuery                cTypes.CodeType = 113
	CodeInvalidFields               cTypes.CodeType = 114
	CodeNotEqual                    cTypes.CodeType = 115
	CodeResponseDataLengthZero      cTypes.CodeType = 116
	CodePegHashHex                  cTypes.CodeType = 117
	CodeMarshal                     cTypes.CodeType = 118
	CodeUnmarshal                   cTypes.CodeType = 119
	CodeKeyBase                     cTypes.CodeType = 120
	CodeSign                        cTypes.CodeType = 121
	CodeNegotiationIDFromString     cTypes.CodeType = 122
	CodeZoneIDExists                cTypes.CodeType = 123
	CodeOrganizationIDExists        cTypes.CodeType = 124
)
View Source
const BondDenom = "ucommit"

Variables

This section is empty.

Functions

func ErrAccAddressFromBech32

func ErrAccAddressFromBech32(codeSpace cTypes.CodespaceType, address string) cTypes.Error

func ErrEmptyRequestFields

func ErrEmptyRequestFields(codeSpace cTypes.CodespaceType, fields string) cTypes.Error

func ErrFromName

func ErrFromName(codeSpace cTypes.CodespaceType) cTypes.Error

func ErrGoValidator

func ErrGoValidator(codeSpace cTypes.CodespaceType) cTypes.Error

func ErrInputOutputMismatch

func ErrInputOutputMismatch(codespace cTypes.CodespaceType) cTypes.Error

func ErrInvalidACLAccount

func ErrInvalidACLAccount(codeSpace cTypes.CodespaceType, address string) cTypes.Error

func ErrInvalidOrganization

func ErrInvalidOrganization(codeSpace cTypes.CodespaceType) cTypes.Error

func ErrInvalidOrganizationWithZone

func ErrInvalidOrganizationWithZone(codeSpace cTypes.CodespaceType) cTypes.Error

func ErrKeyBase

func ErrKeyBase(codeSpace cTypes.CodespaceType) cTypes.Error

func ErrMarshal

func ErrMarshal(codeSpace cTypes.CodespaceType, param string) cTypes.Error

func ErrNegativeAmount

func ErrNegativeAmount(codeSpace cTypes.CodespaceType, msg string) cTypes.Error

func ErrNegotiationIDFromString

func ErrNegotiationIDFromString(codeSpace cTypes.CodespaceType, ID string) cTypes.Error

func ErrNoInputs

func ErrNoInputs(codespace cTypes.CodespaceType) cTypes.Error

func ErrNoOutputs

func ErrNoOutputs(codespace cTypes.CodespaceType) cTypes.Error

func ErrNotEqual

func ErrNotEqual(codeSpace cTypes.CodespaceType, address1 string, address2 string) cTypes.Error

func ErrOrganizationIDExists

func ErrOrganizationIDExists(codeSpace cTypes.CodespaceType, ID string) cTypes.Error

func ErrOrganizationIDFromString

func ErrOrganizationIDFromString(codeSpace cTypes.CodespaceType, ID string) cTypes.Error

func ErrPegHashHex

func ErrPegHashHex(codeSpace cTypes.CodespaceType, _type string) cTypes.Error

func ErrQuery

func ErrQuery(codeSpace cTypes.CodespaceType, query string) cTypes.Error

func ErrQueryResponseLengthZero

func ErrQueryResponseLengthZero(codeSpace cTypes.CodespaceType, query string) cTypes.Error

func ErrSendDisabled

func ErrSendDisabled(codespace cTypes.CodespaceType) cTypes.Error

func ErrSign

func ErrSign(codeSpace cTypes.CodespaceType) cTypes.Error

func ErrUnAuthorizedTransaction

func ErrUnAuthorizedTransaction(codeSpace cTypes.CodespaceType) cTypes.Error

func ErrUnmarshal

func ErrUnmarshal(codeSpace cTypes.CodespaceType, param string) cTypes.Error

func ErrZoneIDExists

func ErrZoneIDExists(codeSpace cTypes.CodespaceType, ID string) cTypes.Error

func ErrZoneIDFromString

func ErrZoneIDFromString(codeSpace cTypes.CodespaceType, ID string) cTypes.Error

func GetFiatPegWalletBalance

func GetFiatPegWalletBalance(fiatPegWallet FiatPegWallet) int64

GetFiatPegWalletBalance : gets the total sum of all fiat pegs in a wallet

func IssueAssetPeg

func IssueAssetPeg(issuerAssetPegWallet AssetPegWallet, receiverAssetPegWallet AssetPegWallet, assetPeg AssetPeg) (AssetPegWallet, AssetPegWallet, AssetPeg)

IssueAssetPeg : issues asset peg from the zones wallet to the provided wallet

func IssueFiatPeg

func IssueFiatPeg(issuerFiatPegWallet FiatPegWallet, receiverFiatPegWallet FiatPegWallet, fiatPeg FiatPeg) (FiatPegWallet, FiatPegWallet, FiatPeg)

IssueFiatPeg : issues fiat peg from the zones wallet to the provided wallet

func RedeemAmountFromWallet

func RedeemAmountFromWallet(amount int64, fiatPegWallet FiatPegWallet) (emptiedFiatPegWallet FiatPegWallet, redeemerFiatPegWallet FiatPegWallet)

RedeemAmountFromWallet : subtract fiat peg from wallet

func ReleaseAssetPegInWallet

func ReleaseAssetPegInWallet(assetPegWallet AssetPegWallet, pegHash PegHash) bool

ReleaseAssetPegInWallet : get an asset peg in wallet and set locked to false

func SubtractAmountFromWallet

func SubtractAmountFromWallet(amount int64, fiatPegWallet FiatPegWallet) (sentFiatPegWallet FiatPegWallet, oldFiatPegWallet FiatPegWallet)

SubtractAmountFromWallet : subtract fiat peg from wallet

func SubtractAssetPegFromWallet

func SubtractAssetPegFromWallet(pegHash PegHash, assetPegWallet AssetPegWallet) (AssetPeg, AssetPegWallet)

SubtractAssetPegFromWallet : subtract asset peg from wallet

Types

type AssetPeg

type AssetPeg interface {
	GetPegHash() PegHash
	SetPegHash(PegHash) error

	GetDocumentHash() string
	SetDocumentHash(string) error

	GetAssetType() string
	SetAssetType(string) error

	GetAssetQuantity() int64
	SetAssetQuantity(int64) error

	GetAssetPrice() int64
	SetAssetPrice(int64) error

	GetQuantityUnit() string
	SetQuantityUnit(string) error

	GetOwnerAddress() cTypes.AccAddress
	SetOwnerAddress(cTypes.AccAddress) error

	GetLocked() bool
	SetLocked(bool) error

	GetModerated() bool
	SetModerated(bool) error

	GetTakerAddress() cTypes.AccAddress
	SetTakerAddress(cTypes.AccAddress) error
}

AssetPeg : comdex asset interface

func ProtoBaseAssetPeg

func ProtoBaseAssetPeg() AssetPeg

ProtoBaseAssetPeg : converts concrete to assetPeg

type AssetPegDecoder

type AssetPegDecoder func(assetPegBytes []byte) (AssetPeg, error)

AssetPegDecoder : decoder function for asset peg

type AssetPegWallet

type AssetPegWallet []BaseAssetPeg

AssetPegWallet : A wallet of AssetPegTokens

func AddAssetPegToWallet

func AddAssetPegToWallet(assetPeg AssetPeg, assetPegWallet AssetPegWallet) AssetPegWallet

AddAssetPegToWallet : add asset peg to wallet

func (AssetPegWallet) Len

func (assetPegWallet AssetPegWallet) Len() int

func (AssetPegWallet) Less

func (assetPegWallet AssetPegWallet) Less(i, j int) bool

func (AssetPegWallet) SearchAssetPeg

func (assetPegWallet AssetPegWallet) SearchAssetPeg(pegHash PegHash) int

GetAssetPeg :

func (AssetPegWallet) Sort

func (assetPegWallet AssetPegWallet) Sort() AssetPegWallet

Sort is a helper function to sort the set of asset pegs inplace

func (AssetPegWallet) Swap

func (assetPegWallet AssetPegWallet) Swap(i, j int)

type BaseAssetPeg

type BaseAssetPeg struct {
	PegHash       PegHash           `json:"pegHash"`
	DocumentHash  string            `json:"documentHash" valid:"required~Mandatory parameter documentHash missing"`
	AssetType     string            `json:"assetType" valid:"required~Mandatory parameter AssetType missing,matches(^[A-Za-z ]+$)~Parameter AssetType is Invalid"`
	AssetQuantity int64             `` /* 140-byte string literal not displayed */
	AssetPrice    int64             `` /* 131-byte string literal not displayed */
	QuantityUnit  string            `` /* 132-byte string literal not displayed */
	OwnerAddress  cTypes.AccAddress `json:"ownerAddress"`
	Locked        bool              `json:"locked"`
	Moderated     bool              `json:"moderated"`
	TakerAddress  cTypes.AccAddress `json:"takerAddress"`
}

BaseAssetPeg : base asset type

func NewBaseAssetPegWithPegHash

func NewBaseAssetPegWithPegHash(pegHash PegHash) BaseAssetPeg

NewBaseAssetPegWithPegHash a base asset peg with peg hash

func ToBaseAssetPeg

func ToBaseAssetPeg(assetPeg AssetPeg) BaseAssetPeg

ToBaseAssetPeg : convert interface to concrete

func (BaseAssetPeg) GetAssetPrice

func (baseAssetPeg BaseAssetPeg) GetAssetPrice() int64

GetAssetPrice : getter

func (BaseAssetPeg) GetAssetQuantity

func (baseAssetPeg BaseAssetPeg) GetAssetQuantity() int64

GetAssetQuantity : getter

func (BaseAssetPeg) GetAssetType

func (baseAssetPeg BaseAssetPeg) GetAssetType() string

GetAssetType : getter

func (BaseAssetPeg) GetDocumentHash

func (baseAssetPeg BaseAssetPeg) GetDocumentHash() string

GetDocumentHash : getter

func (BaseAssetPeg) GetLocked

func (baseAssetPeg BaseAssetPeg) GetLocked() bool

GetLocked : getter

func (*BaseAssetPeg) GetModerated

func (baseAssetPeg *BaseAssetPeg) GetModerated() bool

GetModerated : getter

func (BaseAssetPeg) GetOwnerAddress

func (baseAssetPeg BaseAssetPeg) GetOwnerAddress() cTypes.AccAddress

GetOwnerAddress : getter

func (BaseAssetPeg) GetPegHash

func (baseAssetPeg BaseAssetPeg) GetPegHash() PegHash

GetPegHash : getter

func (BaseAssetPeg) GetQuantityUnit

func (baseAssetPeg BaseAssetPeg) GetQuantityUnit() string

GetQuantityUnit : getter

func (*BaseAssetPeg) GetTakerAddress

func (baseAssetPeg *BaseAssetPeg) GetTakerAddress() cTypes.AccAddress

GetTakerAddress : getter

func (*BaseAssetPeg) SetAssetPrice

func (baseAssetPeg *BaseAssetPeg) SetAssetPrice(assetPrice int64) error

SetAssetPrice : setter

func (*BaseAssetPeg) SetAssetQuantity

func (baseAssetPeg *BaseAssetPeg) SetAssetQuantity(assetQuantity int64) error

SetAssetQuantity : setter

func (*BaseAssetPeg) SetAssetType

func (baseAssetPeg *BaseAssetPeg) SetAssetType(assetType string) error

SetAssetType : setter

func (*BaseAssetPeg) SetDocumentHash

func (baseAssetPeg *BaseAssetPeg) SetDocumentHash(documentHash string) error

SetDocumentHash : setter

func (*BaseAssetPeg) SetLocked

func (baseAssetPeg *BaseAssetPeg) SetLocked(locked bool) error

SetLocked : setter

func (*BaseAssetPeg) SetModerated

func (baseAssetPeg *BaseAssetPeg) SetModerated(moderated bool) error

SetModerated : setter

func (*BaseAssetPeg) SetOwnerAddress

func (baseAssetPeg *BaseAssetPeg) SetOwnerAddress(ownerAddress cTypes.AccAddress) error

SetOwnerAddress : setter

func (*BaseAssetPeg) SetPegHash

func (baseAssetPeg *BaseAssetPeg) SetPegHash(pegHash PegHash) error

SetPegHash : setter

func (*BaseAssetPeg) SetQuantityUnit

func (baseAssetPeg *BaseAssetPeg) SetQuantityUnit(quantityUnit string) error

SetQuantityUnit : setter

func (*BaseAssetPeg) SetTakerAddress

func (baseAssetPeg *BaseAssetPeg) SetTakerAddress(takerAddress cTypes.AccAddress) error

SetTakerAddress : setter

type BaseFiatPeg

type BaseFiatPeg struct {
	PegHash           PegHash `json:"pegHash" `
	TransactionID     string  `` /* 145-byte string literal not displayed */
	TransactionAmount int64   `json:"transactionAmount" valid:"required~TransactionAmount is mandatory,matches(^[1-9]{1}[0-9]*$)~Invalid TransactionAmount"`
	RedeemedAmount    int64   `json:"redeemedAmount"`
	Owners            []Owner `json:"owners"`
}

BaseFiatPeg : fiat peg basic implementation

func NewBaseFiatPegWithPegHash

func NewBaseFiatPegWithPegHash(pegHash PegHash) BaseFiatPeg

NewBaseFiatPegWithPegHash a base fiat peg with peg hash

func ToBaseFiatPeg

func ToBaseFiatPeg(fiatPeg FiatPeg) BaseFiatPeg

ToBaseFiatPeg : convert interface fiat peg to base fiat peg

func (BaseFiatPeg) GetOwners

func (baseFiatPeg BaseFiatPeg) GetOwners() []Owner

GetOwners : getter

func (BaseFiatPeg) GetPegHash

func (baseFiatPeg BaseFiatPeg) GetPegHash() PegHash

GetPegHash : getter

func (BaseFiatPeg) GetRedeemedAmount

func (baseFiatPeg BaseFiatPeg) GetRedeemedAmount() int64

GetRedeemedAmount : getter

func (BaseFiatPeg) GetTransactionAmount

func (baseFiatPeg BaseFiatPeg) GetTransactionAmount() int64

GetTransactionAmount : getter

func (BaseFiatPeg) GetTransactionID

func (baseFiatPeg BaseFiatPeg) GetTransactionID() string

GetTransactionID : getter

func (*BaseFiatPeg) SetOwners

func (baseFiatPeg *BaseFiatPeg) SetOwners(owners []Owner) error

SetOwners : setter

func (*BaseFiatPeg) SetPegHash

func (baseFiatPeg *BaseFiatPeg) SetPegHash(pegHash PegHash) error

SetPegHash : setter

func (*BaseFiatPeg) SetRedeemedAmount

func (baseFiatPeg *BaseFiatPeg) SetRedeemedAmount(redeemedAmount int64) error

SetRedeemedAmount : setter

func (*BaseFiatPeg) SetTransactionAmount

func (baseFiatPeg *BaseFiatPeg) SetTransactionAmount(transactionAmount int64) error

SetTransactionAmount : setter

func (*BaseFiatPeg) SetTransactionID

func (baseFiatPeg *BaseFiatPeg) SetTransactionID(transactionID string) error

SetTransactionID : setter

type FiatPeg

type FiatPeg interface {
	GetPegHash() PegHash
	SetPegHash(PegHash) error

	GetTransactionID() string
	SetTransactionID(string) error

	GetTransactionAmount() int64
	SetTransactionAmount(int64) error

	GetRedeemedAmount() int64
	SetRedeemedAmount(int64) error

	GetOwners() []Owner
	SetOwners([]Owner) error
}

FiatPeg : peg issued against each fiat transaction

func ProtoBaseFiatPeg

func ProtoBaseFiatPeg() FiatPeg

ProtoBaseFiatPeg : create a new interface prototype

func ToFiatPeg

func ToFiatPeg(baseFiatPeg BaseFiatPeg) FiatPeg

ToFiatPeg : convert base fiat peg to interface fiat peg

type FiatPegDecoder

type FiatPegDecoder func(fiatPegBytes []byte) (FiatPeg, error)

FiatPegDecoder : decoder function for fiat peg

type FiatPegWallet

type FiatPegWallet []BaseFiatPeg

FiatPegWallet : A wallet of fiat peg tokens

func AddFiatPegToWallet

func AddFiatPegToWallet(fiatPegWallet FiatPegWallet, inFiatPegWallet FiatPegWallet) FiatPegWallet

AddFiatPegToWallet : add fiat peg to wallet

func RedeemFiatPegsFromWallet

func RedeemFiatPegsFromWallet(fiatPegWallet FiatPegWallet, oldFiatPegWallet FiatPegWallet, fromAddress cTypes.AccAddress) FiatPegWallet

RedeemFiatPegsFromWallet : subtracts and changes owners of fiat peg in fiat chain

func SubtractFiatPegWalletFromWallet

func SubtractFiatPegWalletFromWallet(inFiatPegWallet FiatPegWallet, fiatPegWallet FiatPegWallet) FiatPegWallet

SubtractFiatPegWalletFromWallet : subtract fiat peg wallet from wallet

func TransferFiatPegsToWallet

func TransferFiatPegsToWallet(fiatPegWallet FiatPegWallet, oldFiatPegWallet FiatPegWallet, fromAddress cTypes.AccAddress, toAddress cTypes.AccAddress) FiatPegWallet

TransferFiatPegsToWallet : subtracts and changes owners of fiat peg in fiat chain

func (FiatPegWallet) Len

func (fiatPegWallet FiatPegWallet) Len() int

func (FiatPegWallet) Less

func (fiatPegWallet FiatPegWallet) Less(i, j int) bool

func (FiatPegWallet) Sort

func (fiatPegWallet FiatPegWallet) Sort() FiatPegWallet

Sort is a helper function to sort the set of fiat pegs inplace

func (FiatPegWallet) Swap

func (fiatPegWallet FiatPegWallet) Swap(i, j int)

type Owner

type Owner struct {
	OwnerAddress cTypes.AccAddress `json:"ownerAddress"`
	Amount       int64             `json:"amount"`
}

Owner : partial or full owner of a transaction

type PegHash

type PegHash = common.HexBytes

PegHash : reference address of asset peg

func GetAssetPegHashHex

func GetAssetPegHashHex(pegHashStr string) (pegHash PegHash, err error)

GetAssetPegHashHex : convert string to hex peg hash

func GetFiatPegHashHex

func GetFiatPegHashHex(pegHashStr string) (pegHash PegHash, err error)

GetFiatPegHashHex : convert string to hex peg hash

Directories

Path Synopsis
Package module contains application module patterns and associated "manager" functionality.
Package module contains application module patterns and associated "manager" functionality.

Jump to

Keyboard shortcuts

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