service

package
v0.16.4 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2021 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCodespace sdk.CodespaceType = "service"

	CodeInvalidIDL               sdk.CodeType = 100
	CodeSvcDefExists             sdk.CodeType = 101
	CodeSvcDefNotExists          sdk.CodeType = 102
	CodeInvalidOutputPrivacyEnum sdk.CodeType = 103
	CodeInvalidOutputCachedEnum  sdk.CodeType = 104
	CodeInvalidServiceName       sdk.CodeType = 105
	CodeInvalidChainId           sdk.CodeType = 106
	CodeInvalidAuthor            sdk.CodeType = 107
	CodeInvalidMethodName        sdk.CodeType = 108

	CodeSvcBindingExists     sdk.CodeType = 109
	CodeSvcBindingNotExists  sdk.CodeType = 110
	CodeInvalidDefChainId    sdk.CodeType = 111
	CodeInvalidBindingType   sdk.CodeType = 112
	CodeInvalidLevel         sdk.CodeType = 113
	CodeInvalidPriceCount    sdk.CodeType = 114
	CodeInvalidRefundDeposit sdk.CodeType = 115
	CodeLtMinProviderDeposit sdk.CodeType = 116
	CodeInvalidDisable       sdk.CodeType = 117
	CodeInvalidEnable        sdk.CodeType = 118

	CodeMethodNotExists        sdk.CodeType = 119
	CodeRequestNotActive       sdk.CodeType = 120
	CodeReturnFeeNotExists     sdk.CodeType = 121
	CodeWithdrawFeeNotExists   sdk.CodeType = 122
	CodeLtServiceFee           sdk.CodeType = 123
	CodeInvalidReqId           sdk.CodeType = 124
	CodeSvcBindingNotAvailable sdk.CodeType = 125
	CodeNotMatchingProvider    sdk.CodeType = 126
	CodeInvalidReqChainId      sdk.CodeType = 127
	CodeInvalidBindChainId     sdk.CodeType = 128
	CodeNotMatchingReqChainID  sdk.CodeType = 129

	CodeIntOverflow  sdk.CodeType = 130
	CodeInvalidInput sdk.CodeType = 131
)
View Source
const (
	QueryDefinition = "definition"
	QueryBinding    = "binding"
	QueryBindings   = "bindings"
	QueryRequests   = "requests"
	QueryResponse   = "response"
	QueryFees       = "fees"
)
View Source
const (
	DefaultParamSpace = "service"
)

default paramSpace for service keeper

View Source
const MetricsSubsystem = "module_service"
View Source
const (
	// name to idetify transaction types
	MsgRoute = "service"
)

Variables

View Source
var (
	// params store for service params
	KeyMaxRequestTimeout    = []byte("MaxRequestTimeout")
	KeyMinDepositMultiple   = []byte("MinDepositMultiple")
	KeyServiceFeeTax        = []byte("ServiceFeeTax")
	KeySlashFraction        = []byte("SlashFraction")
	KeyComplaintRetrospect  = []byte("ComplaintRetrospect")
	KeyArbitrationTimeLimit = []byte("ArbitrationTimeLimit")
	KeyTxSizeLimit          = []byte("TxSizeLimit")
)

Parameter store key

Functions

func ConvertRequestID

func ConvertRequestID(requestId string) (eHeight int64, rHeight int64, counter int16, err error)

func EndBlocker

func EndBlocker(ctx types.Context, keeper Keeper) (resTags types.Tags)

func ErrDisable

func ErrDisable(codespace sdk.CodespaceType, msg string) sdk.Error

func ErrEnable

func ErrEnable(codespace sdk.CodespaceType, msg string) sdk.Error

func ErrInvalidAuthor

func ErrInvalidAuthor(codespace sdk.CodespaceType) sdk.Error

func ErrInvalidBindChainId

func ErrInvalidBindChainId(codespace sdk.CodespaceType) sdk.Error

func ErrInvalidBindingType

func ErrInvalidBindingType(codespace sdk.CodespaceType, bindingType BindingType) sdk.Error

func ErrInvalidChainId

func ErrInvalidChainId(codespace sdk.CodespaceType) sdk.Error

func ErrInvalidDefChainId

func ErrInvalidDefChainId(codespace sdk.CodespaceType) sdk.Error

func ErrInvalidIDL

func ErrInvalidIDL(codespace sdk.CodespaceType, msg string) sdk.Error

func ErrInvalidLevel

func ErrInvalidLevel(codespace sdk.CodespaceType, level Level) sdk.Error

func ErrInvalidMethodName

func ErrInvalidMethodName(codespace sdk.CodespaceType) sdk.Error

func ErrInvalidOutputCachedEnum

func ErrInvalidOutputCachedEnum(codespace sdk.CodespaceType, value string) sdk.Error

func ErrInvalidOutputPrivacyEnum

func ErrInvalidOutputPrivacyEnum(codespace sdk.CodespaceType, value string) sdk.Error

func ErrInvalidPriceCount

func ErrInvalidPriceCount(codespace sdk.CodespaceType, priceCount int, methodCount int) sdk.Error

