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 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) 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 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 declarated 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 ¶
FromGenesis will parse initial account info from genesis and save it to the database
type MsgFee ¶
type MsgFee struct { MsgPath string `protobuf:"bytes,1,opt,name=msg_path,json=msgPath,proto3" json:"msg_path,omitempty"` Fee coin.Coin `protobuf:"bytes,2,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) 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 eeach message type. Message fees are indexed by the corresponding message path.
func (*MsgFeeBucket) MessageFee ¶
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.