v0

package
v0.0.0-...-1bfa4a9 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2021 License: MIT Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeAddress = "address"
	TypeStr     = "str"
	TypeB32     = "b32"
	TypeB       = "b"
	TypeI8      = "i8"
	TypeI16     = "i16"
	TypeI32     = "i32"
	TypeI64     = "i64"
	TypeI128    = "i128"
	TypeI256    = "i256"
	TypeU8      = "u8"
	TypeU16     = "u16"
	TypeU32     = "u32"
	TypeU64     = "u64"
	TypeU128    = "u128"
	TypeU256    = "u256"
	TypeRecord  = "record"
	TypeList    = "list"
)

Enumeration of standard types.

View Source
const (
	ExtTypeEthCompatAddress = "ext_ethCompatAddress"
	ExtTypeBtcCompatUTXO    = "ext_btcCompatUTXO"
	ExtTypeBtcCompatUTXOs   = "ext_btcCompatUTXOs"
	ExtTypeEthCompatTx      = "ext_ethCompatTx"
	ExtTypeEthCompatPayload = "ext_ethCompatPayload"
)

Enumeration of extended types. Extended types are implemented whenever a new distributed ledger is introduced to RenVM, and no standard type can be used to represent values needed by the shifter contracts.

View Source
const (
	// MethodQueryShards returns information about the currently online/offline
	// Shards.
	// Deprecated in v1 by queryState
	MethodQueryShards = "ren_queryShards"

	// MethodQueryFees returns information about the current RenVM fees and
	// undelrying blockchain fees. This information cannot be verified.
	// Deprecated in v1 by query
	MethodQueryFees = "ren_queryFees"
)
View Source
const (
	TxStatusNil = TxStatus(0)
	// TxStatusConfirming   = TxStatus(1)
	TxStatusPending   = TxStatus(2)
	TxStatusExecuting = TxStatus(3)
	TxStatusDone      = TxStatus(4)
)

Variables

View Source
var (
	// IntrinsicDefault is the default Shard.
	IntrinsicDefault = Shard(sha3.Sum256([]byte{}))
	// IntrinsicBtc is the Shard for all assets that originate on the Bitcoin
	// blockchain.
	IntrinsicBtc = Shard(sha3.Sum256([]byte("Btc")))
	// IntrinsicZec is the Shard for all assets that originate on the ZCash
	// blockchain.
	IntrinsicZec = Shard(sha3.Sum256([]byte("Zec")))
	// IntrinsicBch is the Shard for all assets that originate on the Bitcoin
	// cash blockchain.
	IntrinsicBch = Shard(sha3.Sum256([]byte("Bch")))
	// IntrinsicEth is the Shard for all assets that originate on the Ethereum
	// blockchain.
	IntrinsicEth = Shard(sha3.Sum256([]byte("Eth")))
)
View Source
var ErrNotFound = errors.New("compatstore: not found")

ErrNotFound wraps redis errors to hide implementation details

View Source
var IntrinsicBCH0Bch2Eth = Contract{
	Address: "BCH0Bch2Eth",
	In: Formals{
		{"p", ExtTypeEthCompatPayload},
		{"token", ExtTypeEthCompatAddress},
		{"to", ExtTypeEthCompatAddress},
		{"n", TypeB32},
		{"utxo", ExtTypeBtcCompatUTXO},
	},
	Autogen: Formals{
		{"ghash", TypeB32},
		{"nhash", TypeB32},
		{"phash", TypeB32},
		{"sighash", TypeB32},
		{"amount", TypeU256},
		{"utxo", ExtTypeBtcCompatUTXO},
	},
	Out: Formals{
		{"r", TypeB32},
		{"s", TypeB32},
		{"v", TypeU8},
	},
}

IntrinsicBCH0Bch2Eth transfers BCH from the BitcoinCash blockchain to the Ethereum blockchain.

View Source
var IntrinsicBCH0Eth2Bch = Contract{
	Address: "BCH0Eth2Bch",
	In: Formals{
		{"ref", TypeU64},
	},
	Out: Formals{
		{"txhash", TypeB},
	},
}

IntrinsicBCH0Eth2Bch transfers BCH from the Ethereum blockchain to the BitcoinCash blockchain.

View Source
var IntrinsicBTC0Btc2Eth = Contract{
	Address: "BTC0Btc2Eth",
	In: Formals{
		{"p", ExtTypeEthCompatPayload},
		{"token", ExtTypeEthCompatAddress},
		{"to", ExtTypeEthCompatAddress},
		{"n", TypeB32},
		{"utxo", ExtTypeBtcCompatUTXO},
	},
	Autogen: Formals{
		{"ghash", TypeB32},
		{"nhash", TypeB32},
		{"phash", TypeB32},
		{"sighash", TypeB32},
		{"amount", TypeU256},
		{"utxo", ExtTypeBtcCompatUTXO},
	},
	Out: Formals{
		{"r", TypeB32},
		{"s", TypeB32},
		{"v", TypeU8},
	},
}

