controller

package
v0.0.0-...-7781947 Latest Latest
Warning

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

Go to latest
Published: May 20, 2024 License: BSD-3-Clause Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTxNotFound    = errors.New("tx not found")
	ErrAssetNotFound = errors.New("asset not found")
)

Functions

func New

func New() *vm.VM

Types

type AssetArgs

type AssetArgs struct {
	Asset ids.ID `json:"asset"`
}

type AssetReply

type AssetReply struct {
	Metadata []byte `json:"metadata"`
	Supply   uint64 `json:"supply"`
	Owner    string `json:"owner"`
	Warp     bool   `json:"warp"`
}

type BalanceArgs

type BalanceArgs struct {
	Address string `json:"address"`
	Asset   ids.ID `json:"asset"`
}

type BalanceReply

type BalanceReply struct {
	Amount uint64 `json:"amount"`
}

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

func (*Controller) Accepted

func (c *Controller) Accepted(ctx context.Context, blk *chain.StatelessBlock) error

func (*Controller) Initialize

func (c *Controller) Initialize(
	inner *vm.VM,
	snowCtx *snow.Context,
	gatherer ametrics.MultiGatherer,
	genesisBytes []byte,
	upgradeBytes []byte,
	configBytes []byte,
) (
	vm.Config,
	vm.Genesis,
	builder.Builder,
	gossiper.Gossiper,
	database.Database,
	database.Database,
	vm.Handlers,
	chain.ActionRegistry,
	chain.AuthRegistry,
	error,
)

func (*Controller) Rejected

func (*Controller) Rules

func (c *Controller) Rules(t int64) chain.Rules

func (*Controller) Shutdown

func (*Controller) Shutdown(context.Context) error

func (*Controller) StateManager

func (c *Controller) StateManager() chain.StateManager

type GenesisReply

type GenesisReply struct {
	Genesis *genesis.Genesis `json:"genesis"`
}

type Handler

type Handler struct {
	*vm.Handler // embed standard functionality
	// contains filtered or unexported fields
}

func (*Handler) Asset

func (h *Handler) Asset(req *http.Request, args *AssetArgs, reply *AssetReply) error

func (*Handler) Balance

func (h *Handler) Balance(req *http.Request, args *BalanceArgs, reply *BalanceReply) error

func (*Handler) Genesis

func (h *Handler) Genesis(_ *http.Request, _ *struct{}, reply *GenesisReply) (err error)

func (*Handler) Loan

func (h *Handler) Loan(req *http.Request, args *LoanArgs, reply *LoanReply) error

func (*Handler) Orders

func (h *Handler) Orders(req *http.Request, args *OrdersArgs, reply *OrdersReply) error

func (*Handler) Tx

func (h *Handler) Tx(req *http.Request, args *TxArgs, reply *TxReply) error

type LoanArgs

type LoanArgs struct {
	Destination ids.ID `json:"destination"`
	Asset       ids.ID `json:"asset"`
}

type LoanReply

type LoanReply struct {
	Amount uint64 `json:"amount"`
}

type Order

type Order struct {
	ID        ids.ID `json:"id"`
	Owner     string `json:"owner"` // we always send address over RPC
	InTick    uint64 `json:"inTick"`
	OutTick   uint64 `json:"outTick"`
	Remaining uint64 `json:"remaining"`
	// contains filtered or unexported fields
}

type OrderBook

type OrderBook struct {
	// contains filtered or unexported fields
}

func NewOrderBook

func NewOrderBook(c *Controller, trackedPairs []string) *OrderBook

func (*OrderBook) Add

func (o *OrderBook) Add(pair string, order *Order)

func (*OrderBook) Orders

func (o *OrderBook) Orders(pair string, limit int) []*Order

func (*OrderBook) Remove

func (o *OrderBook) Remove(id ids.ID)

func (*OrderBook) UpdateRemaining

func (o *OrderBook) UpdateRemaining(id ids.ID, remaining uint64)

type OrdersArgs

type OrdersArgs struct {
	Pair string `json:"pair"`
}

type OrdersReply

type OrdersReply struct {
	Orders []*Order `json:"orders"`
}

type StateManager

type StateManager struct{}

func (*StateManager) IncomingWarpKey

func (*StateManager) IncomingWarpKey(sourceChainID ids.ID, msgID ids.ID) []byte

func (*StateManager) OutgoingWarpKey

func (*StateManager) OutgoingWarpKey(txID ids.ID) []byte

type TxArgs

type TxArgs struct {
	TxID ids.ID `json:"txId"`
}

type TxReply

type TxReply struct {
	Timestamp int64  `json:"timestamp"`
	Success   bool   `json:"success"`
	Units     uint64 `json:"units"`
}

Jump to

Keyboard shortcuts

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