func ErrInvalidReqChainId

func ErrInvalidReqChainId(codespace sdk.CodespaceType) sdk.Error

func ErrInvalidReqId

func ErrInvalidReqId(codespace sdk.CodespaceType, reqId string) sdk.Error

func ErrInvalidServiceName

func ErrInvalidServiceName(codespace sdk.CodespaceType, msg string) sdk.Error

func ErrLtMinProviderDeposit

func ErrLtMinProviderDeposit(codespace sdk.CodespaceType, coins sdk.Coins) sdk.Error

func ErrLtServiceFee

func ErrLtServiceFee(codespace sdk.CodespaceType, coins sdk.Coins) sdk.Error

func ErrMethodNotExists

func ErrMethodNotExists(codespace sdk.CodespaceType, methodID int16) sdk.Error

func ErrNoResponseFound

func ErrNoResponseFound(codespace sdk.CodespaceType, requestID string) sdk.Error

func ErrNotMatchingProvider

func ErrNotMatchingProvider(codespace sdk.CodespaceType, provider sdk.AccAddress) sdk.Error

func ErrNotMatchingReqChainID

func ErrNotMatchingReqChainID(codespace sdk.CodespaceType, reqChainID string) sdk.Error

func ErrNotProfiler

func ErrNotProfiler(codespace sdk.CodespaceType, profiler sdk.AccAddress) sdk.Error

func ErrNotTrustee

func ErrNotTrustee(codespace sdk.CodespaceType, trustee sdk.AccAddress) sdk.Error

func ErrRefundDeposit

func ErrRefundDeposit(codespace sdk.CodespaceType, msg string) sdk.Error

func ErrRequestNotActive

func ErrRequestNotActive(codespace sdk.CodespaceType, requestID string) sdk.Error

func ErrReturnFeeNotExists

func ErrReturnFeeNotExists(codespace sdk.CodespaceType, address sdk.AccAddress) sdk.Error

func ErrSvcBindingExists

func ErrSvcBindingExists(codespace sdk.CodespaceType) sdk.Error

func ErrSvcBindingNotAvailable

func ErrSvcBindingNotAvailable(codespace sdk.CodespaceType) sdk.Error

func ErrSvcBindingNotExists

func ErrSvcBindingNotExists(codespace sdk.CodespaceType) sdk.Error

func ErrSvcDefExists

func ErrSvcDefExists(codespace sdk.CodespaceType, defChainId, svcDefName string) sdk.Error

func ErrSvcDefNotExists

func ErrSvcDefNotExists(codespace sdk.CodespaceType, defChainId, svcDefName string) sdk.Error

func ErrWithdrawFeeNotExists

func ErrWithdrawFeeNotExists(codespace sdk.CodespaceType, address sdk.AccAddress) sdk.Error

func GetActiveRequestKey

func GetActiveRequestKey(defChainId, serviceName, bindChainId string, provider sdk.AccAddress, height int64, counter int16) []byte

func GetBindingsSubspaceKey

func GetBindingsSubspaceKey(chainId, serviceName string) []byte

Key for getting all methods on a service from the store

func GetIncomingFeeKey

func GetIncomingFeeKey(address sdk.AccAddress) []byte

func GetMethodPropertyKey

func GetMethodPropertyKey(chainId, serviceName string, id int16) []byte

id can not be zero

func GetMethodsSubspaceKey

func GetMethodsSubspaceKey(chainId, serviceName string) []byte

Key for getting all methods on a service from the store

func GetRequestKey

func GetRequestKey(defChainId, serviceName, bindChainId string, provider sdk.AccAddress, height int64, counter int16) []byte

func GetRequestsByExpirationIndexKey

func GetRequestsByExpirationIndexKey(eHeight, rHeight int64, counter int16) []byte

func GetRequestsByExpirationIndexKeyByReq

func GetRequestsByExpirationIndexKeyByReq(req SvcRequest) []byte

get the expiration index of a request

func GetRequestsByExpirationPrefix

func GetRequestsByExpirationPrefix(height int64) []byte

get the expiration prefix for all request of a block height

func GetResponseKey

func GetResponseKey(reqChainId string, eHeight, rHeight int64, counter int16) []byte

func GetReturnedFeeKey

func GetReturnedFeeKey(address sdk.AccAddress) []byte

func GetServiceBindingKey

func GetServiceBindingKey(defChainId, name, bindChainId string, provider sdk.AccAddress) []byte

func GetServiceDefinitionKey

func GetServiceDefinitionKey(chainId, name string) []byte

func GetSubActiveRequestKey

func GetSubActiveRequestKey(defChainId, serviceName, bindChainId string, provider sdk.AccAddress) []byte

func InitGenesis

func InitGenesis(ctx sdk.Context, k Keeper, data GenesisState)

InitGenesis - store genesis parameters

func NewError

func NewError(codespace sdk.CodespaceType, code sdk.CodeType, msg string) sdk.Error

func NewHandler

func NewHandler(k Keeper) sdk.Handler

handle all "service" type messages.

func NewQuerier

