types

package
v0.0.0-...-5ade1b4 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2020 License: Apache-2.0 Imports: 13 Imported by: 15

Documentation

Index

Constants

View Source
const ERC20AddressLength = 20

ERC20AddressLength defines the length of the fixed-sized ERC20Address type explicitly.

View Source
const (
	// ERC20ConversionMinimumValue defines the minimum value of coins
	// you can convert to ERC20 funds using the ERC20ConvertTransaction
	ERC20ConversionMinimumValue = 1000
)
View Source
const ERC20HashLength = 32

ERC20HashLength defines the length of the fixed-sized ERC20 Hash type explicitly, used for Transaction and Block hashes alike.

View Source
const (
	// HardcodedERC20AddressRegistrationFeeOneCoinMultiplier defines the hardcoded multiplier
	// (to be multiplied with the OneCoin Currency Value of the network), that defines the constant (hardcoded)
	// Registration Fee to be paid for the Registration of an ERC20 Withdrawal address.
	HardcodedERC20AddressRegistrationFeeOneCoinMultiplier = 10
)

Variables

View Source
var (
	SpecifierERC20ConvertTransaction             = types.Specifier{'e', 'r', 'c', '2', '0', ' ', 'c', 'o', 'n', 'v', 'e', 'r', 't', ' ', 't', 'x'}
	SpecifierERC20CoinCreationTransaction        = types.Specifier{'e', 'r', 'c', '2', '0', ' ', 'c', 'o', 'i', 'n', 'g', 'e', 'n', ' ', 't', 'x'}
	SpecifierERC20AddressRegistrationTransaction = types.Specifier{'e', 'r', 'c', '2', '0', ' ', 'a', 'd', 'd', 'r', 'r', 'e', 'g', ' ', 't', 'x'}
)

These Specifiers are used internally when calculating a Transaction's ID. See Rivine's Specifier for more details.

View Source
var (
	ERC20AdddressRegistrationSignatureSpecifier = [...]byte{'r', 'e', 'g', 'i', 's', 't', 'r', 'a', 't', 'i', 'o', 'n'}
)

Specifiers used to ensure the bot-signatures are unique within each Tx.

Functions

func IsERC20Address

func IsERC20Address(str string) bool

IsERC20Address returns true if the given string represents an ERC20 Address.

func IsERC20Hash

func IsERC20Hash(str string) bool

IsERC20Hash returns true if the given string represents an ERC20 Hash.

Types

type ERC20Address

type ERC20Address [ERC20AddressLength]byte

ERC20Address defines an ERC20 address as a fixed-sized byte array of length 20, and is used in order to be able to convert TFT into tradeable tfchain ERC20 funds.

func ERC20AddressFromUnlockHash

func ERC20AddressFromUnlockHash(uh types.UnlockHash) (addr ERC20Address, err error)

ERC20AddressFromUnlockHash creates an ERC20Address using as input for a new blake2b hash an UnlockHash (TFT Address), and taking the last 20 bytes of that.

func (*ERC20Address) LoadString

func (address *ERC20Address) LoadString(str string) error

LoadString loads this ERC20Address from a hex-encoded string of length 40.

func (ERC20Address) MarshalJSON

func (address ERC20Address) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.MarshalJSON, and returns this ERC20Address as a hex-encoded JSON string.

func (ERC20Address) String

func (address ERC20Address) String() string

String returns this ERC20Address as a string.

func (*ERC20Address) UnmarshalJSON

func (address *ERC20Address) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.UnmarshalJSON, and decodes the given byte slice as a hex-encoded JSON string into the 20 bytes that make up this ERC20Address.

type ERC20AddressRegistrationTransaction

