types

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2020 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventTypeRequestSvc     = "request_service"
	EventTypeRespondSvc     = "respond_service"
	EventTypeSvcCallTimeout = "service_call_expiration"

	AttributeKeyProvider   = "provider"
	AttributeKeyConsumer   = "consumer"
	AttributeKeyRequestID  = "request_id"
	AttributeKeyServiceFee = "service_fee"
	AttributeKeySlashCoins = "service_slash_coins"

	AttributeValueCategory = "service"
)

Service module event types

View Source
const (
	// ModuleName is the name of the service module
	ModuleName = "service"

	// StoreKey is the string store representation
	StoreKey = ModuleName

	// QuerierRoute is the querier route for the service module
	QuerierRoute = ModuleName

	// RouterKey is the msg router key for the service module
	RouterKey = ModuleName

	// DefaultParamspace is the default name for parameter store
	DefaultParamspace = ModuleName

	// DepositAccName is the root string for the service deposit account address
	DepositAccName = "service_deposit_account"

	// RequestAccName is the root string for the service request account address
	RequestAccName = "service_request_account"

	// TaxAccName is the root string for the service tax account address
	TaxAccName = "service_tax_account"
)
View Source
const (
	// types for msgs
	TypeMsgSvcDef           = "define_service"
	TypeMsgSvcBind          = "bind_service"
	TypeMsgSvcBindingUpdate = "update_service_binding"
	TypeMsgSvcDisable       = "disable_service"
	TypeMsgSvcEnable        = "enable_service"
	TypeMsgSvcRefundDeposit = "refund_service_deposit"
	TypeMsgSvcRequest       = "call_service"
	TypeMsgSvcResponse      = "respond_service"
	TypeMsgSvcRefundFees    = "refund_service_fees"
	TypeMsgSvcWithdrawFees  = "withdraw_service_fees"
	TypeMsgSvcWithdrawTax   = "withdraw_service_tax"

	MaxNameLength        = 70  // max length of the service name
	MaxChainIDLength     = 50  // max length of the chain ID
	MaxDescriptionLength = 280 // max length of the service and author description
	MaxTagCount          = 10  // max total number of the tags
	MaxTagLength         = 70  // max length of the tag
)
View Source
const (
	QueryDefinition = "definition"
	QueryBinding    = "binding"
	QueryBindings   = "bindings"
	QueryRequests   = "requests"
	QueryResponse   = "response"
	QueryFees       = "fees"
)
View Source
const MetricsSubsystem = "module_" + ModuleName

Variables

View Source
var (
	ErrUnknownSvcDef            = sdkerrors.Register(ModuleName, 1, "unknown service definition")
	ErrUnknownSvcBinding        = sdkerrors.Register(ModuleName, 2, "unknown service binding")
	ErrInvalidServiceName       = sdkerrors.Register(ModuleName, 3, "invalid service name, must contain alphanumeric characters, _ and - only,length greater than 0 and less than or equal to 128")
	ErrInvalidOutputPrivacyEnum = sdkerrors.Register(ModuleName, 4, "invalid output privacy enum")
	ErrInvalidOutputCachedEnum  = sdkerrors.Register(ModuleName, 5, "invalid output cached enum")
	ErrSvcBindingExists         = sdkerrors.Register(ModuleName, 6, "service binding already exists")
	ErrLtMinProviderDeposit     = sdkerrors.Register(ModuleName, 7, "deposit amount must be equal or greater than min provider deposit")
	ErrUnknownMethod            = sdkerrors.Register(ModuleName, 8, "unknown service method")
	ErrUnavailable              = sdkerrors.Register(ModuleName, 9, "service binding is unavailable")
	ErrAvailable                = sdkerrors.Register(ModuleName, 10, "service binding is available")
	ErrRefundDeposit            = sdkerrors.Register(ModuleName, 11, "can't refund deposit")
	ErrIntOverflow              = sdkerrors.Register(ModuleName, 12, "Int overflow")
	ErrUnknownProfiler          = sdkerrors.Register(ModuleName, 13, "unknown profiler")
	ErrUnknownTrustee           = sdkerrors.Register(ModuleName, 14, "unknown trustee")
	ErrLtServiceFee             = sdkerrors.Register(ModuleName, 15, "service fee amount must be equal or greater than price")
	ErrUnknownActiveRequest     = sdkerrors.Register(ModuleName, 16, "unknown active request")
	ErrNotMatchingProvider      = sdkerrors.Register(ModuleName, 17, "not a matching provider")
	ErrNotMatchingReqChainID    = sdkerrors.Register(ModuleName, 18, "not a matching request chain-id")
	ErrUnknownReturnFee         = sdkerrors.Register(ModuleName, 19, "no service refund fees")
	ErrUnknownWithdrawFee       = sdkerrors.Register(ModuleName, 20, "no service withdraw fees")
	ErrUnknownResponse          = sdkerrors.Register(ModuleName, 21, "unknown response")
	ErrInvalidPriceCount        = sdkerrors.Register(ModuleName, 22, "invalid price count")
)