func NewQuerier(k Keeper) sdk.Querier

func ParamTypeTable

func ParamTypeTable() params.TypeTable

ParamTable for service module

func PrepForZeroHeightGenesis

func PrepForZeroHeightGenesis(ctx sdk.Context, k Keeper)

refund deposit from all bindings refund service fee from all request refund all incoming/return fee no process for service fee tax account

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

Register concrete types on codec codec

func SortAddresses

func SortAddresses(addrs []sdk.AccAddress)

Sorts Addresses

func SortByteArrays

func SortByteArrays(src [][]byte) [][]byte

Public

func SvcBindingEqual

func SvcBindingEqual(bindingA, bindingB SvcBinding) bool

func ValidateGenesis

func ValidateGenesis(data GenesisState) error

ValidateGenesis validates the provided service genesis state to ensure the expected invariants holds.

Types

type BindingType

type BindingType byte
const (
	Global BindingType = 0x01
	Local  BindingType = 0x02
)

func BindingTypeFromString

func BindingTypeFromString(str string) (BindingType, error)

String to BindingType byte, Returns ff if invalid.

func (BindingType) Format

func (bt BindingType) Format(s fmt.State, verb rune)

For Printf / Sprintf, returns bech32 when using %s

func (BindingType) MarshalJSON

func (bt BindingType) MarshalJSON() ([]byte, error)

Marshals to JSON using string

func (BindingType) String

func (bt BindingType) String() string

Turns BindingType byte to String

func (*BindingType) UnmarshalJSON

func (bt *BindingType) UnmarshalJSON(data []byte) error

Unmarshals from JSON assuming Bech32 encoding

type DefinitionOutput

type DefinitionOutput struct {
	Definition SvcDef           `json:"definition"`
	Methods    []MethodProperty `json:"methods"`
}

type FeesOutput

type FeesOutput struct {
	ReturnedFee sdk.Coins `json:"returned_fee"`
	IncomingFee sdk.Coins `json:"incoming_fee"`
}

type GenesisState

type GenesisState struct {
	Params Params `json:"params"` // service params
}

GenesisState - all service state that must be provided at genesis

func DefaultGenesisState

func DefaultGenesisState() GenesisState

get raw genesis raw message for testing

func DefaultGenesisStateForTest

func DefaultGenesisStateForTest() GenesisState

get raw genesis raw message for testing

func ExportGenesis

func ExportGenesis(ctx sdk.Context, k Keeper) GenesisState

ExportGenesis - output genesis parameters

func NewGenesisState

func NewGenesisState(params Params) GenesisState

type IncomingFee

type IncomingFee struct {
	Address sdk.AccAddress `json:"address"`
	Coins   sdk.Coins      `json:"coins"`
}

incoming fee of a consumer

func NewIncomingFee

func NewIncomingFee(address sdk.AccAddress, coins sdk.Coins) IncomingFee

type Keeper

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

func NewKeeper

func NewKeeper(cdc *codec.Codec, key sdk.StoreKey, ck bank.Keeper, gk guardian.Keeper, codespace sdk.CodespaceType, paramSpace params.Subspace, metrics *Metrics) Keeper

func (Keeper) ActiveAllRequestQueueIterator

func (k Keeper) ActiveAllRequestQueueIterator(store sdk.KVStore) sdk.Iterator

Returns an iterator for all the request in the Active Queue

func (Keeper) ActiveBindRequestsIterator

func (k Keeper) ActiveBindRequestsIterator(ctx sdk.Context, defChainID, defName, bindChainID string, provider sdk.AccAddress) sdk.Iterator

Returns an iterator for all the request in the Active Queue of specified service binding

func (Keeper) ActiveRequestQueueIterator

func (k Keeper) ActiveRequestQueueIterator(ctx sdk.Context, height int64) sdk.Iterator

Returns an iterator for all the request in the Active Queue that expire by block height

func (Keeper) AddActiveRequest

func (k Keeper) AddActiveRequest(ctx sdk.Context, req SvcRequest)

func (Keeper) AddIncomingFee

func (k Keeper) AddIncomingFee(ctx sdk.Context, address sdk.AccAddress, coins sdk.Coins) sdk.Error

Add incoming fee for a particular provider, if it is not existed will create a new

func (Keeper) AddMethods

func (k Keeper) AddMethods(ctx sdk.Context, svcDef SvcDef) sdk.Error

func (Keeper) AddRequest

func (k Keeper) AddRequest(ctx sdk.Context, req SvcRequest) (SvcRequest, sdk.Error)

func (Keeper) AddRequestExpiration

func (k Keeper) AddRequestExpiration(ctx sdk.Context, req SvcRequest)

func (Keeper) AddResponse

func (k Keeper) AddResponse(ctx sdk.Context, resp SvcResponse)

func (Keeper) AddReturnFee

func (k Keeper) AddReturnFee(ctx sdk.Context, address sdk.AccAddress, coins sdk.Coins)

Add return fee for a particular consumer, if it is not existed will create a new

func (Keeper) AddServiceBinding