type ERC20AddressRegistrationTransaction struct {
	// The public key of which a TFT address can be derived, and thus also an ERC20 Address
	PublicKey types.PublicKey

	// Signature that proofs the ownership of the attached Public Key.
	Signature types.ByteSlice

	// RegistrationFee defines the Registration fee to be paid for the
	// registration on top of the regular Transaction fee.
	// TODO: integrate it into the parent block, for now it is ignored.
	RegistrationFee types.Currency

	// TransactionFee defines the regular Tx fee.
	TransactionFee types.Currency

	// CoinInputs are only used for the required fees,
	// which contains the regular Tx fee as well as the additional fees,
	// to be paid for the address registration. At least one CoinInput is required.
	CoinInputs []types.CoinInput
	// RefundCoinOutput is an optional coin output that can be used
	// to refund coins paid as inputs for the required fees.
	RefundCoinOutput *types.CoinOutput
}

ERC20AddressRegistrationTransaction defines the Transaction (with version 0xD2) used to register an ERC20 address linked to a regular TFT address (derived from the given public key). This is required as to be able to convert ERC20 Funds back into TFT.

func ERC20AddressRegistrationTransactionFromTransaction

func ERC20AddressRegistrationTransactionFromTransaction(tx types.Transaction, txVersion types.TransactionVersion) (ERC20AddressRegistrationTransaction, error)

ERC20AddressRegistrationTransactionFromTransaction creates an ERC20AddressRegistrationTransaction, using a regular in-memory tfchain transaction.

Past the (tx) Version validation it piggy-backs onto the `ERC20AddressRegistrationTransactionFromTransactionData` constructor.

func ERC20AddressRegistrationTransactionFromTransactionData

func ERC20AddressRegistrationTransactionFromTransactionData(txData types.TransactionData) (ERC20AddressRegistrationTransaction, error)

ERC20AddressRegistrationTransactionFromTransactionData creates an ERC20ConvertTransaction, using the TransactionData from a regular in-memory tfchain transaction.

func (ERC20AddressRegistrationTransaction) MarshalJSON

func (eartx ERC20AddressRegistrationTransaction) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.MarshalRivine

func (ERC20AddressRegistrationTransaction) MarshalRivine

func (eartx ERC20AddressRegistrationTransaction) MarshalRivine(w io.Writer) error

MarshalRivine implements RivineMarshaler.MarshalRivine

func (ERC20AddressRegistrationTransaction) MarshalSia

func (eartx ERC20AddressRegistrationTransaction) MarshalSia(w io.Writer) error

MarshalSia implements SiaMarshaler.MarshalSia, alias of MarshalRivine for backwards-compatibility reasons.

func (*ERC20AddressRegistrationTransaction) Transaction

Transaction returns this ERC20AddressRegistrationTransaction as regular tfchain transaction, using TransactionVersionERC20AddressRegistration as the type.

func (*ERC20AddressRegistrationTransaction) TransactionData

TransactionData returns this ERC20AddressRegistrationTransaction as regular tfchain transaction data.

func (*ERC20AddressRegistrationTransaction) UnmarshalJSON

func (eartx *ERC20AddressRegistrationTransaction) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.UnmarshalJSON

func (*ERC20AddressRegistrationTransaction) UnmarshalRivine

func (eartx *ERC20AddressRegistrationTransaction) UnmarshalRivine(r io.Reader) error

UnmarshalRivine implements RivineUnmarshaler.UnmarshalRivine

func (*ERC20AddressRegistrationTransaction) UnmarshalSia

func (eartx *ERC20AddressRegistrationTransaction) UnmarshalSia(r io.Reader) error

UnmarshalSia implements SiaUnmarshaler.UnmarshalSia, alias of UnmarshalRivine for backwards-compatibility reasons.

type ERC20AddressRegistrationTransactionController

type ERC20AddressRegistrationTransactionController struct {
	Registry             ERC20Registry
	OneCoin              types.Currency
	BridgeFeePoolAddress types.UnlockHash
	TransactionVersion   types.TransactionVersion
}

ERC20AddressRegistrationTransactionController defines a tfchain-specific transaction controller, for a transaction type reserved at type 0xD2. It allows the registration of an ERC20 Address.

func (ERC20AddressRegistrationTransactionController) DecodeTransactionData

DecodeTransactionData implements TransactionController.DecodeTransactionData

