vault

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2024 License: MIT Imports: 9 Imported by: 3

Documentation

Overview

nolint

nolint

Index

Constants

View Source
const (
	VAULT_STATE_SIZE = core.ACCOUNT_HEADER_SIZE + 56
	DRAINED_SIZE     = 8
)

Variables

View Source
var (
	// ErrNotOwner is raised if Spend is not executed by a principal that matches owner.
	ErrNotOwner = errors.New("vault: not an owner")
	// ErrAmountNotAvailable is raised if Spend overlows available amount (see method with the same name).
	ErrAmountNotAvailable = errors.New("vault: amount not available")
	// ErrMisconfigured is raised if a Vault account is misconfigured.
	ErrMisconfigured = errors.New("vault: account is misconfigured")
)
View Source
var TemplateAddress core.Address

TemplateAddress is an address of the vault template.

Functions

func Register

func Register(reg *registry.Registry)

Register vault template.

Types

type SpawnArguments

type SpawnArguments struct {
	Owner               core.Address
	TotalAmount         uint64
	InitialUnlockAmount uint64
	VestingStart        core.LayerID
	VestingEnd          core.LayerID
}

SpawnArguments for the vault.

func (*SpawnArguments) DecodeScale

func (t *SpawnArguments) DecodeScale(dec *scale.Decoder) (total int, err error)

func (*SpawnArguments) EncodeScale

func (t *SpawnArguments) EncodeScale(enc *scale.Encoder) (total int, err error)

func (*SpawnArguments) String

func (args *SpawnArguments) String() string

type SpendArguments

type SpendArguments = wallet.SpendArguments

SpendArguments contains recipient and amount.

type Vault

type Vault struct {
	Owner               core.Address
	TotalAmount         uint64
	InitialUnlockAmount uint64
	VestingStart        core.LayerID
	VestingEnd          core.LayerID
}

func (*Vault) BaseGas

func (v *Vault) BaseGas(uint8) uint64

func (*Vault) DecodeScale

func (t *Vault) DecodeScale(dec *scale.Decoder) (total int, err error)

func (*Vault) EncodeScale

func (t *Vault) EncodeScale(enc *scale.Encoder) (total int, err error)

func (*Vault) ExecGas

func (v *Vault) ExecGas(uint8) uint64

func (*Vault) LoadGas

func (v *Vault) LoadGas() uint64

func (*Vault) MaxSpend

func (v *Vault) MaxSpend(uint8, any) (uint64, error)

MaxSpend is noop for this template type, principal of this account type can't submit transactions.

func (*Vault) Spend

func (v *Vault) Spend(host core.Host, to core.Address, amount uint64) error

Spend transaction.

func (*Vault) Verify

func (v *Vault) Verify(core.Host, []byte, *scale.Decoder) bool

Verify always returns false.

func (*Vault) Vested added in v1.5.0

func (v *Vault) Vested(lid core.LayerID) uint64

Jump to

Keyboard shortcuts

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