Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrTollOverflow occurs when the module's toll is larger than its cap ErrTollOverflow = errors.New("toll overflow") )
Functions ¶
This section is empty.
Types ¶
type SimpleTollStation ¶
type SimpleTollStation struct {
// contains filtered or unexported fields
}
SimpleTollStation is a simple toll station which charge 1 unit toll per op/instr
func NewSimpleTollStation ¶
func NewSimpleTollStation(max uint64) *SimpleTollStation
NewSimpleTollStation creates a new SimpleTollStation, by default the cap/max of toll is math.MaxUint64
func (*SimpleTollStation) AddToll ¶
func (ts *SimpleTollStation) AddToll(toll uint64) error
AddToll adds 1 unit toll per opcode
func (*SimpleTollStation) GetOpPrice ¶
func (ts *SimpleTollStation) GetOpPrice(_ expr.OpCode) uint64
GetOpPrice will get the price of one opcode
func (*SimpleTollStation) GetToll ¶
func (ts *SimpleTollStation) GetToll() uint64
GetToll returns the total count in the toll station
Click to show internal directories.
Click to hide internal directories.