func (ERC20AddressRegistrationTransactionController) EncodeTransactionData

func (eartc ERC20AddressRegistrationTransactionController) EncodeTransactionData(w io.Writer, txData types.TransactionData) error

EncodeTransactionData implements TransactionController.EncodeTransactionData

func (ERC20AddressRegistrationTransactionController) EncodeTransactionIDInput

func (eartc ERC20AddressRegistrationTransactionController) EncodeTransactionIDInput(w io.Writer, txData types.TransactionData) error

EncodeTransactionIDInput implements TransactionIDEncoder.EncodeTransactionIDInput

func (ERC20AddressRegistrationTransactionController) GetCommonExtensionData

func (eartc ERC20AddressRegistrationTransactionController) GetCommonExtensionData(extension interface{}) (types.CommonTransactionExtensionData, error)

GetCommonExtensionData implements TransactionCommonExtensionDataGetter.GetCommonExtensionData

func (ERC20AddressRegistrationTransactionController) GetCustomMinerPayouts

func (eartc ERC20AddressRegistrationTransactionController) GetCustomMinerPayouts(extension interface{}) ([]types.MinerPayout, error)

GetCustomMinerPayouts implements TransactionCustomMinerPayoutGetter.GetCustomMinerPayouts

func (ERC20AddressRegistrationTransactionController) JSONDecodeTransactionData

func (eartc ERC20AddressRegistrationTransactionController) JSONDecodeTransactionData(data []byte) (types.TransactionData, error)

JSONDecodeTransactionData implements TransactionController.JSONDecodeTransactionData

func (ERC20AddressRegistrationTransactionController) JSONEncodeTransactionData

func (eartc ERC20AddressRegistrationTransactionController) JSONEncodeTransactionData(txData types.TransactionData) ([]byte, error)

JSONEncodeTransactionData implements TransactionController.JSONEncodeTransactionData

func (ERC20AddressRegistrationTransactionController) SignExtension

func (eartc ERC20AddressRegistrationTransactionController) SignExtension(extension interface{}, sign func(*types.UnlockFulfillmentProxy, types.UnlockConditionProxy, ...interface{}) error) (interface{}, error)

SignExtension implements TransactionExtensionSigner.SignExtension

func (ERC20AddressRegistrationTransactionController) SignatureHash

func (eartc ERC20AddressRegistrationTransactionController) SignatureHash(t types.Transaction, extraObjects ...interface{}) (crypto.Hash, error)

SignatureHash implements TransactionSignatureHasher.SignatureHash

type ERC20AddressRegistrationTransactionExtension

type ERC20AddressRegistrationTransactionExtension struct {
	RegistrationFee types.Currency
	PublicKey       types.PublicKey
	Signature       types.ByteSlice
}

ERC20AddressRegistrationTransactionExtension defines the ERC20AddressRegistrationTransaction Extension Data

type ERC20AddressRegistrationTransactionJSON

type ERC20AddressRegistrationTransactionJSON struct {
	// The public key of which a TFT address can be derived, and thus also an ERC20 Address
	PublicKey types.PublicKey `json:"pubkey"`

	// TFTAddresses can be derived from the PublicKey,
	// if defined however it will be validated that the public key matches the given PublicKey.
	// Can be omitted as well, given that the raw tx does not contain this duplicate data.
	TFTAddress types.UnlockHash `json:"tftaddress,omitempty"`
	// ERC20Address can be derived from the PublicKey,
	// if defined however it will be validated that the public key matches the given PublicKey.
	// Can be omitted as well, given that the raw tx does not contain this duplicate data.
	ERC20Address ERC20Address `json:"erc20address,omitempty"`

	// Signature that proofs the ownership of the attached Public Key.
	Signature types.ByteSlice `json:"signature"`

	// RegistrationFee defines the Registration fee to be paid for the
	// registration on top of the regular Transaction fee.
	RegistrationFee types.Currency `json:"regfee"`

	// TransactionFee defines the regular Tx fee.
	TransactionFee types.Currency `json:"txfee"`

	// CoinInputs are only used for the required fees,
	// which contains the regular Tx fee as well as the additional fees,
	// to be paid for the address registration. At least one CoinInput is required.
	CoinInputs []types.CoinInput `json:"coininputs"`
	// RefundCoinOutput is an optional coin output that can be used
	// to refund coins paid as inputs for the required fees.
	RefundCoinOutput *types.CoinOutput `json:"refundcoinoutput,omitempty"`
}

