Skip to content Search Apps Documentation Source Content Run Reset Eval Playground File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

v2 source realm

Package vault is the demo vault, version 2. Users deposit ugnot and withdraw it later. Version 2 fixes the bug Bounce...

Overview

Package vault is the demo vault, version 2. Users deposit ugnot and withdraw it later. Version 2 fixes the bug Bouncer proved in version 1: Balances returns a copy of the ledger, not a pointer to it (security guide §5.1).

Functions 5

func Deposit

crossing Action
1func Deposit(cur realm)
source

Deposit credits the caller with the ugnot sent with the call.

func Withdraw

crossing Action
1func Withdraw(cur realm, amount int64)
source

Withdraw pays the caller back up to their balance.

func Balances

Action
1func Balances() []Entry
source

Balances returns a copy of the ledger, for frontends that list depositors.

Types 1

type Entry

struct
1type Entry struct {
2	Depositor address
3	Balance   int64
4}
source

Entry is one depositor's balance.

Dependencies

Source Files 2