chain

package
v0.1.0-testnet Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2022 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCurrencyTypeUnsupported = errors.New("currency type is not supported")
View Source
var ErrMissingKeyIndex = errors.New("phonon missing KeyIndex")
View Source
var ErrMissingPubKey = errors.New("phonon missing pubKey")
View Source
var ErrUnknownCurrencyType = errors.New("unknown currency type")

Functions

This section is empty.

Types

type ChainService

type ChainService interface {
	DeriveAddress(p *model.Phonon) (address string, err error)
	RedeemPhonon(p *model.Phonon, privKey *ecdsa.PrivateKey, redeemAddress string) (transactionData string, err error)
}

type EthChainInterface

type EthChainInterface interface {
	bind.ContractTransactor
	ethereum.ChainStateReader
}

Composite interface supporting all needed EVM RPC calls

type EthChainService

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

func NewEthChainService

func NewEthChainService() (*EthChainService, error)

func (*EthChainService) DeriveAddress

func (eth *EthChainService) DeriveAddress(p *model.Phonon) (address string, err error)

Derives an ETH address from a phonon's ECDSA Public Key

func (*EthChainService) RedeemPhonon

func (eth *EthChainService) RedeemPhonon(p *model.Phonon, privKey *ecdsa.PrivateKey, redeemAddress string) (transactionData string, err error)

func (*EthChainService) ValidateRedeemData

func (eth *EthChainService) ValidateRedeemData(p *model.Phonon, privKey *ecdsa.PrivateKey, redeemAddress string) (err error)

ReconcileRedeemData validates the input data to ensure it contains all that's needed for a successful redemption. It will update the phonon data structure with a derived address if necessary

type MultiChainRouter

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

MultiChainRouter is a ChainService supporting multiple currencyTypes by encapsulating a specific hardcoded collection of ChainServices keyed by CurrencyType

func NewMultiChainRouter

func NewMultiChainRouter() (*MultiChainRouter, error)

Initialize all supported chain services at start

func (*MultiChainRouter) DeriveAddress

func (mcr *MultiChainRouter) DeriveAddress(p *model.Phonon) (address string, err error)

ChainService interface methods

func (*MultiChainRouter) RedeemPhonon

func (mcr *MultiChainRouter) RedeemPhonon(p *model.Phonon, privKey *ecdsa.PrivateKey, redeemAddress string) (transactionData string, err error)

Jump to

Keyboard shortcuts

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