ERC20AddressRegistrationTransactionJSON defines the JSON structure of an ERC20AddressRegistrationTransaction, which is an extended data structure when compared to the binary structure of an ERC20AddressRegistrationTransaction

type ERC20BalanceInfo

type ERC20BalanceInfo struct {
	Balance *big.Int       `json:"balance"`
	Address common.Address `json:"address"`
}

ERC20BalanceInfo provides a definition for the ethereum bridge address balance

type ERC20CoinCreationTransaction

type ERC20CoinCreationTransaction struct {
	// The address to send the TFT-converted tfchain ERC20 funds into.
	Address types.UnlockHash `json:"address"`

	// Amount of TFT to be paid towards buying ERC20 funds,
	// note that the bridge will take part of this amount towards
	// paying for the transaction costs, prior to sending the ERC20 funds to
	// the defined target address.
	Value types.Currency `json:"value"`

	// TransactionFee defines the regular Tx fee.
	TransactionFee types.Currency `json:"txfee"`

	// ERC20 BlockID (Sending ERC20 Funds to TFT) used as to identify
	// the parent block of the source of this coin creation.
	BlockID ERC20Hash `json:"blockid"`

	// ERC20 TransactionID (Sending ERC20 Funds to TFT) used as the source of this coin creation.
	TransactionID ERC20Hash `json:"txid"`
}

ERC20CoinCreationTransaction defines the Transaction (with version 0xD1) used to convert ERC20 funds into TFT (the reverse of the ERC20ConvertTransaction).

func ERC20CoinCreationTransactionFromTransaction

func ERC20CoinCreationTransactionFromTransaction(tx types.Transaction, txVersion types.TransactionVersion) (ERC20CoinCreationTransaction, error)

ERC20CoinCreationTransactionFromTransaction creates an ERC20CoinCreationTransaction, using a regular in-memory tfchain transaction.

Past the (tx) Version validation it piggy-backs onto the `ERC20CoinCreationTransactionFromTransactionData` constructor.

func ERC20CoinCreationTransactionFromTransactionData

func ERC20CoinCreationTransactionFromTransactionData(txData types.TransactionData) (ERC20CoinCreationTransaction, error)

ERC20CoinCreationTransactionFromTransactionData creates an ERC20CoinCreationTransaction, using the TransactionData from a regular in-memory tfchain transaction.

func (ERC20CoinCreationTransaction) MarshalRivine

func (etctx ERC20CoinCreationTransaction) MarshalRivine(w io.Writer) error

MarshalRivine implements RivineMarshaler.MarshalRivine

func (ERC20CoinCreationTransaction) MarshalSia

func (etctx ERC20CoinCreationTransaction) MarshalSia(w io.Writer) error

MarshalSia implements SiaMarshaler.MarshalSia, alias of MarshalRivine for backwards-compatibility reasons.

func (*ERC20CoinCreationTransaction) Transaction

Transaction returns this ERC20CoinCreationTransaction as regular tfchain transaction, using TransactionVersionERC20CoinCreation as the type.

func (*ERC20CoinCreationTransaction) TransactionData

func (etctx *ERC20CoinCreationTransaction) TransactionData() types.TransactionData

TransactionData returns this ERC20CoinCreationTransaction as regular tfchain transaction data.

func (*ERC20CoinCreationTransaction) UnmarshalRivine

func (etctx *ERC20CoinCreationTransaction) UnmarshalRivine(r io.Reader) error

UnmarshalRivine implements RivineUnmarshaler.UnmarshalRivine

