energy

package
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2025 License: LGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Energy

type Energy struct {
	// contains filtered or unexported fields
}

Energy implements energy operations.

func New

func New(addr thor.Address, state *state.State, blockTime uint64, params *params.Params) *Energy

New creates a new energy instance.

func (*Energy) Add

func (e *Energy) Add(addr thor.Address, amount *big.Int) error

Add add amount of energy to given address.

func (*Energy) CalculateRewards added in v2.4.0

func (e *Energy) CalculateRewards(staker staker) (*big.Int, error)

func (*Energy) DistributeRewards added in v2.4.0

func (e *Energy) DistributeRewards(beneficiary, signer thor.Address, staker staker, currentBlock uint32) error

func (*Energy) Get

func (e *Energy) Get(addr thor.Address) (*big.Int, error)

Get returns energy of an account at given block time.

func (*Energy) GetEnergyGrowthStopTime added in v2.4.0

func (e *Energy) GetEnergyGrowthStopTime() (uint64, error)

GetEnergyGrowthStopTime returns the stop time of energy growth if the stop time is not set, return math.MaxUint64

func (*Energy) SetInitialSupply

func (e *Energy) SetInitialSupply(token *big.Int, energy *big.Int) error

SetInitialSupply set initial token and energy supply, to help calculating total energy supply.

func (*Energy) StopEnergyGrowth added in v2.4.0

func (e *Energy) StopEnergyGrowth() error

StopEnergyGrowth sets the end time of energy growth at the current block time.

func (*Energy) Sub

func (e *Energy) Sub(addr thor.Address, amount *big.Int) (bool, error)

Sub sub amount of energy from given address. False is returned if no enough energy.

func (*Energy) TokenTotalSupply

func (e *Energy) TokenTotalSupply() (*big.Int, error)

TokenTotalSupply returns total supply of VET.

func (*Energy) TotalBurned

func (e *Energy) TotalBurned() (*big.Int, error)

TotalBurned returns energy totally burned.

func (*Energy) TotalSupply

func (e *Energy) TotalSupply() (*big.Int, error)

TotalSupply returns total supply of energy. Does not account for burned tokens.

Jump to

Keyboard shortcuts

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