plasma

package
v0.0.0-...-ee6a38e Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2020 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Deposit

type Deposit struct {
	UserId int
	Value  int
}

type HotConfig

type HotConfig interface {
	DepositPeriod() (time.Duration, error)
	TransferPeriod() (time.Duration, error)
	OnchainWithdrawalPeriod() (time.Duration, error)
	OffchainWithdrawalPeriod() (time.Duration, error)
}

type OffchainWithdrawal

type OffchainWithdrawal struct {
	UserId    int
	Value     int
	Address   string
	Nonce     int
	Signature string
}

type OnchainWithdrawal

type OnchainWithdrawal struct {
	UserId  int
	Value   int
	Address string
}

type Operator

type Operator interface {
	// web
	RegisterUser(username, password, addr string) (*User, error)
	CreateTransfer(trans Transfer) error
	CreateOffchainWithdraw(from string, withd OffchainWithdrawal) error
	// plasma blocks
	ExecuteDeposits() error
	ExecuteTransfers() error
	ExecuteOnchainWithdrawals() error
	ExecuteOffchainWithdrawals() error
}

type Storage

type Storage interface {
	// user
	IsUsernameAvailable(username string) bool
	IsUserValid(username, password string) bool
	CreateUser(user *User) error
	GetUsersCount() int
	UserById(id int) (*User, error)
	UserByAddress(addr string) (*User, error)
	ReduceBalance(user_id int, value int) error
	IncreaseBalance(user_id int, value int) error
	// deposit
	CreateDeposit(dep *Deposit) error
	DepositsByUserId(id int) ([]Deposit, error)
	// transfer
	CreateTransfer(trans *Transfer) error
	TransfersByUserId(id int) ([]Transfer, error)
	// onchain withdraw
	CreateOnchainWithdraw(withd *OnchainWithdrawal) error
	OnchainWithdrawalsByUserId(id int) ([]OnchainWithdrawal, error)
	// offchain withdraw
	CreateOffchainWithdraw(withd *OffchainWithdrawal) error
	OffchainWithdrawalsByUserId(id int) ([]OffchainWithdrawal, error)
}

type Transfer

type Transfer struct {
	UserId    int
	From      string
	To        string
	Value     int
	Nonce     int
	Signature string
}

type User

type User struct {
	Idn      int
	Username string
	Password string
	Address  string
	Balance  int
}

Directories

Path Synopsis
web

Jump to

Keyboard shortcuts

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