func (*ERC20CoinCreationTransaction) UnmarshalSia

func (etctx *ERC20CoinCreationTransaction) UnmarshalSia(r io.Reader) error

UnmarshalSia implements SiaUnmarshaler.UnmarshalSia, alias of UnmarshalRivine for backwards-compatibility reasons.

type ERC20CoinCreationTransactionController

type ERC20CoinCreationTransactionController struct {
	Registry           ERC20Registry
	OneCoin            types.Currency
	TransactionVersion types.TransactionVersion
}

ERC20CoinCreationTransactionController defines a tfchain-specific transaction controller, for a transaction type reserved at type 0xD1. It allows the conversion of ERC20-funds to TFT.

func (ERC20CoinCreationTransactionController) DecodeTransactionData

func (etctc ERC20CoinCreationTransactionController) DecodeTransactionData(r io.Reader) (types.TransactionData, error)

DecodeTransactionData implements TransactionController.DecodeTransactionData

func (ERC20CoinCreationTransactionController) EncodeTransactionData

func (etctc ERC20CoinCreationTransactionController) EncodeTransactionData(w io.Writer, txData types.TransactionData) error

EncodeTransactionData implements TransactionController.EncodeTransactionData

func (ERC20CoinCreationTransactionController) EncodeTransactionIDInput

func (etctc ERC20CoinCreationTransactionController) EncodeTransactionIDInput(w io.Writer, txData types.TransactionData) error

EncodeTransactionIDInput implements TransactionIDEncoder.EncodeTransactionIDInput

func (ERC20CoinCreationTransactionController) JSONDecodeTransactionData

func (etctc ERC20CoinCreationTransactionController) JSONDecodeTransactionData(data []byte) (types.TransactionData, error)

JSONDecodeTransactionData implements TransactionController.JSONDecodeTransactionData

func (ERC20CoinCreationTransactionController) JSONEncodeTransactionData

func (etctc ERC20CoinCreationTransactionController) JSONEncodeTransactionData(txData types.TransactionData) ([]byte, error)

JSONEncodeTransactionData implements TransactionController.JSONEncodeTransactionData

func (ERC20CoinCreationTransactionController) SignatureHash

func (etctc ERC20CoinCreationTransactionController) SignatureHash(t types.Transaction, extraObjects ...interface{}) (crypto.Hash, error)

SignatureHash implements TransactionSignatureHasher.SignatureHash

type ERC20CoinCreationTransactionExtension

type ERC20CoinCreationTransactionExtension struct {
	BlockID       ERC20Hash
	TransactionID ERC20Hash
}

ERC20CoinCreationTransactionExtension defines the ERC20CoinCreationTransaction Extension Data

type ERC20ConvertTransaction

type ERC20ConvertTransaction struct {
	// The address to send the TFT-converted tfchain ERC20 funds into.
	Address ERC20Address `json:"address"`

	// Amount of TFT to be paid towards buying ERC20 funds,
	// note that the bridge will take part of this amount towards
	// paying for the transaction costs, prior to sending the ERC20 funds to
	// the defined target address.
	Value types.Currency `json:"value"`

	// TransactionFee defines the regular Tx fee.
	TransactionFee types.Currency `json:"txfee"`

	// CoinInputs are only used for the required fees,
	// which contains the regular Tx fee as well as the additional fees,
	// to be paid for the address registration. At least one CoinInput is required.
	CoinInputs []types.CoinInput `json:"coininputs"`
	// RefundCoinOutput is an optional coin output that can be used
	// to refund coins paid as inputs for the required fees.
	RefundCoinOutput *types.CoinOutput `json:"refundcoinoutput,omitempty"`
}

ERC20ConvertTransaction defines the Transaction (with version 0xD1) used to convert TFT into ERC20 funds paid to the defined ERC20 address.

func ERC20ConvertTransactionFromTransaction

func ERC20ConvertTransactionFromTransaction(tx types.Transaction, txVersion types.TransactionVersion) (ERC20ConvertTransaction, error)