IntrinsicBTC0Btc2Eth transfers BTC from the Bitcoin blockchain to the Ethereum blockchain.

View Source
var IntrinsicBTC0Eth2Btc = Contract{
	Address: "BTC0Eth2Btc",
	In: Formals{
		{"ref", TypeU64},
	},
	Out: Formals{
		{"txhash", TypeB},
	},
}

IntrinsicBTC0Eth2Btc transfers BTC from the Ethereum blockchain to the Bitcoin blockchain.

View Source
var IntrinsicZEC0Eth2Zec = Contract{
	Address: "ZEC0Eth2Zec",
	In: Formals{
		{"ref", TypeU64},
	},
	Out: Formals{
		{"txhash", TypeB},
	},
}

IntrinsicZEC0Eth2Zec transfers ZEC from the Ethereum blockchain to the ZCash blockchain.

View Source
var IntrinsicZEC0Zec2Eth = Contract{
	Address: "ZEC0Zec2Eth",
	In: Formals{
		{"p", ExtTypeEthCompatPayload},
		{"token", ExtTypeEthCompatAddress},
		{"to", ExtTypeEthCompatAddress},
		{"n", TypeB32},
		{"utxo", ExtTypeBtcCompatUTXO},
	},
	Autogen: Formals{
		{"ghash", TypeB32},
		{"nhash", TypeB32},
		{"phash", TypeB32},
		{"sighash", TypeB32},
		{"amount", TypeU256},
		{"utxo", ExtTypeBtcCompatUTXO},
	},
	Out: Formals{
		{"r", TypeB32},
		{"s", TypeB32},
		{"v", TypeU8},
	},
}

IntrinsicZEC0Zec2Eth transfers ZEC from the ZCash blockchain to the Ethereum blockchain.

Intrinsics are Contracts that are always known to RenVM.

Functions

func AddressEncodeDecoder

func AddressEncodeDecoder(chain multichain.Chain, network multichain.Network) multichain.AddressEncodeDecoder

func IsShiftIn

func IsShiftIn(addr Address) bool

IsShiftIn returns if the given contract address is a shiftIn contract. Please only use this function when you know the contract exists, otherwise it will panic.

func NetParams

func NetParams(chain multichain.Chain, net multichain.Network) *chaincfg.Params

func ToFromV1Selector

func ToFromV1Selector(sel tx.Selector) string

ToFromV1Selector creates the "to" field in the v0 tx The "to" field in the v0 tx is the equivalent of a selector here we convert the v1 selector into the v0 format

func V1QueryTxFromQueryTx

func V1QueryTxFromQueryTx(queryTx ParamsQueryTx) jsonrpc.ParamsQueryTx

V1QueryTxFromQueryTx casts a v0 ParamsQueryTx to a v1 ParamsQueryTx by encoding the txhash in the appropriate manner

func V1TxFromV0Burn

func V1TxFromV0Burn(ctx context.Context, v0tx Tx, bindings *binding.Binding, network multichain.Network) (tx.Tx, error)

func V1TxParamsFromTx

func V1TxParamsFromTx(ctx context.Context, params ParamsSubmitTx, bindings *binding.Binding, pubkey *id.PubKey, store CompatStore, network multichain.Network) (jsonrpc.ParamsSubmitTx, error)

V1TxParamsFromTx will create a v1 Tx from a v0 Tx Will attempt to check if we have already constructed the parameters previously, otherwise will construct a v1 tx using v0 parameters, and persist a mapping so that a v0 queryTX can find them

func ValidateAddress

func ValidateAddress(addr Address) error

func ValidateV0Tx

func ValidateV0Tx(tx Tx) error

ValidateV0Tx check the tx has a valid contract address and has all the required input fields.

func ZcashNetParams

func ZcashNetParams(network multichain.Network) *zcash.Params

Types

type Address

type Address string

Address is a address on RenVM.

func (Address) Equal

func (address Address) Equal(other Value) bool

Equal implements the Value interface for the Addr type.

func (Address) MarshalBinary

func (address Address) MarshalBinary() ([]byte, error)

MarshalBinary implements the `encoding.BinaryMarshaler` interface for the Address type.

func (Address) Type

func (Address) Type() Type

Type implements the Value interface for the Address type.

func (*Address) UnmarshalBinary

func (address *Address) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the `encoding.BinaryUnmarshaler` interface for the Address type.

func (*Address) UnmarshalJSON

func (address *Address) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for the Address type.

type Arg

type Arg struct {
	Name  string `json:"name"`
	Type  Type   `json:"type"`
	Value Value  `json:"value"`
}

An Arg defines a Value that can fulfil a Formal. It is used to align a Value in a Tx to an expected Value in a Contract.

func (Arg) Equal

func (arg Arg) Equal(other Arg) bool

func (*Arg) IsNil

func (arg *Arg) IsNil() bool

IsNil returns true when the Arg is nil, otherwise it returns false.

