vault

package
v1.5.0-alpha.4-nomain Latest Latest
Warning

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

Go to latest
Published: Apr 16, 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 if Spend overlows available amount (see method with the same name).
	ErrAmountNotAvailable = errors.New("vault: amount not available")
)
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

	DrainedSoFar uint64
}

func (*Vault) Available

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

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.

Jump to

Keyboard shortcuts

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