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
- type AntiSpamQuery
- type AntispamFeeDecorator
- 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 MsgFeeBucket
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidLengthCodec = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowCodec = fmt.Errorf("proto: integer overflow") )
Functions ¶
This section is empty.
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 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 MsgFeeBucket ¶
func NewMsgFeeBucket ¶
func NewMsgFeeBucket() *MsgFeeBucket
NewMsgFeeBucket returns a bucket for keeping track of fees for each message type. Message fees are indexed by the corresponding message path.
func (*MsgFeeBucket) MessageFee ¶
func (b *MsgFeeBucket) MessageFee(db weave.ReadOnlyKVStore, msgPath string) (*coin.Coin, error)
Fee returns the fee value for a given message path. It returns an empty fee and no error if the message fee is not declared.