service

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2019 License: Apache-2.0 Imports: 25 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 (
	DefaultParamSpace = "service"
)

default paramSpace for service keeper

View Source
const (
	// name to idetify transaction types
	MsgType = "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")
)

Parameter store key

View Source
var DepositedCoinsAccAddr = sdk.AccAddress(crypto.AddressHash([]byte("serviceDepositedCoins")))
View Source
var RequestCoinsAccAddr = sdk.AccAddress(crypto.AddressHash([]byte("serviceRequestCoins")))
View Source
var TaxCoinsAccAddr = sdk.AccAddress(crypto.AddressHash([]byte("serviceTaxCoins")))

Functions

func ConvertRequestID added in v0.8.0

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

func EndBlocker added in v0.8.0

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

Called every block, update request status

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 added in v0.8.0

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 added in v0.8.0

func ErrInvalidReqChainId(codespace sdk.CodespaceType) sdk.Error

func ErrInvalidReqId added in v0.8.0

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 added in v0.8.0

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

func ErrMethodNotExists added in v0.8.0

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

func ErrNotMatchingProvider added in v0.8.0

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

func ErrNotMatchingReqChainID added in v0.8.0

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

func ErrNotProfiler added in v0.9.0

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

func ErrNotTrustee added in v0.9.0

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

func ErrRefundDeposit

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

func ErrRequestNotActive added in v0.8.0

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

func ErrReturnFeeNotExists added in v0.8.0

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

func ErrSvcBindingExists

func ErrSvcBindingExists(codespace sdk.CodespaceType) sdk.Error

func ErrSvcBindingNotAvailable added in v0.8.0

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 added in v0.8.0

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

func GetActiveRequestKey added in v0.8.0

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 added in v0.8.0

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 added in v0.8.0

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

func GetRequestsByExpirationIndexKey added in v0.8.0

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

func GetRequestsByExpirationIndexKeyByReq added in v0.8.0

func GetRequestsByExpirationIndexKeyByReq(req SvcRequest) []byte

get the expiration index of a request

func GetRequestsByExpirationPrefix added in v0.8.0

func GetRequestsByExpirationPrefix(height int64) []byte

get the expiration prefix for all request of a block height

func GetResponseKey added in v0.8.0

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

func GetReturnedFeeKey added in v0.8.0

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 added in v0.8.0

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 ParamTypeTable added in v0.10.0

func ParamTypeTable() params.TypeTable

ParamTable for service module

func PrepForZeroHeightGenesis added in v0.10.0

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 added in v0.10.0

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 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 added in v0.8.0

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

ExportGenesis - output genesis parameters

func NewGenesisState

func NewGenesisState(params Params) GenesisState

type IncomingFee added in v0.8.0

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

incoming fee of a consumer

func NewIncomingFee added in v0.8.0

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

func (Keeper) ActiveRequestQueueIterator added in v0.8.0

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 added in v0.8.0

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

func (Keeper) AddIncomingFee added in v0.8.0

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 added in v0.8.0

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

func (Keeper) AddRequestExpiration added in v0.8.0

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

func (Keeper) AddResponse added in v0.8.0

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

func (Keeper) AddReturnFee added in v0.8.0

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 added in v0.8.0

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

func (Keeper) DeleteRequestExpiration added in v0.8.0

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 added in v0.8.0

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

func (Keeper) GetIncomingFee added in v0.8.0

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

func (Keeper) GetIntraTxCounter added in v0.8.0

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

get the current in-block request operation counter

func (Keeper) GetMethod added in v0.8.0

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 added in v0.10.0

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

get service params from the global param store

func (Keeper) GetReturnFee added in v0.8.0

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

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

func (Keeper) RefundFee added in v0.8.0

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

refund fees from a particular consumer, and delete it

func (Keeper) SetIncomingFee added in v0.8.0

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

func (Keeper) SetIntraTxCounter added in v0.8.0

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

set the current in-block request counter

func (Keeper) SetParamSet added in v0.10.0

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

set service params from the global param store

func (Keeper) SetReturnFee added in v0.8.0

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

func (Keeper) Slash added in v0.10.0

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 added in v0.8.0

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 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) 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 added in v0.8.0

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

MsgSvcRefundFees - struct for refund fees

func NewMsgSvcRefundFees added in v0.8.0

func NewMsgSvcRefundFees(consumer sdk.AccAddress) MsgSvcRefundFees