func (k Keeper) AddServiceBinding(ctx sdk.Context, svcBinding SvcBinding) sdk.Error

func (Keeper) AddServiceDefinition

func (k Keeper) AddServiceDefinition(ctx sdk.Context, svcDef SvcDef)

func (Keeper) Codespace

func (k Keeper) Codespace() sdk.CodespaceType

return the codespace

func (Keeper) DeleteActiveRequest

func (k Keeper) DeleteActiveRequest(ctx sdk.Context, req SvcRequest)

func (Keeper) DeleteRequestExpiration

func (k Keeper) DeleteRequestExpiration(ctx sdk.Context, req SvcRequest)

func (Keeper) Disable

func (k Keeper) Disable(ctx sdk.Context, defChainID, defName, bindChainID string, provider sdk.AccAddress) sdk.Error

func (Keeper) Enable

func (k Keeper) Enable(ctx sdk.Context, defChainID, defName, bindChainID string, provider sdk.AccAddress, deposit sdk.Coins) sdk.Error

func (Keeper) GetActiveRequest

func (k Keeper) GetActiveRequest(ctx sdk.Context, eHeight, rHeight int64, counter int16) (req SvcRequest, found bool)

func (Keeper) GetIncomingFee

func (k Keeper) GetIncomingFee(ctx sdk.Context, address sdk.AccAddress) (fee IncomingFee, found bool)

func (Keeper) GetIntraTxCounter

func (k Keeper) GetIntraTxCounter(ctx sdk.Context) int16

get the current in-block request operation counter

func (Keeper) GetMethod

func (k Keeper) GetMethod(ctx sdk.Context, chainId, name string, id int16) (method MethodProperty, found bool)

Gets the method in a specific service and methodID

func (Keeper) GetMethods

func (k Keeper) GetMethods(ctx sdk.Context, chainId, name string) sdk.Iterator

Gets all the methods in a specific service

func (Keeper) GetParamSet

func (k Keeper) GetParamSet(ctx sdk.Context) Params

get service params from the global param store

func (Keeper) GetResponse

func (k Keeper) GetResponse(ctx sdk.Context, reqChainID string, eHeight, rHeight int64, counter int16) (resp SvcResponse, found bool)

func (Keeper) GetReturnFee

func (k Keeper) GetReturnFee(ctx sdk.Context, address sdk.AccAddress) (fee ReturnedFee, found bool)

func (Keeper) GetServiceBinding

func (k Keeper) GetServiceBinding(ctx sdk.Context, defChainID, defName, bindChainID string, provider sdk.AccAddress) (svcBinding SvcBinding, found bool)

func (Keeper) GetServiceDefinition

func (k Keeper) GetServiceDefinition(ctx sdk.Context, chainId, name string) (svcDef SvcDef, found bool)

func (Keeper) InitMetrics

func (k Keeper) InitMetrics(store sdk.KVStore)

func (Keeper) RefundDeposit

func (k Keeper) RefundDeposit(ctx sdk.Context, defChainID, defName, bindChainID string, provider sdk.AccAddress) sdk.Error

func (Keeper) RefundFee

func (k Keeper) RefundFee(ctx sdk.Context, address sdk.AccAddress) sdk.Error

refund fees from a particular consumer, and delete it

func (Keeper) ServiceBindingsIterator

func (k Keeper) ServiceBindingsIterator(ctx sdk.Context, defChainID, defName string) sdk.Iterator

func (Keeper) SetIncomingFee

func (k Keeper) SetIncomingFee(ctx sdk.Context, address sdk.AccAddress, coins sdk.Coins)

func (Keeper) SetIntraTxCounter

func (k Keeper) SetIntraTxCounter(ctx sdk.Context, counter int16)

set the current in-block request counter

func (Keeper) SetParamSet

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

set service params from the global param store

func (Keeper) SetReturnFee

func (k Keeper) SetReturnFee(ctx sdk.Context, address sdk.AccAddress, coins sdk.Coins)

func (Keeper) Slash

func (k Keeper) Slash(ctx sdk.Context, binding SvcBinding, slashCoins sdk.Coins) sdk.Error

func (Keeper) UpdateServiceBinding

func (k Keeper) UpdateServiceBinding(ctx sdk.Context, svcBinding SvcBinding) sdk.Error

func (Keeper) WithdrawFee

func (k Keeper) WithdrawFee(ctx sdk.Context, address sdk.AccAddress) sdk.Error

withdraw fees from a particular provider, and delete it

type Level

type Level struct {
	AvgRspTime int64 `json:"avg_rsp_time"`
	UsableTime int64 `json:"usable_time"`
}

type MessagingType

type MessagingType byte
const (
	Unicast   MessagingType = 0x01
	Multicast MessagingType = 0x02
)

func MessagingTypeFromString

func MessagingTypeFromString(str string) (MessagingType, error)

String to messagingType byte, Returns ff if invalid.

func (MessagingType) Format

func (mt MessagingType) Format(s fmt.State, verb rune)

For Printf / Sprintf, returns bech32 when using %s

func (MessagingType) MarshalJSON