service module sentinel errors

View Source
var (

	// Keys for store prefixes
	ServiceDefinitionKey         = []byte{0x01}
	MethodPropertyKey            = []byte{0x02}
	BindingPropertyKey           = []byte{0x03}
	RequestKey                   = []byte{0x05}
	ResponseKey                  = []byte{0x06}
	RequestsByExpirationIndexKey = []byte{0x07}
	IntraTxCounterKey            = []byte{0x08} // key for intra-block tx index
	ActiveRequestKey             = []byte{0x09} // key for active request
	ReturnedFeeKey               = []byte{0x10}
	IncomingFeeKey               = []byte{0x11}

	ServiceFeeTaxKey        = []byte{0x12}
	ServiceSlashFractionKey = []byte{0x13}
)
View Source
var (
	DefaultMaxRequestTimeout    = int64(100)
	DefaultMinDepositMultiple   = int64(1000)
	DefaultServiceFeeTax        = sdk.NewDecWithPrec(1, 2) // 1%
	DefaultSlashFraction        = sdk.NewDecWithPrec(1, 3) // 0.1%
	DefaultComplaintRetrospect  = 15 * 24 * time.Hour      // 15 days
	DefaultArbitrationTimeLimit = 5 * 24 * time.Hour       // 5 days
	DefaultTxSizeLimit          = uint64(4000)
)

Service params default values

View Source
var (
	MinRequestTimeout       = int64(2)
	MinDepositMultiple      = int64(500)
	MaxDepositMultiple      = int64(5000)
	MaxServiceFeeTax        = sdk.NewDecWithPrec(2, 1)
	MaxSlashFraction        = sdk.NewDecWithPrec(1, 2)
	MinComplaintRetrospect  = 15 * 24 * time.Hour
	MaxComplaintRetrospect  = 30 * 24 * time.Hour
	MinArbitrationTimeLimit = 5 * 24 * time.Hour
	MaxArbitrationTimeLimit = 10 * 24 * time.Hour
	MinTxSizeLimit          = uint64(2000)
	MaxTxSizeLimit          = uint64(6000)
)

no lint

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

nolint - Keys for parameter access

View Source
var ModuleCdc *codec.Codec

ModuleCdc defines the module codec

Functions

func ConvertRequestID

func ConvertRequestID(requestId string) (eHeight int64, rHeight int64, counter int16, err 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 RegisterCodec

func RegisterCodec(cdc *codec.Codec)

Register concrete types on codec codec

func SvcBindingEqual

func SvcBindingEqual(bindingA, bindingB SvcBinding) bool

func ValidateGenesis

func ValidateGenesis(data GenesisState) error

ValidateGenesis validates the provided service genesis state

Types

type BankKeeper

type BankKeeper interface {
	SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error
}

BankKeeper defines the expected bank keeper (noalias)

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" yaml:"definition"`
	Methods    []MethodProperty `json:"methods" yaml:"methods"`
}

type FeesOutput

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

type GenesisState

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

GenesisState - all service state that must be provided at genesis