func (MsgSvcRefundFees) GetSignBytes added in v0.8.0

func (msg MsgSvcRefundFees) GetSignBytes() []byte

func (MsgSvcRefundFees) GetSigners added in v0.8.0

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

func (MsgSvcRefundFees) Route added in v0.8.0

func (msg MsgSvcRefundFees) Route() string

func (MsgSvcRefundFees) Type added in v0.8.0

func (msg MsgSvcRefundFees) Type() string

func (MsgSvcRefundFees) ValidateBasic added in v0.8.0

func (msg MsgSvcRefundFees) ValidateBasic() sdk.Error

type MsgSvcRequest added in v0.8.0

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 added in v0.8.0

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

func (MsgSvcRequest) GetSignBytes added in v0.8.0

func (msg MsgSvcRequest) GetSignBytes() []byte

func (MsgSvcRequest) GetSigners added in v0.8.0

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

func (MsgSvcRequest) Route added in v0.8.0

func (msg MsgSvcRequest) Route() string

func (MsgSvcRequest) Type added in v0.8.0

func (msg MsgSvcRequest) Type() string

func (MsgSvcRequest) ValidateBasic added in v0.8.0

func (msg MsgSvcRequest) ValidateBasic() sdk.Error

type MsgSvcResponse added in v0.8.0

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 added in v0.8.0

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

func (MsgSvcResponse) GetSignBytes added in v0.8.0

func (msg MsgSvcResponse) GetSignBytes() []byte

func (MsgSvcResponse) GetSigners added in v0.8.0

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

func (MsgSvcResponse) Route added in v0.8.0

func (msg MsgSvcResponse) Route() string

func (MsgSvcResponse) Type added in v0.8.0

func (msg MsgSvcResponse) Type() string

func (MsgSvcResponse) ValidateBasic added in v0.8.0

func (msg MsgSvcResponse) ValidateBasic() sdk.Error

type MsgSvcWithdrawFees added in v0.8.0

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

MsgSvcWithdrawFees - struct for withdraw fees

func NewMsgSvcWithdrawFees added in v0.8.0

func NewMsgSvcWithdrawFees(provider sdk.AccAddress) MsgSvcWithdrawFees

func (MsgSvcWithdrawFees) GetSignBytes added in v0.8.0

func (msg MsgSvcWithdrawFees) GetSignBytes() []byte

func (MsgSvcWithdrawFees) GetSigners added in v0.8.0

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

func (MsgSvcWithdrawFees) Route added in v0.8.0

func (msg MsgSvcWithdrawFees) Route() string

func (MsgSvcWithdrawFees) Type added in v0.8.0

func (msg MsgSvcWithdrawFees) Type() string

func (MsgSvcWithdrawFees) ValidateBasic added in v0.8.0

func (msg MsgSvcWithdrawFees) ValidateBasic() sdk.Error

type MsgSvcWithdrawTax added in v0.9.0

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 added in v0.9.0

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

func (MsgSvcWithdrawTax) GetSignBytes added in v0.9.0

func (msg MsgSvcWithdrawTax) GetSignBytes() []byte

func (MsgSvcWithdrawTax) GetSigners added in v0.9.0

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

func (MsgSvcWithdrawTax) Route added in v0.9.0

func (msg MsgSvcWithdrawTax) Route() string

func (MsgSvcWithdrawTax) Type added in v0.9.0

func (msg MsgSvcWithdrawTax) Type() string

func (MsgSvcWithdrawTax) ValidateBasic added in v0.9.0

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 added in v0.10.0

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"`
}

service params

func DefaultParams added in v0.10.0

func DefaultParams() Params

default service module params

func DefaultParamsForTest added in v0.10.0

func DefaultParamsForTest() Params

default service module params for test

func (*Params) GetParamSpace added in v0.10.0

func (p *Params) GetParamSpace() string

Implements params.ParamStruct

func (*Params) KeyValuePairs added in v0.10.0

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

func (*Params) StringFromBytes added in v0.10.0

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

func (*Params) Validate added in v0.10.0

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

type ReturnedFee added in v0.8.0

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

return fee of a consumer

func NewReturnedFee added in v0.8.0

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 added in v0.8.0

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 added in v0.8.0

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

func (SvcRequest) RequestID added in v0.8.0

func (req SvcRequest) RequestID() string

RequestID is of format request expirationHeight-requestHeight-intraTxCounter

type SvcResponse added in v0.8.0

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 added in v0.8.0

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