func (mt MessagingType) MarshalJSON() ([]byte, error)

Marshals to JSON using string

func (MessagingType) String

func (mt MessagingType) String() string

Turns MessagingType byte to String

func (*MessagingType) UnmarshalJSON

func (mt *MessagingType) UnmarshalJSON(data []byte) error

Unmarshals from JSON assuming Bech32 encoding

type MethodProperty

type MethodProperty struct {
	ID            int16             `json:"id"`
	Name          string            `json:"name"`
	Description   string            `json:"description"`
	OutputPrivacy OutputPrivacyEnum `json:"output_privacy"`
	OutputCached  OutputCachedEnum  `json:"output_cached"`
}

type Metrics

type Metrics struct {
	ActiveRequests metrics.Gauge
}

func NopMetrics

func NopMetrics() *Metrics

func PrometheusMetrics

func PrometheusMetrics(config *cfg.InstrumentationConfig) *Metrics

PrometheusMetrics returns Metrics build using Prometheus client library.

type MsgSvcBind

type MsgSvcBind struct {
	DefName     string         `json:"def_name"`
	DefChainID  string         `json:"def_chain_id"`
	BindChainID string         `json:"bind_chain_id"`
	Provider    sdk.AccAddress `json:"provider"`
	BindingType BindingType    `json:"binding_type"`
	Deposit     sdk.Coins      `json:"deposit"`
	Prices      []sdk.Coin     `json:"price"`
	Level       Level          `json:"level"`
}

MsgSvcBinding - struct for bind a service

func NewMsgSvcBind

func NewMsgSvcBind(defChainID, defName, bindChainID string, provider sdk.AccAddress, bindingType BindingType, deposit sdk.Coins, prices []sdk.Coin, level Level) MsgSvcBind

func (MsgSvcBind) GetSignBytes

func (msg MsgSvcBind) GetSignBytes() []byte

func (MsgSvcBind) GetSigners

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

func (MsgSvcBind) Route

func (msg MsgSvcBind) Route() string

func (MsgSvcBind) Type

func (msg MsgSvcBind) Type() string

func (MsgSvcBind) ValidateBasic

func (msg MsgSvcBind) ValidateBasic() sdk.Error

type MsgSvcBindingUpdate

type MsgSvcBindingUpdate struct {
	DefName     string         `json:"def_name"`
	DefChainID  string         `json:"def_chain_id"`
	BindChainID string         `json:"bind_chain_id"`
	Provider    sdk.AccAddress `json:"provider"`
	BindingType BindingType    `json:"binding_type"`
	Deposit     sdk.Coins      `json:"deposit"`
	Prices      []sdk.Coin     `json:"price"`
	Level       Level          `json:"level"`
}

MsgSvcBindingUpdate - struct for update a service binding

func NewMsgSvcBindingUpdate

func NewMsgSvcBindingUpdate(defChainID, defName, bindChainID string, provider sdk.AccAddress, bindingType BindingType, deposit sdk.Coins, prices []sdk.Coin, level Level) MsgSvcBindingUpdate

func (MsgSvcBindingUpdate) GetSignBytes

func (msg MsgSvcBindingUpdate) GetSignBytes() []byte

func (MsgSvcBindingUpdate) GetSigners

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

func (MsgSvcBindingUpdate) Route

func (msg MsgSvcBindingUpdate) Route() string

func (MsgSvcBindingUpdate) Type

func (msg MsgSvcBindingUpdate) Type() string

func (MsgSvcBindingUpdate) ValidateBasic

func (msg MsgSvcBindingUpdate) ValidateBasic() sdk.Error

type MsgSvcDef

type MsgSvcDef struct {
	SvcDef
}

MsgSvcDef - struct for define a service

func NewMsgSvcDef

func NewMsgSvcDef(name, chainId, description string, tags []string, author sdk.AccAddress, authorDescription, idlContent string) MsgSvcDef

func (MsgSvcDef) EnsureLength

func (msg MsgSvcDef) EnsureLength() sdk.Error

func (MsgSvcDef) GetSignBytes

func (msg MsgSvcDef) GetSignBytes() []byte

func (MsgSvcDef) GetSigners

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

func (MsgSvcDef) Route

func (msg MsgSvcDef) Route() string

func (MsgSvcDef) Type

func (msg MsgSvcDef) Type() string

func (MsgSvcDef) ValidateBasic

func (msg MsgSvcDef) ValidateBasic() sdk.Error

type MsgSvcDisable

type MsgSvcDisable struct {
	DefName     string         `json:"def_name"`
	DefChainID  string         `json:"def_chain_id"`
	BindChainID string         `json:"bind_chain_id"`
	Provider    sdk.AccAddress `json:"provider"`
}

MsgSvcDisable - struct for disable a service binding

func NewMsgSvcDisable

func NewMsgSvcDisable(defChainID, defName, bindChainID string, provider sdk.AccAddress) MsgSvcDisable

func (MsgSvcDisable) GetSignBytes

func (msg MsgSvcDisable) GetSignBytes() []byte

func (MsgSvcDisable) GetSigners

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

