rootchain

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 30, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(rtx RootchainTransaction) error

Build is a wrapper function that takes any transaction that satisfies RootchainTransaction interface and dispatch Build on it

func Options

Options is a wrapper function that takes any transaction that satisfies RootchainTransaction interface and dispatch Opt on it

func Submit

Submit is a wrapper function that takes any transaction that satisfies RootchainTransaction interface and dispatch Submit on it

Types

type Client

type Client struct {
	bind.ContractBackend
}

Client defines a struct that can read and write to a contract

func NewClient

func NewClient(ethclient bind.ContractBackend) *Client

NewClient initializes new root chain client

func (*Client) NewDeposit

func (c *Client) NewDeposit(vaultAddress, owner, currency common.Address, amount string) *DepositTransaction

NewDeposit is a method on root chain client that create a new deposit

func (*Client) NewProcessExit

func (c *Client) NewProcessExit(setters ...ProcessExitOption) *ProcessExitTransaction

NewProcessExit is a method on root chain client that returns a new instance of process exit transaction

func (*Client) NewStandardExit

func (c *Client) NewStandardExit(vaultAddress common.Address) *StandardExitTransaction

NewStandardExit is a method on the root chain client that creates new standard payment exit

type DepositBuilder

type DepositBuilder func(common.Address, common.Address, uint64, uint64) ([]byte, error)

DepositBuilder is a function that builds an RLP input from a set of inputs TODO clean up transaction builder signature to return a curried function instead form a deposit transaction

type DepositTransaction

type DepositTransaction struct {
	*bind.TransactOpts
	bind.ContractBackend
	VaultAddress   common.Address
	Amount         string
	Owner          common.Address
	Currency       common.Address
	VaultBinder    VaultBinder
	Builder        DepositBuilder
	RlpTransaction []byte
}

DepositTransaction is a collection of functions and data needed to make a deposit transaction on the root chain

func (*DepositTransaction) Build

func (d *DepositTransaction) Build() error

Bulid is a method on DepositTransaction that encodes the transaction to RLP with the RLP Builder

func (*DepositTransaction) Options

func (d *DepositTransaction) Options(t *bind.TransactOpts) error

Options is a method on DepositTransaction that set root chain transaction options

func (*DepositTransaction) Submit

func (d *DepositTransaction) Submit() (*types.Transaction, error)

Submit is a method on DepositTransaction that calls a deposit on the root chain vault

type ExitBinder

ExitBinder binds the go code to a payment exit game contract on the root chain

type PlasmaFrameworkBinder

type PlasmaFrameworkBinder func(common.Address, bind.ContractBackend) (*abi.PlasmaFramework, error)

PlasmaFrameworkBinder binds the go code to a plasma framework contract on the root chain TODO: make binder return struct a more generic reusable contract

type ProcessExitOption

type ProcessExitOption func(*ProcessExitOptions)

ProcessExitOption is a functional option that performs an operation on ProcessExitOptions

func NumberOfExits

func NumberOfExits(no string) ProcessExitOption

NumberOfExits sets the number of exits to process to process exit option

func PlasmaAddress

func PlasmaAddress(address common.Address) ProcessExitOption

PlasmaAddress sets the plasma contract address to process exit option

func TokenAddress

func TokenAddress(address common.Address) ProcessExitOption

TokenAddress sets the token address to process exit option

func TopExit

func TopExit(te string) ProcessExitOption

TopExit sets the top exit to process to process exit option

func VaultId

func VaultId(vid string) ProcessExitOption

VaultId sets the vault ID to process exit option

type ProcessExitOptions

type ProcessExitOptions struct {
	PlasmaAddress common.Address
	TokenAddress  common.Address
	VaultId       string
	TopExit       string
	NumberOfExits string
}

ProcessExitOptions holds the input data required to make a process exit

type ProcessExitTransaction

type ProcessExitTransaction struct {
	*bind.TransactOpts
	bind.ContractBackend
	*ProcessExitOptions
	PlasmaFrameworkBinder PlasmaFrameworkBinder
}

ProcessExitTransaction is a collection of functions and data needed to make a process exit transaction on the root chain

func (*ProcessExitTransaction) Build

func (p *ProcessExitTransaction) Build() error

Option is a method on ProcessExitTransaction that builds process exit transaction

func (*ProcessExitTransaction) Options

Option is a method on ProcessExitTransaction set root chain transaction options for process exit transaction

func (*ProcessExitTransaction) Submit

Submit makes a root chain process exit call on the contract with given arguement

type RootchainTransaction

type RootchainTransaction interface {
	Submit() (*types.Transaction, error)
	Build() error
	Options(*bind.TransactOpts) error
}

RootChainTransaction is an interface for a write operations on the root chain contract

type StandardExitTransaction

type StandardExitTransaction struct {
	*bind.TransactOpts
	bind.ContractBackend
	ExitGameAddress common.Address
	ExitBinder      ExitBinder
	Proof           []byte
	TxBytes         []byte
	UtxoPos         *big.Int
	UtxoData        StandardExitUTXOData
}

StandardExitTransaction is a collection of functions and data needed to make a payment exit transaction on the root chain

func (*StandardExitTransaction) Build

func (s *StandardExitTransaction) Build() error

Build is a method on StandardExitTransaction that deserialize transaction txbytes and proofs to golang bytes

func (*StandardExitTransaction) GetStandardExitBond

func (c *StandardExitTransaction) GetStandardExitBond(opts *bind.CallOpts) (*big.Int, error)

GetStandardExitBond is a method on StandardExitTransaction that gets standard exit bond

func (*StandardExitTransaction) Options

Options is a method on StandardExitTransaction that sets root chain transaction options

func (*StandardExitTransaction) Submit

Submit is a method on StandardExitTransaction that calls standard exit on the root chain contract

func (*StandardExitTransaction) Utxo

Utxo is a method on StandardExitTransaction that sets UTXO data returned from /utxo.get_exit_data to standard exit

type StandardExitUTXOData

type StandardExitUTXOData struct {
	Version string `json:"version"`
	Success bool   `json:"success"`
	Data    struct {
		UtxoPos *big.Int `json:"utxo_pos"`
		Txbytes string   `json:"txbytes"`
		Proof   string   `json:"proof"`
	} `json:"data"`
}

StandardExitUTXOData is a returned data from calling /utxo.get_exit_data from the watcher, the data is required to start a standard exit on the utxo

func GetUTXOExitData

func GetUTXOExitData(watcher string, utxoPosition int) (StandardExitUTXOData, error)

GetUTXOExitData is a helper function to retrieve the UTXO exit data from a given UTXO position

type VaultBinder

type VaultBinder func(common.Address, bind.ContractBackend) (*abi.Ethvault, error)

VaultBinder binds the go code to an Ethvault contract on the root chain TODO implement vault binder for ERC20

Jump to

Keyboard shortcuts

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