vm

package
v0.0.7-alphanet Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2023 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AvailablePlasma

func AvailablePlasma(momentum store.Momentum, account store.Account) (uint64, error)

AvailablePlasma returns only the total amount of plasma available. *Takes* into consideration used plasma by unconfirmed blocks.

Plasma equals to fusedPlasma - plasmaUsedByUnconfirmedBlocks

func DifficultyToPlasma

func DifficultyToPlasma(difficulty uint64) uint64

func FussedAmountToPlasma

func FussedAmountToPlasma(amount *big.Int) uint64

func GetBasePlasmaForAccountBlock

func GetBasePlasmaForAccountBlock(context vm_context.AccountVmContext, block *nom.AccountBlock) (uint64, error)

GetBasePlasmaForAccountBlock calculates the smallest plasma required for an account block.

func GetDifficultyForPlasma

func GetDifficultyForPlasma(requiredPlasma uint64) (uint64, error)

Types

type ContractExecution

type ContractExecution struct {
	Transaction   *nom.AccountBlockTransaction
	ReturnedError error
}

type MomentumVM

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

func NewMomentumVM

func NewMomentumVM(context vm_context.MomentumVMContext) *MomentumVM

type SignFunc

type SignFunc func(data []byte) (signedData []byte, addr *types.Address, pubkey []byte, err error)

SignFunc is the function type defining the callback when a block requires a method to sign the transaction in supervisor

type Supervisor

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

func NewSupervisor

func NewSupervisor(chain chain.Chain, consensus consensus.Consensus) *Supervisor

func (*Supervisor) ApplyBlock

func (s *Supervisor) ApplyBlock(block *nom.AccountBlock) (*nom.AccountBlockTransaction, error)

func (*Supervisor) ApplyMomentum

func (s *Supervisor) ApplyMomentum(detailed *nom.DetailedMomentum) (result *nom.MomentumTransaction, internalErr error)

func (*Supervisor) GenerateAutoReceive

func (s *Supervisor) GenerateAutoReceive(sendBlock *nom.AccountBlock) (*ContractExecution, error)

func (*Supervisor) GenerateFromTemplate

func (s *Supervisor) GenerateFromTemplate(template *nom.AccountBlock, signFunc SignFunc) (*nom.AccountBlockTransaction, error)

func (*Supervisor) GenerateGenesisMomentum

func (s *Supervisor) GenerateGenesisMomentum(template *nom.Momentum, pool chain.AccountPool) (result *nom.MomentumTransaction, internalErr error)

func (*Supervisor) GenerateMomentum

func (s *Supervisor) GenerateMomentum(detailed *nom.DetailedMomentum, signFunc SignFunc) (result *nom.MomentumTransaction, internalErr error)

type VM

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

func NewVM

func NewVM(context vm_context.AccountVmContext) *VM

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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