func (Arg) MarshalBinary

func (arg Arg) MarshalBinary() ([]byte, error)

MarshalBinary implements the `encoding.BinaryMarshaler` interface for the Arg type.

func (*Arg) UnmarshalBinary

func (arg *Arg) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the `encoding.BinaryUnmarshaler` interface for the Arg type.

func (*Arg) UnmarshalJSON

func (arg *Arg) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler for the Arg type.

type Args

type Args []Arg

Args is a wrapper type for the Arg slice type.

func (Args) Equal

func (args Args) Equal(other Args) bool

func (Args) Get

func (args Args) Get(name string) Arg

Get an Argument by its name. This method runs in linear time.

func (*Args) Remove

func (args *Args) Remove(name string)

Remove an Argument by its name. This method runs in linear time.

func (*Args) Set

func (args *Args) Set(arg Arg)

Set an Argument value by its name. It does not check that the value is of the correct type. This method runs in linear time.

type B

type B []byte

B is a slice of bytes.

func BFromHex

func BFromHex(str string) (B, error)

BFromHex returns a B Value decoded from a hex encoded string. The "0x" prefix is optional.

func (B) Equal

func (b B) Equal(other Value) bool

Equal implements the Value interface for the B type.

func (B) MarshalBinary

func (b B) MarshalBinary() ([]byte, error)

MarshalBinary implements the `encoding.BinaryMarshaler` interface for the B type.

func (B) String

func (b B) String() string

String implements the Stringer interface for the B type.

func (B) Type

func (B) Type() Type

Type implements the Value interface for the B type.

func (*B) UnmarshalBinary

func (b *B) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the `encoding.BinaryMarshaler` interface for the B type.

func (*B) UnmarshalJSON

func (b *B) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for the B type.

type B32

type B32 [32]byte

B32 is a slice of 32 bytes.

func B32FromHex

func B32FromHex(str string) (B32, error)

B32FromHex returns a B32 Value decoded from a hex encoded string. The "0x" prefix is optional.

func BurnTxHash

func BurnTxHash(sel tx.Selector, ref pack.U256) B32

BurnTxHash creates V0 BurnTxHash from params available in V1

func MintTxHash

func MintTxHash(sel tx.Selector, ghash pack.Bytes32, txid pack.Bytes, txindex pack.U32) B32

MintTxHash creates V0 MintTxHash from params available in V1

func V0TxHashFromTx

func V0TxHashFromTx(tx Tx) (B32, error)

func V1TxFromV0Mint

func V1TxFromV0Mint(ctx context.Context, v0tx Tx, bindings *binding.Binding, pubkey *id.PubKey) (tx.Tx, B32, error)

func (B32) Equal

func (b32 B32) Equal(other Value) bool

Equal implements the Value interface for the B32 type.

func (B32) MarshalBinary

func (b32 B32) MarshalBinary() ([]byte, error)

MarshalBinary implements the `encoding.BinaryMarshaler` interface for the B32 type.

func (B32) MarshalJSON

func (b32 B32) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for the B32 type.

func (B32) String

func (b32 B32) String() string

String implements the Stringer interface for the B32 type.

func (B32) Type

func (B32) Type() Type

Type implements the Value interface for the B32 type.

func (*B32) UnmarshalBinary

func (b32 *B32) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the `encoding.BinaryMarshaler` interface for the B32 type.

func (*B32) UnmarshalJSON

func (b32 *B32) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for the B32 type.

type CompatShard

type CompatShard struct {
	DarknodesRootHash string    `json:"darknodesRootHash"`
	Gateways          []Gateway `json:"gateways"`
	GatewaysRootHash  string    `json:"gatewaysRootHash"`
	Primary           bool      `json:"primary"`
	PubKey            string    `json:"pubKey"`
}

type CompatStore

type CompatStore interface {

	// PersistTxMappings maps the v0 tx to the v1 tx for future querying.
	PersistTxMappings(v0tx Tx, v1tx tx.Tx) error

	// GetV1TxFromTx gets the v1 transaction from v0 transaction
	GetV1TxFromTx(tx Tx) (tx.Tx, error)

	// GetV1HashFromHash gets the v1 transaction hash from v0 transaction hash.
	GetV1HashFromHash(hash B32) (id.Hash, error)
}

CompatStore aims to abstract compat persistence mappings

type Contract

type Contract struct {
	Address Address `json:"address"`
	In      Formals `json:"in"`
	Autogen Formals `json:"autogen"`
	Out     Formals `json:"out"`
}

A Contract ABI defines the expected components of a Contract. It must have a unique Addr, a slice of expected input Formals, and a slice of expected output Formals. Any Tx that is sent to a Contract must have Args that are compatible with the its input Formals.

type Contracts

type Contracts []Contract

Contracts is a wrapper type for the Contract slice type.

type ExtBtcCompatUTXO