func DefaultGenesisState

func DefaultGenesisState() GenesisState

DefaultGenesisState returns the default genesis state

func NewGenesisState

func NewGenesisState(params Params) GenesisState

NewGenesisState constructs a GenesisState

type GuardianKeeper

type GuardianKeeper interface {
	GetProfiler(ctx sdk.Context, addr sdk.AccAddress) (guardian guardianexported.GuardianI, found bool)
	GetTrustee(ctx sdk.Context, addr sdk.AccAddress) (guardian guardianexported.GuardianI, found bool)
}

GuardianKeeper defines the expected guardian keeper (noalias)

type IncomingFee

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

incoming fee of a consumer

func NewIncomingFee

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

type Level

type Level struct {
	AvgRspTime int64 `json:"avg_rsp_time" yaml:"avg_rsp_time"`
	UsableTime int64 `json:"usable_time" yaml:"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" yaml:"id"`
	Name          string            `json:"name" yaml:"name"`
	Description   string            `json:"description" yaml:"description"`
	OutputPrivacy OutputPrivacyEnum `json:"output_privacy" yaml:"output_privacy"`
	OutputCached  OutputCachedEnum  `json:"output_cached" yaml:"output_cached"`
}

func MethodToMethodProperty

func MethodToMethodProperty(index int, method protoidl.Method) (methodProperty MethodProperty, err error)

type Metrics

type Metrics struct {
	ActiveRequests metrics.Gauge
}

func NopMetrics

func NopMetrics() *Metrics

func PrometheusMetrics

func PrometheusMetrics(config *cfg.InstrumentationConfig) *Metrics

TODO PrometheusMetrics returns Metrics built by the Prometheus client library.

type MsgSvcBind