func (MsgSvcDisable) Route

func (msg MsgSvcDisable) Route() string

func (MsgSvcDisable) Type

func (msg MsgSvcDisable) Type() string

func (MsgSvcDisable) ValidateBasic

func (msg MsgSvcDisable) ValidateBasic() sdk.Error

type MsgSvcEnable

type MsgSvcEnable struct {
	DefName     string         `json:"def_name"`
	DefChainID  string         `json:"def_chain_id"`
	BindChainID string         `json:"bind_chain_id"`
	Provider    sdk.AccAddress `json:"provider"`
	Deposit     sdk.Coins      `json:"deposit"`
}

MsgSvcEnable - struct for enable a service binding

func NewMsgSvcEnable

func NewMsgSvcEnable(defChainID, defName, bindChainID string, provider sdk.AccAddress, deposit sdk.Coins) MsgSvcEnable

func (MsgSvcEnable) GetSignBytes

func (msg MsgSvcEnable) GetSignBytes() []byte

func (MsgSvcEnable) GetSigners

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

func (MsgSvcEnable) Route

func (msg MsgSvcEnable) Route() string

func (MsgSvcEnable) Type

func (msg MsgSvcEnable) Type() string

func (MsgSvcEnable) ValidateBasic

func (msg MsgSvcEnable) ValidateBasic() sdk.Error

type MsgSvcRefundDeposit

type MsgSvcRefundDeposit struct {
	DefName     string         `json:"def_name"`
	DefChainID  string         `json:"def_chain_id"`
	BindChainID string         `json:"bind_chain_id"`
	Provider    sdk.AccAddress `json:"provider"`
}

MsgSvcRefundDeposit - struct for refund deposit from a service binding

func NewMsgSvcRefundDeposit

func NewMsgSvcRefundDeposit(defChainID, defName, bindChainID string, provider sdk.AccAddress) MsgSvcRefundDeposit

func (MsgSvcRefundDeposit) GetSignBytes

func (msg MsgSvcRefundDeposit) GetSignBytes() []byte

func (MsgSvcRefundDeposit) GetSigners

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

func (MsgSvcRefundDeposit) Route

func (msg MsgSvcRefundDeposit) Route() string

func (MsgSvcRefundDeposit) Type

func (msg MsgSvcRefundDeposit) Type() string

func (MsgSvcRefundDeposit) ValidateBasic

func (msg MsgSvcRefundDeposit) ValidateBasic() sdk.Error

type MsgSvcRefundFees

type MsgSvcRefundFees struct {
	Consumer sdk.AccAddress `json:"consumer"`
}

MsgSvcRefundFees - struct for refund fees

func NewMsgSvcRefundFees

func NewMsgSvcRefundFees(consumer sdk.AccAddress) MsgSvcRefundFees

func (MsgSvcRefundFees) GetSignBytes

func (msg MsgSvcRefundFees) GetSignBytes() []byte

func (MsgSvcRefundFees) GetSigners

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

func (MsgSvcRefundFees) Route

func (msg MsgSvcRefundFees) Route() string

func (MsgSvcRefundFees) Type

func (msg MsgSvcRefundFees) Type() string

func (MsgSvcRefundFees) ValidateBasic

func (msg MsgSvcRefundFees) ValidateBasic() sdk.Error

type MsgSvcRequest

type MsgSvcRequest struct {
	DefChainID  string         `json:"def_chain_id"`
	DefName     string         `json:"def_name"`
	BindChainID string         `json:"bind_chain_id"`
	ReqChainID  string         `json:"req_chain_id"`
	MethodID    int16          `json:"method_id"`
	Provider    sdk.AccAddress `json:"provider"`
	Consumer    sdk.AccAddress `json:"consumer"`
	Input       []byte         `json:"input"`
	ServiceFee  sdk.Coins      `json:"service_fee"`
	Profiling   bool           `json:"profiling"`
}

MsgSvcRequest - struct for call a service

func NewMsgSvcRequest

func NewMsgSvcRequest(defChainID, defName, bindChainID, reqChainID string, consumer, provider sdk.AccAddress, methodID int16, input []byte, serviceFee sdk.Coins, profiling bool) MsgSvcRequest

func (MsgSvcRequest) GetSignBytes

func (msg MsgSvcRequest) GetSignBytes() []byte

func (MsgSvcRequest) GetSigners

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

func (MsgSvcRequest) Route

func (msg MsgSvcRequest) Route() string

func (MsgSvcRequest) Type

func (msg MsgSvcRequest) Type() string

func (MsgSvcRequest) ValidateBasic

func (msg MsgSvcRequest) ValidateBasic() sdk.Error

type MsgSvcResponse

type MsgSvcResponse struct {
	ReqChainID string         `json:"req_chain_id"`
	RequestID  string         `json:"request_id"`
	Provider   sdk.AccAddress `json:"provider"`
	Output     []byte         `json:"output"`
	ErrorMsg   []byte         `json:"error_msg"`
}

MsgSvcResponse - struct for respond a service call

func NewMsgSvcResponse