type ExtBtcCompatUTXO struct {
	TxHash B32 `json:"txHash"`
	VOut   U32 `json:"vOut"`

	ScriptPubKey B    `json:"scriptPubKey,omitempty"`
	Amount       U256 `json:"amount,omitempty"`
	GHash        B32  `json:"ghash,omitempty"`
}

ExtBtcCompatUTXO is a Bitcoin compatible UTXO. It is used for transactions on Bitcoin (and forks).

func (ExtBtcCompatUTXO) Equal

func (utxo ExtBtcCompatUTXO) Equal(other Value) bool

Equal implements the Value interface for the ExtBtcCompatUTXO type.

func (ExtBtcCompatUTXO) MarshalBinary

func (extBtcCompatUTXO ExtBtcCompatUTXO) MarshalBinary() ([]byte, error)

MarshalBinary implements the `encoding.BinaryMarshaler` interface for the ExtBtcCompatUTXO type.

func (ExtBtcCompatUTXO) Type

func (ExtBtcCompatUTXO) Type() Type

Type implements the Value interface for the ExtBtcCompatUTXO type.

func (*ExtBtcCompatUTXO) UnmarshalBinary

func (extBtcCompatUTXO *ExtBtcCompatUTXO) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the `encoding.BinaryMarshaler` interface for the ExtBtcCompatUTXO type.

type ExtBtcCompatUTXOs

type ExtBtcCompatUTXOs []ExtBtcCompatUTXO

ExtBtcCompatUTXOs is a wrapper type.

func (ExtBtcCompatUTXOs) Amount

func (extBtcCompatUTXOs ExtBtcCompatUTXOs) Amount() U256

Amount returns the sum of all amounts in the UTXOs.

func (ExtBtcCompatUTXOs) Equal

func (utxos ExtBtcCompatUTXOs) Equal(other Value) bool

Equal implements the Value interface for the ExtBtcCompatUTXOs type.

func (ExtBtcCompatUTXOs) MarshalBinary

func (extBtcCompatUTXOs ExtBtcCompatUTXOs) MarshalBinary() ([]byte, error)

MarshalBinary implements the `encoding.BinaryMarshaler` interface for the ExtBtcCompatUTXOs type.

func (ExtBtcCompatUTXOs) Sort

func (utxos ExtBtcCompatUTXOs) Sort()

Sort the UTXOs by amount, from smallest to largest.

func (ExtBtcCompatUTXOs) Type

func (ExtBtcCompatUTXOs) Type() Type

Type implements the Value interface for the ExtBtcCompatUTXOs type.

func (*ExtBtcCompatUTXOs) UnmarshalBinary

func (extBtcCompatUTXOs *ExtBtcCompatUTXOs) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the `encoding.BinaryMarshaler` interface for the ExtBtcCompatUTXOs type.

type ExtEthCompatAddress

type ExtEthCompatAddress common.Address

ExtEthCompatAddress is an Ethereum compatible address.

func ExtEthCompatAddressFromHex

func ExtEthCompatAddressFromHex(str string) (ExtEthCompatAddress, error)

ExtEthCompatAddressFromHex returns a ExtEthCompatAddress value decoded from a hex encoded string. The "0x" prefix is optional.

func (ExtEthCompatAddress) Equal

func (extEthCompatAddress ExtEthCompatAddress) Equal(other Value) bool

Equal implements the Value interface for the B20 type.

func (ExtEthCompatAddress) MarshalBinary

func (extEthCompatAddress ExtEthCompatAddress) MarshalBinary() ([]byte, error)

MarshalBinary implements the `encoding.BinaryMarshaler` interface for the ExtEthCompatAddress type.

func (ExtEthCompatAddress) MarshalJSON

func (extEthCompatAddress ExtEthCompatAddress) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Unmarshaler interface for the ExtEthCompatAddress type.

func (ExtEthCompatAddress) String

func (extEthCompatAddress ExtEthCompatAddress) String() string

String implements the Stringer interface for the ExtEthCompatAddress type.

func (ExtEthCompatAddress) Type

func (ExtEthCompatAddress) Type() Type

Type implements the Value interface for the ExtEthCompatAddress type.

func (*ExtEthCompatAddress) UnmarshalBinary

func (extEthCompatAddress *ExtEthCompatAddress) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the `encoding.BinaryMarshaler` interface for the ExtEthCompatAddress type.

func (*ExtEthCompatAddress) UnmarshalJSON

func (extEthCompatAddress *ExtEthCompatAddress) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for the ExtEthCompatAddress type.

type ExtEthCompatPayload

type ExtEthCompatPayload struct {
	ABI   B `json:"abi"`
	Value B `json:"value"`
	Fn    B `json:"fn"`
}

ExtEthCompatPayload is an Ethereum compatible packed payload.

func (ExtEthCompatPayload) Equal

func (payload ExtEthCompatPayload) Equal(other Value) bool

Equal implements the Value interface for the ExtEthCompatPayload type.

func (*ExtEthCompatPayload) Hash

func (payload *ExtEthCompatPayload) Hash() B32