ERC20ConvertTransactionFromTransaction creates an ERC20ConvertTransaction, using a regular in-memory tfchain transaction.

Past the (tx) Version validation it piggy-backs onto the `ERC20ConvertTransactionFromTransactionData` constructor.

func ERC20ConvertTransactionFromTransactionData

func ERC20ConvertTransactionFromTransactionData(txData types.TransactionData) (ERC20ConvertTransaction, error)

ERC20ConvertTransactionFromTransactionData creates an ERC20ConvertTransaction, using the TransactionData from a regular in-memory tfchain transaction.

func (ERC20ConvertTransaction) MarshalRivine

func (etctx ERC20ConvertTransaction) MarshalRivine(w io.Writer) error

MarshalRivine implements RivineMarshaler.MarshalRivine

func (ERC20ConvertTransaction) MarshalSia

func (etctx ERC20ConvertTransaction) MarshalSia(w io.Writer) error

MarshalSia implements SiaMarshaler.MarshalSia, alias of MarshalRivine for backwards-compatibility reasons.

func (*ERC20ConvertTransaction) Transaction

func (etctx *ERC20ConvertTransaction) Transaction(txVersion types.TransactionVersion) types.Transaction

Transaction returns this ERC20ConvertTransaction as regular tfchain transaction, using TransactionVersionBotNameTransfer as the type.

func (*ERC20ConvertTransaction) TransactionData

func (etctx *ERC20ConvertTransaction) TransactionData() types.TransactionData

TransactionData returns this ERC20ConvertTransaction as regular tfchain transaction data.

func (*ERC20ConvertTransaction) UnmarshalRivine

func (etctx *ERC20ConvertTransaction) UnmarshalRivine(r io.Reader) error

UnmarshalRivine implements RivineUnmarshaler.UnmarshalRivine

func (*ERC20ConvertTransaction) UnmarshalSia

func (etctx *ERC20ConvertTransaction) UnmarshalSia(r io.Reader) error

UnmarshalSia implements SiaUnmarshaler.UnmarshalSia, alias of UnmarshalRivine for backwards-compatibility reasons.

type ERC20ConvertTransactionController

type ERC20ConvertTransactionController struct {
	TransactionVersion types.TransactionVersion
}

ERC20ConvertTransactionController defines a tfchain-specific transaction controller, for a transaction type reserved at type 0xD0. It allows the conversion of TFT to ERC20-funds.

func (ERC20ConvertTransactionController) DecodeTransactionData

func (etctc ERC20ConvertTransactionController) DecodeTransactionData(r io.Reader) (types.TransactionData, error)

DecodeTransactionData implements TransactionController.DecodeTransactionData

func (ERC20ConvertTransactionController) EncodeTransactionData

func (etctc ERC20ConvertTransactionController) EncodeTransactionData(w io.Writer, txData types.TransactionData) error

EncodeTransactionData implements TransactionController.EncodeTransactionData

func (ERC20ConvertTransactionController) EncodeTransactionIDInput

func (etctc ERC20ConvertTransactionController) EncodeTransactionIDInput(w io.Writer, txData types.TransactionData) error

EncodeTransactionIDInput implements TransactionIDEncoder.EncodeTransactionIDInput

func (ERC20ConvertTransactionController) JSONDecodeTransactionData

func (etctc ERC20ConvertTransactionController) JSONDecodeTransactionData(data []byte) (types.TransactionData, error)

JSONDecodeTransactionData implements TransactionController.JSONDecodeTransactionData

func (ERC20ConvertTransactionController) JSONEncodeTransactionData

func (etctc ERC20ConvertTransactionController) JSONEncodeTransactionData(txData types.TransactionData) ([]byte, error)

JSONEncodeTransactionData implements TransactionController.JSONEncodeTransactionData

func (ERC20ConvertTransactionController) SignatureHash

func (etctc ERC20ConvertTransactionController) SignatureHash(t types.Transaction, extraObjects ...interface{}) (crypto.Hash, error)

SignatureHash implements TransactionSignatureHasher.SignatureHash