func NewMsgSvcResponse(reqChainID string, requestId string, provider sdk.AccAddress, output, errorMsg []byte) MsgSvcResponse

func (MsgSvcResponse) GetSignBytes

func (msg MsgSvcResponse) GetSignBytes() []byte

func (MsgSvcResponse) GetSigners

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

func (MsgSvcResponse) Route

func (msg MsgSvcResponse) Route() string

func (MsgSvcResponse) Type

func (msg MsgSvcResponse) Type() string

func (MsgSvcResponse) ValidateBasic

func (msg MsgSvcResponse) ValidateBasic() sdk.Error

type MsgSvcWithdrawFees

type MsgSvcWithdrawFees struct {
	Provider sdk.AccAddress `json:"provider"`
}

MsgSvcWithdrawFees - struct for withdraw fees

func NewMsgSvcWithdrawFees

func NewMsgSvcWithdrawFees(provider sdk.AccAddress) MsgSvcWithdrawFees

func (MsgSvcWithdrawFees) GetSignBytes

func (msg MsgSvcWithdrawFees) GetSignBytes() []byte

func (MsgSvcWithdrawFees) GetSigners

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

func (MsgSvcWithdrawFees) Route

func (msg MsgSvcWithdrawFees) Route() string

func (MsgSvcWithdrawFees) Type

func (msg MsgSvcWithdrawFees) Type() string

func (MsgSvcWithdrawFees) ValidateBasic

func (msg MsgSvcWithdrawFees) ValidateBasic() sdk.Error

type MsgSvcWithdrawTax

type MsgSvcWithdrawTax struct {
	Trustee     sdk.AccAddress `json:"trustee"`
	DestAddress sdk.AccAddress `json:"dest_address"`
	Amount      sdk.Coins      `json:"amount"`
}

MsgSvcWithdrawTax - struct for withdraw tax

func NewMsgSvcWithdrawTax

func NewMsgSvcWithdrawTax(trustee, destAddress sdk.AccAddress, amount sdk.Coins) MsgSvcWithdrawTax

func (MsgSvcWithdrawTax) GetSignBytes

func (msg MsgSvcWithdrawTax) GetSignBytes() []byte

func (MsgSvcWithdrawTax) GetSigners

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

func (MsgSvcWithdrawTax) Route

func (msg MsgSvcWithdrawTax) Route() string

func (MsgSvcWithdrawTax) Type

func (msg MsgSvcWithdrawTax) Type() string

func (MsgSvcWithdrawTax) ValidateBasic

func (msg MsgSvcWithdrawTax) ValidateBasic() sdk.Error

type OutputCachedEnum

type OutputCachedEnum byte
const (
	OffChainCached OutputCachedEnum = 0x01
	NoCached       OutputCachedEnum = 0x02
)

func OutputCachedEnumFromString

func OutputCachedEnumFromString(str string) (OutputCachedEnum, error)

String to outputCachedEnum byte, Returns ff if invalid.

func (OutputCachedEnum) Format

func (oe OutputCachedEnum) Format(s fmt.State, verb rune)

For Printf / Sprintf, returns bech32 when using %s

func (OutputCachedEnum) MarshalJSON

func (oe OutputCachedEnum) MarshalJSON() ([]byte, error)

Marshals to JSON using string

func (OutputCachedEnum) String

func (oe OutputCachedEnum) String() string

Turns OutputCachedEnum byte to String

func (*OutputCachedEnum) UnmarshalJSON

func (oe *OutputCachedEnum) UnmarshalJSON(data []byte) error

Unmarshals from JSON assuming Bech32 encoding

type OutputPrivacyEnum

type OutputPrivacyEnum byte
const (
	NoPrivacy        OutputPrivacyEnum = 0x01
	PubKeyEncryption OutputPrivacyEnum = 0x02
)

func OutputPrivacyEnumFromString

func OutputPrivacyEnumFromString(str string) (OutputPrivacyEnum, error)

String to outputPrivacyEnum byte, Returns ff if invalid.

func (OutputPrivacyEnum) Format

func (oe OutputPrivacyEnum) Format(s fmt.State, verb rune)

For Printf / Sprintf, returns bech32 when using %s

func (OutputPrivacyEnum) MarshalJSON

func (oe OutputPrivacyEnum) MarshalJSON() ([]byte, error)

Marshals to JSON using string

func (OutputPrivacyEnum) String

func (oe OutputPrivacyEnum) String() string

Turns OutputCachedEnum byte to String

func (*OutputPrivacyEnum) UnmarshalJSON

func (oe *OutputPrivacyEnum) UnmarshalJSON(data []byte) error

Unmarshals from JSON assuming Bech32 encoding

type Params

type Params struct {
	MaxRequestTimeout    int64         `json:"max_request_timeout"`
	MinDepositMultiple   int64         `json:"min_deposit_multiple"`
	ServiceFeeTax        sdk.Dec       `json:"service_fee_tax"`
	SlashFraction        sdk.Dec       `json:"slash_fraction"`
	ComplaintRetrospect  time.Duration `json:"complaint_retrospect"`
	ArbitrationTimeLimit time.Duration `json:"arbitration_time_limit"`
	TxSizeLimit          uint64        `json:"tx_size_limit"`
}