Hash returns the keccak hash of the payload.

func (ExtEthCompatPayload) MarshalBinary

func (payload ExtEthCompatPayload) MarshalBinary() ([]byte, error)

MarshalBinary implements the `encoding.BinaryMarshaler` interface for the ExtEthCompatPayload type.

func (ExtEthCompatPayload) Type

func (ExtEthCompatPayload) Type() Type

Type implements the Value interface for the ExtEthCompatPayload type.

func (*ExtEthCompatPayload) UnmarshalBinary

func (payload *ExtEthCompatPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the `encoding.BinaryMarshaler` interface for the ExtEthCompatPayload type.

type ExtEthCompatTx

type ExtEthCompatTx struct {
	TxHash B32 `json:"txHash"`
}

ExtEthCompatTx is an Ethereum compatible transaction. It is used to representation transactions on Ethereum (and forks).

func (ExtEthCompatTx) Equal

func (tx ExtEthCompatTx) Equal(other Value) bool

Equal implements the Value interface for the ExtEthCompatTx type.

func (ExtEthCompatTx) MarshalBinary

func (extEthCompatTx ExtEthCompatTx) MarshalBinary() ([]byte, error)

MarshalBinary implements the `encoding.BinaryMarshaler` interface for the ExtEthCompatTx type.

func (ExtEthCompatTx) Type

func (ExtEthCompatTx) Type() Type

Type implements the Value interface for the ExtEthCompatTx type.

func (*ExtEthCompatTx) UnmarshalBinary

func (extEthCompatTx *ExtEthCompatTx) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the `encoding.BinaryMarshaler` interface for the ExtEthCompatTx type.

type Fees

type Fees struct {
	Lock     U64             `json:"lock"`
	Release  U64             `json:"release"`
	Ethereum MintAndBurnFees `json:"ethereum"`
}

type Formal

type Formal struct {
	Name string `json:"name"`
	Type Type   `json:"type"`
}

A Formal defines the expected name and type of a Value that will be passed in/out of a Contract. A Formal has no Value, because it is only a definition of the expected form of a Value.

func (Formal) MarshalJSON

func (formal Formal) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for the Formal type.

func (*Formal) UnmarshalJSON

func (formal *Formal) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for the Formal type.

type Formals

type Formals []Formal

Formals is a wrapper type for the Formal slice type.

type Gateway

type Gateway struct {
	Asset  string   `json:"asset"`
	Hosts  []string `json:"hosts"`
	Locked string   `json:"locked"`
	Origin string   `json:"origin"`
	PubKey string   `json:"pubKey"`
}

type I128

type I128 struct {
	Int *big.Int
}

I128 stores a big.Int representing a 128 bit unsigned integer.

func (I128) Equal

func (i128 I128) Equal(other Value) bool

Equal implements the Value interface for the I128 type.

func (I128) MarshalBinary

func (i128 I128) MarshalBinary() ([]byte, error)

MarshalBinary implements the `encoding.BinaryMarshaler` interface for the I128 type.

func (I128) MarshalJSON

func (i128 I128) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for the I128 type.

func (I128) Type

func (I128) Type() Type

Type implements the Value interface for the I128 type.

func (*I128) UnmarshalBinary

func (i128 *I128) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the `encoding.BinaryMarshaler` interface for the I128 type.

func (*I128) UnmarshalJSON

func (i128 *I128) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for the I128 type.

type I16

type I16 struct {
	Int *big.Int
}

I16 stores a big.Int representing a 16 bit unsigned integer.

func (I16) Equal

func (i16 I16) Equal(other Value) bool

Equal implements the Value interface for the I16 type.

func (I16) MarshalBinary

func (i16 I16) MarshalBinary() ([]byte, error)

MarshalBinary implements the `encoding.BinaryMarshaler` interface for the I16 type.

func (I16) MarshalJSON

func (i16 I16) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for the I16 type.

func (I16) Type

func (I16) Type() Type

Type implements the Value interface for the I16 type.

func (*I16) UnmarshalBinary

func (i16 *I16) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the `encoding.BinaryMarshaler` interface for the I16 type.

func (*I16) UnmarshalJSON

func (i16 *I16) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for the I16 type.

type I256

type I256 struct {
	Int *big.Int
}

I256 stores a big.Int representing a 256 bit unsigned integer.

func (I256) Equal

func (i256 I256) Equal(other Value) bool

Equal implements the Value interface for the I256 type.

func (I256) MarshalBinary

func (i256 I256) MarshalBinary() ([]byte, error)

MarshalBinary implements the `encoding.BinaryMarshaler` interface for the I256 type.

func (I256) MarshalJSON

func (i256 I256) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for the I256 type.

func (I256) Type

func (I256) Type() Type

Type implements the Value interface for the I256 type.

func (*I256) UnmarshalBinary

func (i256 *I256) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the `encoding.BinaryMarshaler` interface for the I256 type.

func (*I256) UnmarshalJSON

func (i256 *I256) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for the I256 type.

type I32

type I32 struct {
	Int *big.Int
}

I32 stores a big.Int representing a 32 bit unsigned integer.

func (I32) Equal

func (i32 I32) Equal(other Value) bool

Equal implements the Value interface for the I32 type.

func (I32) MarshalBinary

func (i32 I32) MarshalBinary() ([]byte, error)

MarshalBinary implements the `encoding.BinaryMarshaler` interface for the I32 type.

func (I32) MarshalJSON

func (i32 I32) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for the I32 type.

func (I32) Type

func (I32) Type() Type

Type implements the Value interface for the I32 type.

func (*I32) UnmarshalBinary

func (i32 *I32) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the `encoding.BinaryMarshaler` interface for the I32 type.

func (*I32) UnmarshalJSON

func (i32 *I32) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for the I32 type.

type I64

type I64 struct {
	Int *big.Int
}

I64 stores a big.Int representing a 64 bit unsigned integer.

func (I64) Equal

func (i64 I64) Equal(other Value) bool

Equal implements the Value interface for the I64 type.

func (I64) MarshalBinary

func (i64 I64) MarshalBinary() ([]byte, error)

MarshalBinary implements the `encoding.BinaryMarshaler` interface for the I64 type.

func (I64) MarshalJSON

func (i64 I64) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for the I64 type.

func (I64) Type

func (I64) Type() Type

Type implements the Value interface for the I64 type.

func (*I64) UnmarshalBinary

func (i64 *I64) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the `encoding.BinaryMarshaler` interface for the I64 type.

func (*I64) UnmarshalJSON

func (i64 *I64) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for the I64 type.

type I8

type I8 struct {
	Int *big.Int
}

I8 stores a big.Int representing a 8 bit unsigned integer.

func (I8) Equal

func (i8 I8) Equal(other Value) bool

Equal implements the Value interface for the I8 type.

func (I8) MarshalBinary

func (i8 I8) MarshalBinary() ([]byte, error)

MarshalBinary implements the `encoding.BinaryMarshaler` interface for the I8 type.

func (I8) MarshalJSON

func (i8 I8) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for the I8 type.

func (I8) Type

func (I8) Type() Type

Type implements the Value interface for the I8 type.

func (*I8) UnmarshalBinary

func (i8 *I8) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the `encoding.BinaryMarshaler` interface for the I8 type.

func (*I8) UnmarshalJSON

func (i8 *I8) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for the I8 type.

type List

type List []Value

func (List) Equal

func (list List) Equal(other Value) bool

Equal implements the Value interface for the List type.

func (List) MarshalBinary

func (list List) MarshalBinary() ([]byte, error)

func (List) MarshalJSON

func (list List) MarshalJSON() ([]byte, error)

func (List) Type

func (List) Type() Type

func (*List) UnmarshalBinary

func (list *List) UnmarshalBinary(data []byte) error

func (*List) UnmarshalJSON

func (list *List) UnmarshalJSON(data []byte) error

type MintAndBurnFees

type MintAndBurnFees struct {
	Mint U64 `json:"mint"`
	Burn U64 `json:"burn"`
}

type ParamsQueryTx

type ParamsQueryTx struct {
	TxHash B32 `json:"txHash"`
}

type ParamsSubmitTx

type ParamsSubmitTx struct {
	Tx Tx `json:"tx"`
}

type Record

type Record map[string]Value

func (Record) Clone

func (record Record) Clone() Record

Clone returns a deep clone of the original Record. Modifying this deep clone will not modify the original Record.

func (Record) Compatible

func (record Record) Compatible(other Value) bool

Compatible returns true when the two Records have the field Types. Otherwise, it returns false.

func (Record) Equal

func (record Record) Equal(other Value) bool

Equal implements the Value interface for the Record type.

func (Record) MarshalBinary

func (record Record) MarshalBinary() ([]byte, error)

MarshalBinary implements the `encoding.BinaryMarshaler` interface for the Record type.

func (Record) MarshalJSON

func (record Record) MarshalJSON() ([]byte, error)

MarshalJSON implements the `json.Marshaler` interface for the Record type.

func (Record) Type

func (Record) Type() Type

Type implements the Value interface for the Record type.

func (*Record) UnmarshalBinary

func (record *Record) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the `encoding.BinaryMarshaler` interface for the Record type.

func (*Record) UnmarshalJSON

func (record *Record) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the `json.Unmarshaler` interface for the Record type.

type ResponseQueryFees

type ResponseQueryFees struct {
	Btc Fees `json:"btc"`
	Zec Fees `json:"zec"`
	Bch Fees `json:"bch"`
}

func QueryFeesResponseFromState

func QueryFeesResponseFromState(state map[string]engine.XState) (ResponseQueryFees, error)

ShardsResponseFromState takes a QueryState rpc response and converts it into a QueryShards rpc response It can be a standalone function as it has no dependencies

type ResponseQueryShards

type ResponseQueryShards struct {
	Shards []CompatShard `json:"shards"`
}

ResponseQueryShards defines the response of the MethodQueryShards.

func ShardsResponseFromSystemState

func ShardsResponseFromSystemState(state engine.SystemState) (ResponseQueryShards, error)

ShardsResponseFromState takes a QueryState rpc response and converts it into a QueryShards rpc response It can be a standalone function as it has no dependencies

type ResponseQueryTx

type ResponseQueryTx struct {
	Tx       Tx     `json:"tx"`
	TxStatus string `json:"txStatus"`
}

type ResponseSubmitTx

type ResponseSubmitTx struct {
	Tx Tx `json:"tx"`
}

type Shard

type Shard [32]byte

A Shard stores multiple Contracts. The Txs sent to a Shard are guaranteed to be strictly ordered within that Shard.

func (Shard) String

func (shard Shard) String() string

String implements the `fmt.Stringer` interface.

type Store

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

func NewCompatStore

func NewCompatStore(db db.DB, client redis.Cmdable, expiry time.Duration) Store

func (Store) GetV1HashFromHash

func (store Store) GetV1HashFromHash(v0hash B32) (id.Hash, error)

func (Store) GetV1TxFromTx

func (store Store) GetV1TxFromTx(transaction Tx) (tx.Tx, error)

func (Store) PersistTxMappings

func (store Store) PersistTxMappings(v0tx Tx, v1tx tx.Tx) error

type Str

type Str string

Str is a dynamically sized string.

func (Str) Equal

func (str Str) Equal(other Value) bool

Equal implements the Value interface for the Str type.

func (Str) MarshalBinary

func (str Str) MarshalBinary() ([]byte, error)

MarshalBinary implements the `encoding.BinaryMarshaler` interface for the Str type.

func (Str) Type

func (Str) Type() Type

Type implements the Value interface for the Str type.

func (*Str) UnmarshalBinary

func (str *Str) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the `encoding.BinaryMarshaler` interface for the Str type.

func (*Str) UnmarshalJSON

func (str *Str) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for the Str type.

type Tx

type Tx struct {
	Hash    B32     `json:"hash"`
	To      Address `json:"to"`
	In      Args    `json:"in"`
	Autogen Args    `json:"autogen,omitempty"`
	Out     Args    `json:"out,omitempty"`
}

A Tx ABI defines the expected components of a Tx. It must have the Contract Address, to which it will be sent, and a slice of Args that it will pass to the Contract. The Args must be compatible with the input Formals of the Contract.

func BurnTxFromV1Tx

func BurnTxFromV1Tx(t tx.Tx, bindings binding.Bindings) (Tx, error)

func TxFromV1Tx

func TxFromV1Tx(t tx.Tx, hasOut bool, bindings binding.Bindings) (Tx, error)

TxFromV1Tx takes a V1 Tx and converts it to a V0 Tx.

func (*Tx) Copy

func (tx *Tx) Copy() Tx

Copy creates a deep copy of the tx object.

func (Tx) Equal

func (tx Tx) Equal(other Tx) bool

func (Tx) MarshalBinary

func (tx Tx) MarshalBinary() ([]byte, error)

MarshalBinary implements the `encoding.BinaryMarshaler` interface for the Tx type.

func (*Tx) UnmarshalBinary

func (tx *Tx) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the `encoding.BinaryUnmarshaler` interface for the Tx type.

type TxStatus

type TxStatus uint8

func (TxStatus) MarshalBinary

func (s TxStatus) MarshalBinary() ([]byte, error)

MarshalBinary implements the `encoding.BinaryMarshaler` interface for the TxStatus type.

func (TxStatus) String

func (s TxStatus) String() string

func (*TxStatus) UnmarshalBinary

func (s *TxStatus) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the `encoding.BinaryUnmarshaler` interface for the TxStatus type.

type TxStatuses

type TxStatuses []TxStatus

TxStatuses is a wrapper type for the TxStatus slice type.

func (TxStatuses) MarshalBinary

func (txStatuses TxStatuses) MarshalBinary() ([]byte, error)

MarshalBinary implements the `encoding.BinaryMarshaler` interface for the TxStatuses type.

func (*TxStatuses) UnmarshalBinary

func (txStatuses *TxStatuses) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the `encoding.BinaryUnmarshaler` interface for the TxStatuses type.

type Txs

type Txs []Tx

Txs is a wrapper type for the Tx slice type.

func (Txs) Equal

func (txs Txs) Equal(other Txs) bool

func (Txs) MarshalBinary

func (txs Txs) MarshalBinary() ([]byte, error)

MarshalBinary implements the `encoding.BinaryMarshaler` interface for the Txs type.

func (*Txs) UnmarshalBinary

func (txs *Txs) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the `encoding.BinaryUnmarshaler` interface for the Txs type.

type Type

type Type string

A Type is a constant string that uniquely identifies the type of a Value.

type U128

type U128 struct {
	Int *big.Int
}

U128 stores a big.Int representing a 128 bit unsigned integer.

func (U128) Equal

func (u128 U128) Equal(other Value) bool

Equal implements the Value interface for the U128 type.

func (U128) MarshalBinary

func (u128 U128) MarshalBinary() ([]byte, error)

MarshalBinary implements the `encoding.BinaryMarshaler` interface for the U128 type.

func (U128) MarshalJSON

func (u128 U128) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for the U128 type.

func (U128) Type

func (U128) Type() Type

Type implements the Value interface for the U128 type.

func (*U128) UnmarshalBinary

func (u128 *U128) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the `encoding.BinaryMarshaler` interface for the U128 type.

func (*U128) UnmarshalJSON

func (u128 *U128) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for the U128 type.

type U16

type U16 struct {
	Int *big.Int
}

U16 stores a big.Int representing a 16 bit unsigned integer.

func (U16) Equal

func (u16 U16) Equal(other Value) bool

Equal implements the Value interface for the U16 type.

func (U16) MarshalBinary

func (u16 U16) MarshalBinary() ([]byte, error)

MarshalBinary implements the `encoding.BinaryMarshaler` interface for the U16 type.

func (U16) MarshalJSON

func (u16 U16) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for the U16 type.

func (U16) Type

func (U16) Type() Type

Type implements the Value interface for the U16 type.

func (*U16) UnmarshalBinary

func (u16 *U16) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the `encoding.BinaryMarshaler` interface for the U16 type.

func (*U16) UnmarshalJSON

func (u16 *U16) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for the U16 type.

type U256

type U256 struct {
	Int *big.Int
}

U256 stores a big.Int representing a 256 bit unsigned integer.

func (U256) Equal

func (u256 U256) Equal(other Value) bool

Equal implements the Value interface for the U256 type.

func (U256) MarshalBinary

func (u256 U256) MarshalBinary() ([]byte, error)

MarshalBinary implements the `encoding.BinaryMarshaler` interface for the U256 type.

func (U256) MarshalJSON

func (u256 U256) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for the U256 type.

func (U256) Type

func (U256) Type() Type

Type implements the Value interface for the U256 type.

func (*U256) UnmarshalBinary

func (u256 *U256) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the `encoding.BinaryMarshaler` interface for the U256 type.

func (*U256) UnmarshalJSON

func (u256 *U256) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for the U256 type.

type U32

type U32 struct {
	Int *big.Int
}

U32 stores a big.Int representing a 32 bit unsigned integer.

func (U32) Equal

func (u32 U32) Equal(other Value) bool

Equal implements the Value interface for the U32 type.

func (U32) MarshalBinary

func (u32 U32) MarshalBinary() ([]byte, error)

MarshalBinary implements the `encoding.BinaryMarshaler` interface for the U32 type.

func (U32) MarshalJSON

func (u32 U32) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for the U32 type.

func (U32) Type

func (U32) Type() Type

Type implements the Value interface for the U32 type.

func (*U32) UnmarshalBinary

func (u32 *U32) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the `encoding.BinaryMarshaler` interface for the U32 type.

func (*U32) UnmarshalJSON

func (u32 *U32) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for the U32 type.

type U64

type U64 struct {
	Int *big.Int
}

U64 stores a big.Int representing a 64 bit unsigned integer.

func (U64) Equal

func (u64 U64) Equal(other Value) bool

Equal implements the Value interface for the U64 type.

func (U64) MarshalBinary

func (u64 U64) MarshalBinary() ([]byte, error)

MarshalBinary implements the `encoding.BinaryMarshaler` interface for the U64 type.

func (U64) MarshalJSON

func (u64 U64) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for the U64 type.

func (U64) Type

func (U64) Type() Type

Type implements the Value interface for the U64 type.

func (*U64) UnmarshalBinary

func (u64 *U64) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the `encoding.BinaryMarshaler` interface for the U64 type.

func (*U64) UnmarshalJSON

func (u64 *U64) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for the U64 type.

type U8

type U8 struct {
	Int *big.Int
}

U8 stores a big.Int representing a 8 bit unsigned integer.

func (U8) Equal

func (u8 U8) Equal(other Value) bool

Equal implements the Value interface for the U8 type.

func (U8) MarshalBinary

func (u8 U8) MarshalBinary() ([]byte, error)

MarshalBinary implements the `encoding.BinaryMarshaler` interface for the U8 type.

func (U8) MarshalJSON

func (u8 U8) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for the U8 type.

func (U8) Type

func (U8) Type() Type

Type implements the Value interface for the U8 type.

func (*U8) UnmarshalBinary

func (u8 *U8) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the `encoding.BinaryMarshaler` interface for the U8 type.

func (*U8) UnmarshalJSON

func (u8 *U8) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for the U8 type.

type Value

type Value interface {
	encoding.BinaryMarshaler
	Type() Type
	Equal(Value) bool
}

A Value is a concrete value associated with a Type.

Jump to

Keyboard shortcuts

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