vault

package
v0.3.1-beta.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2023 License: MIT Imports: 9 Imported by: 3

Documentation

Overview

nolint

nolint

Index

Constants

This section is empty.

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)

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) 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) 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