service params

func DefaultParams

func DefaultParams() Params

default service module params

func DefaultParamsForTest

func DefaultParamsForTest() Params

default service module params for test

func (*Params) GetParamSpace

func (p *Params) GetParamSpace() string

Implements params.ParamStruct

func (*Params) KeyValuePairs

func (p *Params) KeyValuePairs() params.KeyValuePairs

func (*Params) ReadOnly

func (p *Params) ReadOnly() bool

func (Params) String

func (p Params) String() string

func (*Params) StringFromBytes

func (p *Params) StringFromBytes(cdc *codec.Codec, key string, bytes []byte) (string, error)

func (*Params) Validate

func (p *Params) Validate(key string, value string) (interface{}, sdk.Error)

type QueryBindingParams

type QueryBindingParams struct {
	DefChainID  string
	ServiceName string
	BindChainId string
	Provider    sdk.AccAddress
}

type QueryFeesParams

type QueryFeesParams struct {
	Address sdk.AccAddress
}

type QueryResponseParams

type QueryResponseParams struct {
	ReqChainId string
	RequestId  string
}

type QueryServiceParams

type QueryServiceParams struct {
	DefChainID  string
	ServiceName string
}

type ReturnedFee

type ReturnedFee struct {
	Address sdk.AccAddress `json:"address"`
	Coins   sdk.Coins      `json:"coins"`
}

return fee of a consumer

func NewReturnedFee

func NewReturnedFee(address sdk.AccAddress, coins sdk.Coins) ReturnedFee

type SvcBinding

type SvcBinding struct {
	DefName     string         `json:"def_name"`
	DefChainID  string         `json:"def_chain_id"`
	BindChainID string         `json:"bind_chain_id"`
	Provider    sdk.AccAddress `json:"provider"`
	BindingType BindingType    `json:"binding_type"`
	Deposit     sdk.Coins      `json:"deposit"`
	Prices      []sdk.Coin     `json:"price"`
	Level       Level          `json:"level"`
	Available   bool           `json:"available"`
	DisableTime time.Time      `json:"disable_time"`
}

func NewSvcBinding

func NewSvcBinding(ctx sdk.Context, defChainID, defName, bindChainID string, provider sdk.AccAddress, bindingType BindingType, deposit sdk.Coins, prices []sdk.Coin, level Level, available bool) SvcBinding

NewSvcBinding returns a new SvcBinding with the provided values.

type SvcDef

type SvcDef struct {
	Name              string         `json:"name"`
	ChainId           string         `json:"chain_id"`
	Description       string         `json:"description"`
	Tags              []string       `json:"tags"`
	Author            sdk.AccAddress `json:"author"`
	AuthorDescription string         `json:"author_description"`
	IDLContent        string         `json:"idl_content"`
}

func NewSvcDef

func NewSvcDef(name, chainId, description string, tags []string, author sdk.AccAddress, authorDescription, idlContent string) SvcDef

type SvcRequest

type SvcRequest struct {
	DefChainID            string         `json:"def_chain_id"`
	DefName               string         `json:"def_name"`
	BindChainID           string         `json:"bind_chain_id"`
	ReqChainID            string         `json:"req_chain_id"`
	MethodID              int16          `json:"method_id"`
	Provider              sdk.AccAddress `json:"provider"`
	Consumer              sdk.AccAddress `json:"consumer"`
	Input                 []byte         `json:"input"`
	ServiceFee            sdk.Coins      `json:"service_fee"`
	Profiling             bool           `json:"profiling"`                // profiling model will be free of service charges
	RequestHeight         int64          `json:"request_height"`           // block height of service request
	RequestIntraTxCounter int16          `json:"request_intra_tx_counter"` // block-local tx index of service request
	ExpirationHeight      int64          `json:"expiration_height"`        // block height of the service request has expired
}

func NewSvcRequest

func NewSvcRequest(defChainID, defName, bindChainID, reqChainID string, consumer, provider sdk.AccAddress, methodID int16, input []byte, serviceFee sdk.Coins, profiling bool) SvcRequest

func (SvcRequest) RequestID

func (req SvcRequest) RequestID() string

RequestID is of format request expirationHeight-requestHeight-intraTxCounter

type SvcResponse

type SvcResponse struct {
	ReqChainID            string         `json:"req_chain_id"`
	RequestHeight         int64          `json:"request_height"`
	RequestIntraTxCounter int16          `json:"request_intra_tx_counter"`
	ExpirationHeight      int64          `json:"expiration_height"`
	Provider              sdk.AccAddress `json:"provider"`
	Consumer              sdk.AccAddress `json:"consumer"`
	Output                []byte         `json:"output"`
	ErrorMsg              []byte         `json:"error_msg"`
}

func NewSvcResponse

func NewSvcResponse(reqChainID string, eheight int64, rheight int64, counter int16, provider, consumer sdk.AccAddress, out []byte, errorMsg []byte) SvcResponse

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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