Documentation ¶
Overview ¶
Package msgfee allows to define and charge an additional fee per transaction type.
With this extension it is possible to declare a fee for each transaction message type. For each message path a coin value can be declared. After successful processing of a transaction the result required fee value is increased by the declared coin value.
This extension does not know of supported (installed) message paths and therefore cannot validate for their existence. Make sure that when registering a new message fee the path is set correctly.
Index ¶
- Variables
- func NewConfigHandler(auth x.Authenticator) weave.Handler
- func NewMsgFeeBucket() orm.ModelBucket
- func RegisterQuery(qr weave.QueryRouter)
- func RegisterRoutes(r weave.Registry, auth x.Authenticator)
- type AntiSpamQuery
- type AntispamFeeDecorator
- type Configuration
- func (*Configuration) Descriptor() ([]byte, []int)
- func (m *Configuration) GetFeeAdmin() github_com_iov_one_weave.Address
- func (m *Configuration) GetMetadata() *weave.Metadata
- func (m *Configuration) GetOwner() github_com_iov_one_weave.Address
- func (m *Configuration) Marshal() (dAtA []byte, err error)
- func (m *Configuration) MarshalTo(dAtA []byte) (int, error)
- func (*Configuration) ProtoMessage()
- func (m *Configuration) Reset()
- func (m *Configuration) Size() (n int)
- func (m *Configuration) String() string
- func (m *Configuration) Unmarshal(dAtA []byte) error
- func (c *Configuration) Validate() error
- func (m *Configuration) XXX_DiscardUnknown()
- func (m *Configuration) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Configuration) XXX_Merge(src proto.Message)
- func (m *Configuration) XXX_Size() int
- func (m *Configuration) XXX_Unmarshal(b []byte) error
- type FeeDecorator
- type Initializer
- type MsgFee
- func (mf *MsgFee) Copy() orm.CloneableData
- func (*MsgFee) Descriptor() ([]byte, []int)
- func (m *MsgFee) GetFee() coin.Coin
- func (m *MsgFee) GetMetadata() *weave.Metadata
- func (m *MsgFee) GetMsgPath() string
- func (m *MsgFee) Marshal() (dAtA []byte, err error)
- func (m *MsgFee) MarshalTo(dAtA []byte) (int, error)
- func (*MsgFee) ProtoMessage()
- func (m *MsgFee) Reset()
- func (m *MsgFee) Size() (n int)
- func (m *MsgFee) String() string
- func (m *MsgFee) Unmarshal(dAtA []byte) error
- func (mf *MsgFee) Validate() error
- func (m *MsgFee) XXX_DiscardUnknown()
- func (m *MsgFee) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *MsgFee) XXX_Merge(src proto.Message)
- func (m *MsgFee) XXX_Size() int
- func (m *MsgFee) XXX_Unmarshal(b []byte) error
- type SetMsgFeeMsg
- func (*SetMsgFeeMsg) Descriptor() ([]byte, []int)
- func (m *SetMsgFeeMsg) GetFee() coin.Coin
- func (m *SetMsgFeeMsg) GetMetadata() *weave.Metadata
- func (m *SetMsgFeeMsg) GetMsgPath() string
- func (m *SetMsgFeeMsg) Marshal() (dAtA []byte, err error)
- func (m *SetMsgFeeMsg) MarshalTo(dAtA []byte) (int, error)
- func (SetMsgFeeMsg) Path() string
- func (*SetMsgFeeMsg) ProtoMessage()
- func (m *SetMsgFeeMsg) Reset()
- func (m *SetMsgFeeMsg) Size() (n int)
- func (m *SetMsgFeeMsg) String() string
- func (m *SetMsgFeeMsg) Unmarshal(dAtA []byte) error
- func (m *SetMsgFeeMsg) Validate() error
- func (m *SetMsgFeeMsg) XXX_DiscardUnknown()
- func (m *SetMsgFeeMsg) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *SetMsgFeeMsg) XXX_Merge(src proto.Message)
- func (m *SetMsgFeeMsg) XXX_Size() int
- func (m *SetMsgFeeMsg) XXX_Unmarshal(b []byte) error
- type UpdateConfigurationMsg
- func (*UpdateConfigurationMsg) Descriptor() ([]byte, []int)
- func (m *UpdateConfigurationMsg) GetMetadata() *weave.Metadata
- func (m *UpdateConfigurationMsg) GetPatch() *Configuration
- func (m *UpdateConfigurationMsg) Marshal() (dAtA []byte, err error)
- func (m *UpdateConfigurationMsg) MarshalTo(dAtA []byte) (int, error)
- func (*UpdateConfigurationMsg) Path() string
- func (*UpdateConfigurationMsg) ProtoMessage()
- func (m *UpdateConfigurationMsg) Reset()
- func (m *UpdateConfigurationMsg) Size() (n int)
- func (m *UpdateConfigurationMsg) String() string
- func (m *UpdateConfigurationMsg) Unmarshal(dAtA []byte) error
- func (m *UpdateConfigurationMsg) Validate() error
- func (m *UpdateConfigurationMsg) XXX_DiscardUnknown()
- func (m *UpdateConfigurationMsg) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *UpdateConfigurationMsg) XXX_Merge(src proto.Message)
- func (m *UpdateConfigurationMsg) XXX_Size() int
- func (m *UpdateConfigurationMsg) XXX_Unmarshal(b []byte) error
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidLengthCodec = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowCodec = fmt.Errorf("proto: integer overflow") )
Functions ¶
func NewConfigHandler ¶ added in v0.21.3
func NewConfigHandler(auth x.Authenticator) weave.Handler
func NewMsgFeeBucket ¶
func NewMsgFeeBucket() orm.ModelBucket
NewMsgFeeBucket returns a bucket for keeping track of fees for each message type. Message fees are indexed by the corresponding message path.
func RegisterQuery ¶ added in v1.0.1
func RegisterQuery(qr weave.QueryRouter)
RegisterQuery register queries from buckets in this package
func RegisterRoutes ¶ added in v0.21.3
func RegisterRoutes(r weave.Registry, auth x.Authenticator)
RegisterRoutes registers handlers for feedlist message processing.
Types ¶
type AntiSpamQuery ¶ added in v0.14.0
type AntiSpamQuery struct {
// contains filtered or unexported fields
}
AntiSpamQuery allows querying currently set anti-spam fee
func NewAntiSpamQuery ¶ added in v0.14.0
func NewAntiSpamQuery(minFee coin.Coin) *AntiSpamQuery
func (*AntiSpamQuery) Query ¶ added in v0.14.0
func (q *AntiSpamQuery) Query(db weave.ReadOnlyKVStore, mod string, data []byte) ([]weave.Model, error)
func (*AntiSpamQuery) RegisterQuery ¶ added in v0.14.0
func (q *AntiSpamQuery) RegisterQuery(qr weave.QueryRouter)
type AntispamFeeDecorator ¶ added in v0.14.0
type AntispamFeeDecorator struct {
// contains filtered or unexported fields
}
AntispamFeeDecorator implements a decorator that for each processed transaction asks for a minimal fee. The fee is defined globally in the app. If fee is not set (zero value) or is less than the fee already asked for the transaction then this decorator is a noop.
func NewAntispamFeeDecorator ¶ added in v0.14.0
func NewAntispamFeeDecorator(fee coin.Coin) *AntispamFeeDecorator
NewAntispamFeeDecorator returns an AntispamFeeDecorator
type Configuration ¶ added in v0.21.3
type Configuration struct { Metadata *weave.Metadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` // Owner is present to implement gconf.OwnedConfig interface // This defines the Address that is allowed to update the Configuration object and is // needed to make use of gconf.NewUpdateConfigurationHandler Owner github_com_iov_one_weave.Address `protobuf:"bytes,2,opt,name=owner,proto3,casttype=github.com/iov-one/weave.Address" json:"owner,omitempty"` // FeeAdmin is an address that is allowed to change the fee. FeeAdmin github_com_iov_one_weave.Address `` /* 127-byte string literal not displayed */ }
func (*Configuration) Descriptor ¶ added in v0.21.3
func (*Configuration) Descriptor() ([]byte, []int)
func (*Configuration) GetFeeAdmin ¶ added in v0.21.3
func (m *Configuration) GetFeeAdmin() github_com_iov_one_weave.Address
func (*Configuration) GetMetadata ¶ added in v0.21.3
func (m *Configuration) GetMetadata() *weave.Metadata
func (*Configuration) GetOwner ¶ added in v0.21.3
func (m *Configuration) GetOwner() github_com_iov_one_weave.Address
func (*Configuration) Marshal ¶ added in v0.21.3
func (m *Configuration) Marshal() (dAtA []byte, err error)
func (*Configuration) MarshalTo ¶ added in v0.21.3
func (m *Configuration) MarshalTo(dAtA []byte) (int, error)
func (*Configuration) ProtoMessage ¶ added in v0.21.3
func (*Configuration) ProtoMessage()
func (*Configuration) Reset ¶ added in v0.21.3
func (m *Configuration) Reset()
func (*Configuration) Size ¶ added in v0.21.3
func (m *Configuration) Size() (n int)
func (*Configuration) String ¶ added in v0.21.3
func (m *Configuration) String() string
func (*Configuration) Unmarshal ¶ added in v0.21.3
func (m *Configuration) Unmarshal(dAtA []byte) error
func (*Configuration) Validate ¶ added in v0.21.3
func (c *Configuration) Validate() error
func (*Configuration) XXX_DiscardUnknown ¶ added in v0.21.3
func (m *Configuration) XXX_DiscardUnknown()
func (*Configuration) XXX_Marshal ¶ added in v0.21.3
func (m *Configuration) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*Configuration) XXX_Merge ¶ added in v0.21.3
func (m *Configuration) XXX_Merge(src proto.Message)
func (*Configuration) XXX_Size ¶ added in v0.21.3
func (m *Configuration) XXX_Size() int
func (*Configuration) XXX_Unmarshal ¶ added in v0.21.3
func (m *Configuration) XXX_Unmarshal(b []byte) error
type FeeDecorator ¶
type FeeDecorator struct {
// contains filtered or unexported fields
}
FeeDecorator implements a decorator that for each processed transaction attach an additional fee to the result. Each fee is declared per transaction type. If fee is not set (zero value) then this decorator does not increase the required fee value. Additional fee is attached to only those transaction results that represent a success.
func NewFeeDecorator ¶
func NewFeeDecorator() *FeeDecorator
NewFeeDecorator returns a decorator that is upading the cost of processing each message according to the fee configured per each message type.
type Initializer ¶
type Initializer struct{}
Initializer fulfils the Initializer interface to load data from the genesis file
func (*Initializer) FromGenesis ¶
func (*Initializer) FromGenesis(opts weave.Options, params weave.GenesisParams, kv weave.KVStore) error
FromGenesis will parse initial account info from genesis and save it to the database
type MsgFee ¶
type MsgFee struct { Metadata *weave.Metadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` MsgPath string `protobuf:"bytes,2,opt,name=msg_path,json=msgPath,proto3" json:"msg_path,omitempty"` Fee coin.Coin `protobuf:"bytes,3,opt,name=fee,proto3" json:"fee"` }
MsgFee represents a fee for a single message that must be paid in order for the message to be processed.
func (*MsgFee) Copy ¶
func (mf *MsgFee) Copy() orm.CloneableData
func (*MsgFee) Descriptor ¶
func (*MsgFee) GetMetadata ¶ added in v0.15.0
func (*MsgFee) GetMsgPath ¶
func (*MsgFee) ProtoMessage ¶
func (*MsgFee) ProtoMessage()
func (*MsgFee) XXX_DiscardUnknown ¶
func (m *MsgFee) XXX_DiscardUnknown()
func (*MsgFee) XXX_Marshal ¶
func (*MsgFee) XXX_Unmarshal ¶
type SetMsgFeeMsg ¶ added in v0.21.3
type SetMsgFeeMsg struct { Metadata *weave.Metadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` MsgPath string `protobuf:"bytes,2,opt,name=msg_path,json=msgPath,proto3" json:"msg_path,omitempty"` Fee coin.Coin `protobuf:"bytes,3,opt,name=fee,proto3" json:"fee"` }
SetMsgFeeMsg set given fee for a specified message path. This message sets a new fee of overwrites an existing one. Fee must not be less than zero. Use zero value coin to unset a fee.
func (*SetMsgFeeMsg) Descriptor ¶ added in v0.21.3
func (*SetMsgFeeMsg) Descriptor() ([]byte, []int)
func (*SetMsgFeeMsg) GetFee ¶ added in v0.21.3
func (m *SetMsgFeeMsg) GetFee() coin.Coin
func (*SetMsgFeeMsg) GetMetadata ¶ added in v0.21.3
func (m *SetMsgFeeMsg) GetMetadata() *weave.Metadata
func (*SetMsgFeeMsg) GetMsgPath ¶ added in v0.21.3
func (m *SetMsgFeeMsg) GetMsgPath() string
func (*SetMsgFeeMsg) Marshal ¶ added in v0.21.3
func (m *SetMsgFeeMsg) Marshal() (dAtA []byte, err error)
func (*SetMsgFeeMsg) MarshalTo ¶ added in v0.21.3
func (m *SetMsgFeeMsg) MarshalTo(dAtA []byte) (int, error)
func (SetMsgFeeMsg) Path ¶ added in v0.21.3
func (SetMsgFeeMsg) Path() string
func (*SetMsgFeeMsg) ProtoMessage ¶ added in v0.21.3
func (*SetMsgFeeMsg) ProtoMessage()
func (*SetMsgFeeMsg) Reset ¶ added in v0.21.3
func (m *SetMsgFeeMsg) Reset()
func (*SetMsgFeeMsg) Size ¶ added in v0.21.3
func (m *SetMsgFeeMsg) Size() (n int)
func (*SetMsgFeeMsg) String ¶ added in v0.21.3
func (m *SetMsgFeeMsg) String() string
func (*SetMsgFeeMsg) Unmarshal ¶ added in v0.21.3
func (m *SetMsgFeeMsg) Unmarshal(dAtA []byte) error
func (*SetMsgFeeMsg) Validate ¶ added in v0.21.3
func (m *SetMsgFeeMsg) Validate() error
func (*SetMsgFeeMsg) XXX_DiscardUnknown ¶ added in v0.21.3
func (m *SetMsgFeeMsg) XXX_DiscardUnknown()
func (*SetMsgFeeMsg) XXX_Marshal ¶ added in v0.21.3
func (m *SetMsgFeeMsg) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*SetMsgFeeMsg) XXX_Merge ¶ added in v0.21.3
func (m *SetMsgFeeMsg) XXX_Merge(src proto.Message)
func (*SetMsgFeeMsg) XXX_Size ¶ added in v0.21.3
func (m *SetMsgFeeMsg) XXX_Size() int
func (*SetMsgFeeMsg) XXX_Unmarshal ¶ added in v0.21.3
func (m *SetMsgFeeMsg) XXX_Unmarshal(b []byte) error
type UpdateConfigurationMsg ¶ added in v0.21.3
type UpdateConfigurationMsg struct { Metadata *weave.Metadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` Patch *Configuration `protobuf:"bytes,2,opt,name=patch,proto3" json:"patch,omitempty"` }
func (*UpdateConfigurationMsg) Descriptor ¶ added in v0.21.3
func (*UpdateConfigurationMsg) Descriptor() ([]byte, []int)
func (*UpdateConfigurationMsg) GetMetadata ¶ added in v0.21.3
func (m *UpdateConfigurationMsg) GetMetadata() *weave.Metadata
func (*UpdateConfigurationMsg) GetPatch ¶ added in v0.21.3
func (m *UpdateConfigurationMsg) GetPatch() *Configuration
func (*UpdateConfigurationMsg) Marshal ¶ added in v0.21.3
func (m *UpdateConfigurationMsg) Marshal() (dAtA []byte, err error)
func (*UpdateConfigurationMsg) MarshalTo ¶ added in v0.21.3
func (m *UpdateConfigurationMsg) MarshalTo(dAtA []byte) (int, error)
func (*UpdateConfigurationMsg) Path ¶ added in v0.21.3
func (*UpdateConfigurationMsg) Path() string
func (*UpdateConfigurationMsg) ProtoMessage ¶ added in v0.21.3
func (*UpdateConfigurationMsg) ProtoMessage()
func (*UpdateConfigurationMsg) Reset ¶ added in v0.21.3
func (m *UpdateConfigurationMsg) Reset()
func (*UpdateConfigurationMsg) Size ¶ added in v0.21.3
func (m *UpdateConfigurationMsg) Size() (n int)
func (*UpdateConfigurationMsg) String ¶ added in v0.21.3
func (m *UpdateConfigurationMsg) String() string
func (*UpdateConfigurationMsg) Unmarshal ¶ added in v0.21.3
func (m *UpdateConfigurationMsg) Unmarshal(dAtA []byte) error
func (*UpdateConfigurationMsg) Validate ¶ added in v0.21.3
func (m *UpdateConfigurationMsg) Validate() error
Validate will skip any zero fields and validate the set ones.
func (*UpdateConfigurationMsg) XXX_DiscardUnknown ¶ added in v0.21.3
func (m *UpdateConfigurationMsg) XXX_DiscardUnknown()
func (*UpdateConfigurationMsg) XXX_Marshal ¶ added in v0.21.3
func (m *UpdateConfigurationMsg) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*UpdateConfigurationMsg) XXX_Merge ¶ added in v0.21.3
func (m *UpdateConfigurationMsg) XXX_Merge(src proto.Message)
func (*UpdateConfigurationMsg) XXX_Size ¶ added in v0.21.3
func (m *UpdateConfigurationMsg) XXX_Size() int
func (*UpdateConfigurationMsg) XXX_Unmarshal ¶ added in v0.21.3
func (m *UpdateConfigurationMsg) XXX_Unmarshal(b []byte) error