type MsgSvcBind struct {
	DefName     string         `json:"def_name" yaml:"def_name"`
	DefChainID  string         `json:"def_chain_id" yaml:"def_chain_id"`
	BindChainID string         `json:"bind_chain_id" yaml:"bind_chain_id"`
	Provider    sdk.AccAddress `json:"provider" yaml:"provider"`
	BindingType BindingType    `json:"binding_type" yaml:"binding_type"`
	Deposit     sdk.Coins      `json:"deposit" yaml:"deposit"`
	Prices      []sdk.Coin     `json:"price" yaml:"price"`
	Level       Level          `json:"level" yaml:"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() error

type MsgSvcBindingUpdate

type MsgSvcBindingUpdate struct {
	DefName     string         `json:"def_name" yaml:"def_name"`
	DefChainID  string         `json:"def_chain_id" yaml:"def_chain_id"`
	BindChainID string         `json:"bind_chain_id" yaml:"bind_chain_id"`
	Provider    sdk.AccAddress `json:"provider" yaml:"provider"`
	BindingType BindingType    `json:"binding_type" yaml:"binding_type"`
	Deposit     sdk.Coins      `json:"deposit" yaml:"deposit"`
	Prices      []sdk.Coin     `json:"price" yaml:"price"`
	Level       Level          `json:"level" yaml:"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() 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() 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() error

type MsgSvcDisable

type MsgSvcDisable struct {
	DefName     string         `json:"def_name" yaml:"def_name"`
	DefChainID  string         `json:"def_chain_id" yaml:"def_chain_id"`
	BindChainID string         `json:"bind_chain_id" yaml:"bind_chain_id"`
	Provider    sdk.AccAddress `json:"provider" yaml:"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() error

type MsgSvcEnable

type MsgSvcEnable struct {
	DefName     string         `json:"def_name" yaml:"def_name"`
	DefChainID  string         `json:"def_chain_id" yaml:"def_chain_id"`
	BindChainID string         `json:"bind_chain_id" yaml:"bind_chain_id"`
	Provider    sdk.AccAddress `json:"provider" yaml:"provider"`
	Deposit     sdk.Coins      `json:"deposit" yaml:"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() error

type MsgSvcRefundDeposit

type MsgSvcRefundDeposit struct {
	DefName     string         `json:"def_name" yaml:"def_name"`
	DefChainID  string         `json:"def_chain_id" yaml:"def_chain_id"`
	BindChainID string         `json:"bind_chain_id" yaml:"bind_chain_id"`
	Provider    sdk.AccAddress `json:"provider" yaml:"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() error

type MsgSvcRefundFees

type MsgSvcRefundFees struct {
	Consumer sdk.AccAddress `json:"consumer" yaml:"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() error

type MsgSvcRequest

type MsgSvcRequest struct {
	DefChainID  string         `json:"def_chain_id" yaml:"def_chain_id"`
	DefName     string         `json:"def_name" yaml:"def_name"`
	BindChainID string         `json:"bind_chain_id" yaml:"bind_chain_id"`
	ReqChainID  string         `json:"req_chain_id" yaml:"req_chain_id"`
	MethodID    int16          `json:"method_id" yaml:"method_id"`
	Provider    sdk.AccAddress `json:"provider" yaml:"provider"`
	Consumer    sdk.AccAddress `json:"consumer" yaml:"consumer"`
	Input       []byte         `json:"input" yaml:"input"`
	ServiceFee  sdk.Coins      `json:"service_fee" yaml:"service_fee"`
	Profiling   bool           `json:"profiling" yaml:"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() error

type MsgSvcResponse

type MsgSvcResponse struct {
	ReqChainID string         `json:"req_chain_id" yaml:"req_chain_id"`
	RequestID  string         `json:"request_id" yaml:"request_id"`
	Provider   sdk.AccAddress `json:"provider" yaml:"provider"`
	Output     []byte         `json:"output" yaml:"output"`
	ErrorMsg   []byte         `json:"error_msg" yaml:"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() error

type MsgSvcWithdrawFees

type MsgSvcWithdrawFees struct {
	Provider sdk.AccAddress `json:"provider" yaml:"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() error

type MsgSvcWithdrawTax

type MsgSvcWithdrawTax struct {
	Trustee     sdk.AccAddress `json:"trustee" yaml:"trustee"`
	DestAddress sdk.AccAddress `json:"dest_address" yaml:"dest_address"`
	Amount      sdk.Coins      `json:"amount" yaml:"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() 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" yaml:"max_request_timeout"`
	MinDepositMultiple   int64         `json:"min_deposit_multiple" yaml:"min_deposit_multiple"`
	ServiceFeeTax        sdk.Dec       `json:"service_fee_tax" yaml:"service_fee_tax"`
	SlashFraction        sdk.Dec       `json:"slash_fraction" yaml:"slash_fraction"`
	ComplaintRetrospect  time.Duration `json:"complaint_retrospect" yaml:"complaint_retrospect"`
	ArbitrationTimeLimit time.Duration `json:"arbitration_time_limit" yaml:"arbitration_time_limit"`
	TxSizeLimit          uint64        `json:"tx_size_limit" yaml:"tx_size_limit"`
}

Params defines the high level settings for service

func DefaultParams

func DefaultParams() Params

DefaultParams returns a default set of parameters.

func MustUnmarshalParams

func MustUnmarshalParams(cdc *codec.Codec, value []byte) Params

MustUnmarshalParams unmarshals the current service params value from store key or panic

func NewParams

func NewParams(maxRequestTimeout, minDepositMultiple int64, serviceFeeTax, slashFraction sdk.Dec,
	complaintRetrospect, arbitrationTimeLimit time.Duration, txSizeLimit uint64) Params

NewParams creates a new Params instance

func UnmarshalParams

func UnmarshalParams(cdc *codec.Codec, value []byte) (params Params, err error)

UnmarshalParams unmarshals the current service params value from store key

func (Params) Equal

func (p Params) Equal(p2 Params) bool

Equal returns a boolean determining if two Param types are identical. TODO: This is slower than comparing struct fields directly

func (*Params) ParamSetPairs

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

Implements params.ParamSet

func (Params) String

func (p Params) String() string

String implements stringer

func (Params) Validate

func (p Params) Validate() error

Validate validates a set of params

type QueryBindingParams

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

type QueryBindingsParams

type QueryBindingsParams struct {
	DefChainID  string
	ServiceName string
}

type QueryDefinitionParams

type QueryDefinitionParams struct {
	DefChainID  string
	ServiceName string
}

type QueryFeesParams

type QueryFeesParams struct {
	Address sdk.AccAddress
}

type QueryRequestsParams

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

type QueryResponseParams

type QueryResponseParams struct {
	ReqChainId string
	RequestId  string
}

type ReturnedFee

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

return fee of a consumer

func NewReturnedFee

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

type SupplyKeeper

type SupplyKeeper interface {
	GetModuleAccount(ctx sdk.Context, moduleName string) supplyexported.ModuleAccountI
	GetModuleAddress(moduleName string) sdk.AccAddress

	SendCoinsFromModuleToModule(ctx sdk.Context, senderModule string, recipientModule string, amt sdk.Coins) error
	SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error
	SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error

	BurnCoins(ctx sdk.Context, name string, amt sdk.Coins) error
}

SupplyKeeper defines the expected supply Keeper (noalias)

type SvcBinding

type SvcBinding struct {
	DefName     string         `json:"def_name" yaml:"def_name"`
	DefChainID  string         `json:"def_chain_id" yaml:"def_chain_id"`
	BindChainID string         `json:"bind_chain_id" yaml:"bind_chain_id"`
	Provider    sdk.AccAddress `json:"provider" yaml:"provider"`
	BindingType BindingType    `json:"binding_type" yaml:"binding_type"`
	Deposit     sdk.Coins      `json:"deposit" yaml:"deposit"`
	Prices      []sdk.Coin     `json:"price" yaml:"price"`
	Level       Level          `json:"level" yaml:"level"`
	Available   bool           `json:"available" yaml:"available"`
	DisableTime time.Time      `json:"disable_time" yaml:"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" yaml:"name"`
	ChainId           string         `json:"chain_id" yaml:"chain_id"`
	Description       string         `json:"description" yaml:"description"`
	Tags              []string       `json:"tags" yaml:"tags"`
	Author            sdk.AccAddress `json:"author" yaml:"author"`
	AuthorDescription string         `json:"author_description" yaml:"author_description"`
	IDLContent        string         `json:"idl_content" yaml:"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" yaml:"def_chain_id"`
	DefName               string         `json:"def_name" yaml:"def_name" `
	BindChainID           string         `json:"bind_chain_id" yaml:"bind_chain_id`
	ReqChainID            string         `json:"req_chain_id" yaml:"req_chain_id"`
	MethodID              int16          `json:"method_id" yaml:"method_id"`
	Provider              sdk.AccAddress `json:"provider" yaml:"provider"`
	Consumer              sdk.AccAddress `json:"consumer" yaml:"consumer"`
	Input                 []byte         `json:"input" yaml:"input"`
	ServiceFee            sdk.Coins      `json:"service_fee" yaml:"service_fee"`
	Profiling             bool           `json:"profiling" yaml:"profiling"`                               // profiling model will be free of service charges
	RequestHeight         int64          `json:"request_height" yaml:"request_height"`                     // block height of service request
	RequestIntraTxCounter int16          `json:"request_intra_tx_counter" yaml:"request_intra_tx_counter"` // block-local tx index of service request
	ExpirationHeight      int64          `json:"expiration_height" yaml:"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" yaml:"req_chain_id"`
	RequestHeight         int64          `json:"request_height" yaml:"request_height"`
	RequestIntraTxCounter int16          `json:"request_intra_tx_counter" yaml:"request_intra_tx_counter"`
	ExpirationHeight      int64          `json:"expiration_height" yaml:"expiration_height"`
	Provider              sdk.AccAddress `json:"provider" yaml:"provider"`
	Consumer              sdk.AccAddress `json:"consumer" yaml:"consumer"`
	Output                []byte         `json:"output" yaml:"output"`
	ErrorMsg              []byte         `json:"error_msg" yaml:"error_msg"`
}

func NewSvcResponse

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

Jump to

Keyboard shortcuts

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