type ERC20ConvertTransactionExtension

type ERC20ConvertTransactionExtension struct {
	// The address to send the TFT-converted tfchain ERC20 funds into.
	Address ERC20Address
	// Amount of TFT to be paid towards buying ERC20 funds.
	Value types.Currency
}

ERC20ConvertTransactionExtension defines the ERC20ConvertTransaction Extension Data

type ERC20Hash

type ERC20Hash [ERC20HashLength]byte

ERC20Hash defines an ERC20 Hash as a fixed-sized byte array of length 32.

func (*ERC20Hash) LoadString

func (eh *ERC20Hash) LoadString(str string) error

LoadString loads this TransactionID from a hex-encoded string of length 64.

func (ERC20Hash) MarshalJSON

func (eh ERC20Hash) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.MarshalJSON, and returns this Hash as a hex-encoded JSON string.

func (ERC20Hash) String

func (eh ERC20Hash) String() string

String returns this TransactionID as a string.

func (*ERC20Hash) UnmarshalJSON

func (eh *ERC20Hash) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.UnmarshalJSON, and decodes the given byte slice as a hex-encoded JSON string into the 32 bytes that make up this Hash.

type ERC20InfoAPI

type ERC20InfoAPI interface {
	GetStatus() (*ERC20SyncStatus, error)
	GetBalanceInfo() (*ERC20BalanceInfo, error)
}

ERC20InfoAPI is the API used by the bridge contract

type ERC20Registry

type ERC20Registry interface {
	GetERC20AddressForTFTAddress(types.UnlockHash) (ERC20Address, bool, error)
	GetTFTAddressForERC20Address(ERC20Address) (types.UnlockHash, bool, error)
	GetTFTTransactionIDForERC20TransactionID(ERC20Hash) (types.TransactionID, bool, error)
}

ERC20Registry defines the public READ API expected from an ERC20 Read-Only registry.

type ERC20SyncStatus

type ERC20SyncStatus struct {
	StartingBlock uint64 `json:"startingblock"`
	CurrentBlock  uint64 `json:"currentblock"`
	HighestBlock  uint64 `json:"highestblock"`
}

ERC20SyncStatus provides a definition for the current status of the ehtereum network sync.

type ERC20TransactionValidator

type ERC20TransactionValidator interface {
	ValidateWithdrawTx(blockID, txID ERC20Hash, expectedAddress ERC20Address, expecedAmount types.Currency) error
	ERC20InfoAPI
	Wait(ctx context.Context) error
}

ERC20TransactionValidator is the validation API used by the ERC20 CoinCreation Tx Controller, in order to validate the attached ERC20 Tx. Use the NopERC20TransactionValidator if no such validation is required.

type NopERC20TransactionValidator

type NopERC20TransactionValidator struct{}

NopERC20TransactionValidator provides a NOP-implementation of the ERC20TransactionValidator interface, allowing you to disable any extra validation on ERC20 Transactions.

func (NopERC20TransactionValidator) GetBalanceInfo

func (nop NopERC20TransactionValidator) GetBalanceInfo() (*ERC20BalanceInfo, error)

GetBalanceInfo implements ERC20TransactionValidator.GetBalanceInfo returning nil status for every call.

func (NopERC20TransactionValidator) GetStatus

GetStatus implements ERC20TransactionValidator.GetStatus returning nil status for every call.

func (NopERC20TransactionValidator) ValidateWithdrawTx

ValidateWithdrawTx implements ERC20TransactionValidator.ValidateWithdrawTx, returning nil for every call.

func (NopERC20TransactionValidator) Wait

Wait implements ERC20TransactionValidator.Wait returning nil status for every call.

type TransactionVersions

type TransactionVersions struct {
	ERC20Conversion          types.TransactionVersion
	ERC20AddressRegistration types.TransactionVersion
	ERC20CoinCreation        types.TransactionVersion
}

TransactionVersions is a config struct that allows one to configure all ERC20 extension transaction versions.

Jump to

Keyboard shortcuts

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