client

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2021 License: LGPL-3.0 Imports: 19 Imported by: 6

Documentation

Index

Constants

View Source
const DefaultBackoff = time.Second * 3

DefaultBackoff is the default backoff for the client

Variables

View Source
var ErrUnknownChain = errors.New("unknown chain")

Functions

func ToBytes32 added in v0.2.0

func ToBytes32(arr []byte) (res [32]byte)

Types

type AddressableEthClientGetter added in v1.0.0

type AddressableEthClientGetter interface {
	EthClientGetter
	// Address returns an address which was used to create a particular client
	Address() string
}

AddressableEthClientGetter wraps any eth client and is able to return the address used to create the client and the client itself.

func NewDefaultAddressableEthClientGetter added in v1.0.0

func NewDefaultAddressableEthClientGetter(address string, cl EtherClient) AddressableEthClientGetter

type BC added in v0.2.0

type BC interface {
	CalculateHermesFee(hermesAddress common.Address, value *big.Int) (*big.Int, error)
	IsHermesActive(hermesID common.Address) (bool, error)
	IsHermesRegistered(registryAddress, acccountantID common.Address) (bool, error)

	GetHermesFee(hermesAddress common.Address) (uint16, error)
	GetHermessAvailableBalance(hermesAddress common.Address) (*big.Int, error)
	GetHermesURL(registryID, hermesID common.Address) (string, error)
	GetHermes(registryID, hermesID common.Address) (Hermes, error)
	GetHermesOperator(hermesID common.Address) (common.Address, error)
	GetProviderChannel(hermesAddress common.Address, addressToCheck common.Address, pending bool) (ProviderChannel, error)
	GetMystBalance(mystSCAddress, address common.Address) (*big.Int, error)
	GetConsumerChannelsHermes(channelAddress common.Address) (ConsumersHermes, error)
	GetConsumerChannelOperator(channelAddress common.Address) (common.Address, error)
	GetProviderChannelByID(acc common.Address, chID []byte) (ProviderChannel, error)
	GetConsumerChannel(addr common.Address, mystSCAddress common.Address) (ConsumerChannel, error)
	GetEthBalance(address common.Address) (*big.Int, error)
	GetStakeThresholds(hermesID common.Address) (min, max *big.Int, err error)
	GetBeneficiary(registryAddress, identity common.Address) (common.Address, error)
	GetLastRegistryNonce(registry common.Address) (*big.Int, error)
	GetChannelImplementationByVersion(registryID common.Address, version *big.Int) (common.Address, error)
	GetProvidersWithdrawalChannel(hermesAddress common.Address, addressToCheck common.Address, pending bool) (ProviderChannel, error)
	SubscribeToWithdrawalPromiseSettledEvent(providerID, hermesID common.Address) (sink chan *bindings.HermesImplementationPromiseSettled, cancel func(), err error)

	IsRegisteredAsProvider(hermesAddress, registryAddress, addressToCheck common.Address) (bool, error)
	IsRegistered(registryAddress, addressToCheck common.Address) (bool, error)
	RegisterIdentity(rr RegistrationRequest) (*types.Transaction, error)
	IncreaseProviderStake(req ProviderStakeIncreaseRequest) (*types.Transaction, error)

	SettleAndRebalance(req SettleAndRebalanceRequest) (*types.Transaction, error)
	SettleWithBeneficiary(req SettleWithBeneficiaryRequest) (*types.Transaction, error)
	SettlePromise(req SettleRequest) (*types.Transaction, error)
	DecreaseProviderStake(req DecreaseProviderStakeRequest) (*types.Transaction, error)
	SettleIntoStake(req SettleIntoStakeRequest) (*types.Transaction, error)

	SubscribeToPromiseSettledEvent(providerID, hermesID common.Address) (sink chan *bindings.HermesImplementationPromiseSettled, cancel func(), err error)
	SubscribeToConsumerBalanceEvent(channel, mystSCAddress common.Address, timeout time.Duration) (chan *bindings.MystTokenTransfer, func(), error)
	SubscribeToIdentityRegistrationEvents(registryAddress common.Address) (sink chan *bindings.RegistryRegisteredIdentity, cancel func(), err error)
	SubscribeToConsumerChannelBalanceUpdate(mystSCAddress common.Address, channelAddresses []common.Address) (sink chan *bindings.MystTokenTransfer, cancel func(), err error)
	SubscribeToPromiseSettledEventByChannelID(hermesID common.Address, providerAddresses [][32]byte) (sink chan *bindings.HermesImplementationPromiseSettled, cancel func(), err error)
	SubscribeToMystTokenTransfers(mystSCAddress common.Address) (chan *bindings.MystTokenTransfer, func(), error)
	FilterLogs(q ethereum.FilterQuery) ([]types.Log, error)

	NetworkID() (*big.Int, error)
	SuggestGasPrice() (*big.Int, error)
	HeaderByNumber(number *big.Int) (*types.Header, error)

	TransferMyst(req TransferRequest) (tx *types.Transaction, err error)
	TransferEth(etr EthTransferRequest) (*types.Transaction, error)

	SendTransaction(tx *types.Transaction) error
	TransactionReceipt(hash common.Hash) (*types.Receipt, error)
	TransactionByHash(hash common.Hash) (*types.Transaction, bool, error)

	RewarderTotalPayoutsFor(rewarderAddress common.Address, payoutsFor common.Address) (*big.Int, error)
	RewarderAirDrop(req RewarderAirDrop) (*types.Transaction, error)
	RewarderUpdateRoot(req RewarderUpdateRoot) (*types.Transaction, error)
	RewarderTotalClaimed(rewarderAddress common.Address) (*big.Int, error)
	CustodyTransferTokens(req CustodyTokensTransfer) (*types.Transaction, error)

	PayAndSettle(psr PayAndSettleRequest) (*types.Transaction, error)
	IsChannelOpened(registryID, identity, hermesID common.Address) (bool, error)
	FilterPromiseSettledEventByChannelID(from uint64, to *uint64, hermesID common.Address, providerAddresses [][32]byte) ([]bindings.HermesImplementationPromiseSettled, error)
}

type Blockchain

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

Blockchain contains all the useful blockchain utilities for the payment off chain messaging

func NewBlockchain

func NewBlockchain(ethClient EthClientGetter, timeout time.Duration) *Blockchain

NewBlockchain returns a new instance of blockchain

func NewBlockchainWithCustomNonceTracker

func NewBlockchainWithCustomNonceTracker(ethClient EthClientGetter, timeout time.Duration, nonceFunc nonceFunc) *Blockchain

NewBlockchainWithCustomNonceTracker returns a new instance of blockchain with the provided nonce tracking func

func (*Blockchain) CalculateHermesFee added in v0.2.0

func (bc *Blockchain) CalculateHermesFee(hermesAddress common.Address, value *big.Int) (*big.Int, error)

CalculateHermesFee calls blockchain for calculation of hermes fee

func (*Blockchain) CustodyTransferTokens added in v1.0.0

func (bc *Blockchain) CustodyTransferTokens(req CustodyTokensTransfer) (*types.Transaction, error)

func (*Blockchain) DecreaseProviderStake added in v0.2.0

func (bc *Blockchain) DecreaseProviderStake(req DecreaseProviderStakeRequest) (*types.Transaction, error)

DecreaseProviderStake decreases provider stake.

func (*Blockchain) FilterLogs added in v0.2.0

func (bc *Blockchain) FilterLogs(q ethereum.FilterQuery) ([]types.Log, error)

FilterLogs executes a filter query.

func (*Blockchain) FilterPromiseSettledEventByChannelID added in v1.0.0

func (bc *Blockchain) FilterPromiseSettledEventByChannelID(from uint64, to *uint64, hermesID common.Address, providerAddresses [][32]byte) ([]bindings.HermesImplementationPromiseSettled, error)

FilterPromiseSettledEventByChannelID filters promise settled events

func (*Blockchain) GetBeneficiary added in v0.2.0

func (bc *Blockchain) GetBeneficiary(registryAddress, identity common.Address) (common.Address, error)

func (*Blockchain) GetChannelImplementationByVersion added in v0.2.0

func (bc *Blockchain) GetChannelImplementationByVersion(registryID common.Address, version *big.Int) (common.Address, error)

GetChannelImplementationByVersion returns the channel implementation for the specified version.

func (*Blockchain) GetConsumerChannel

func (bc *Blockchain) GetConsumerChannel(addr common.Address, mystSCAddress common.Address) (ConsumerChannel, error)

GetConsumerChannel returns the consumer channel

func (*Blockchain) GetConsumerChannelOperator

func (bc *Blockchain) GetConsumerChannelOperator(channelAddress common.Address) (common.Address, error)

GetConsumerChannelOperator returns the consumer channel operator/identity

func (*Blockchain) GetConsumerChannelsHermes added in v0.2.0

func (bc *Blockchain) GetConsumerChannelsHermes(channelAddress common.Address) (ConsumersHermes, error)

GetConsumerChannelsHermes returns the consumer channels hermes

func (*Blockchain) GetEthBalance added in v0.2.0

func (bc *Blockchain) GetEthBalance(address common.Address) (*big.Int, error)

GetEthBalance gets the current ethereum balance for the address.

func (*Blockchain) GetHermes added in v0.2.0

func (bc *Blockchain) GetHermes(registryID, hermesID common.Address) (Hermes, error)

GetHermes returns hermes info from registry

func (*Blockchain) GetHermesFee added in v0.2.0

func (bc *Blockchain) GetHermesFee(hermesAddress common.Address) (uint16, error)

GetHermesFee fetches the hermes fee from blockchain

func (*Blockchain) GetHermesOperator added in v0.2.0

func (bc *Blockchain) GetHermesOperator(hermesID common.Address) (common.Address, error)

GetHermesOperator returns operator address of given hermes

func (*Blockchain) GetHermesURL added in v0.2.0

func (bc *Blockchain) GetHermesURL(registryID, hermesID common.Address) (string, error)

GetHermesURL gets the hermes url from BC.

func (*Blockchain) GetHermessAvailableBalance added in v0.2.0

func (bc *Blockchain) GetHermessAvailableBalance(hermesAddress common.Address) (*big.Int, error)

GetHermessAvailableBalance returns the balance that is available for hermes.

func (*Blockchain) GetLastRegistryNonce added in v0.2.0

func (bc *Blockchain) GetLastRegistryNonce(registry common.Address) (*big.Int, error)

GetLastRegistryNonce returns the last registry nonce.

func (*Blockchain) GetMystBalance

func (bc *Blockchain) GetMystBalance(mystAddress, identity common.Address) (*big.Int, error)

GetMystBalance returns myst balance

func (*Blockchain) GetProviderChannel

func (bc *Blockchain) GetProviderChannel(hermesAddress common.Address, addressToCheck common.Address, pending bool) (ProviderChannel, error)

GetProviderChannel returns the provider channel

func (*Blockchain) GetProviderChannelByID

func (bc *Blockchain) GetProviderChannelByID(acc common.Address, chID []byte) (ProviderChannel, error)

GetProviderChannelByID returns the given provider channel information

func (*Blockchain) GetProvidersWithdrawalChannel added in v1.0.0

func (bc *Blockchain) GetProvidersWithdrawalChannel(hermesAddress common.Address, addressToCheck common.Address, pending bool) (ProviderChannel, error)

GetProviderChannel returns the provider channel

func (*Blockchain) GetStakeThresholds added in v0.2.0

func (bc *Blockchain) GetStakeThresholds(hermesID common.Address) (min, max *big.Int, err error)

GetStakeThresholds returns the stake tresholds for the given hermes.

func (*Blockchain) HeaderByNumber added in v0.2.0

func (bc *Blockchain) HeaderByNumber(number *big.Int) (*types.Header, error)

HeaderByNumber returns a block header from the current canonical chain. If number is nil, the latest known header is returned.

func (*Blockchain) IncreaseProviderStake added in v0.2.0

func (bc *Blockchain) IncreaseProviderStake(req ProviderStakeIncreaseRequest) (*types.Transaction, error)

IncreaseProviderStake increases the provider stake.

func (*Blockchain) IsChannelOpened added in v0.2.0

func (bc *Blockchain) IsChannelOpened(registryID, identity, hermesID common.Address) (bool, error)

func (*Blockchain) IsHermesActive added in v0.2.0

func (bc *Blockchain) IsHermesActive(hermesID common.Address) (bool, error)

IsHermesActive determines if hermes is active or not.

func (*Blockchain) IsHermesRegistered added in v0.2.0

func (bc *Blockchain) IsHermesRegistered(registryAddress, acccountantID common.Address) (bool, error)

IsHermesRegistered checks if given hermes is registered and returns true or false.

func (*Blockchain) IsRegistered

func (bc *Blockchain) IsRegistered(registryAddress, addressToCheck common.Address) (bool, error)

IsRegistered checks wether the given identity is registered or not

func (*Blockchain) IsRegisteredAsProvider

func (bc *Blockchain) IsRegisteredAsProvider(hermesAddress, registryAddress, addressToCheck common.Address) (bool, error)

IsRegisteredAsProvider checks if the provider is registered with the hermes properly

func (*Blockchain) NetworkID

func (bc *Blockchain) NetworkID() (*big.Int, error)

NetworkID returns the network id

func (*Blockchain) PayAndSettle added in v0.2.0

func (bc *Blockchain) PayAndSettle(psr PayAndSettleRequest) (*types.Transaction, error)

PayAndSettle registers the given identity on blockchain.

func (*Blockchain) RegisterIdentity

func (bc *Blockchain) RegisterIdentity(rr RegistrationRequest) (*types.Transaction, error)

RegisterIdentity registers the given identity on blockchain

func (*Blockchain) RewarderAirDrop added in v0.2.0

func (bc *Blockchain) RewarderAirDrop(req RewarderAirDrop) (*types.Transaction, error)

func (*Blockchain) RewarderTotalClaimed added in v0.2.0

func (bc *Blockchain) RewarderTotalClaimed(rewarderAddress common.Address) (*big.Int, error)

RewarderTotalClaimed is a free lookup in the blockchain for the total amount of claimed tokens in the blockchain.

func (*Blockchain) RewarderTotalPayoutsFor added in v0.2.0

func (bc *Blockchain) RewarderTotalPayoutsFor(rewarderAddress common.Address, payoutsFor common.Address) (*big.Int, error)

func (*Blockchain) RewarderUpdateRoot added in v0.2.0

func (bc *Blockchain) RewarderUpdateRoot(req RewarderUpdateRoot) (*types.Transaction, error)

func (*Blockchain) SendTransaction added in v0.2.0

func (bc *Blockchain) SendTransaction(tx *types.Transaction) error

SendTransaction sends a transaction to the blockchain.

func (*Blockchain) SettleAndRebalance

func (bc *Blockchain) SettleAndRebalance(req SettleAndRebalanceRequest) (*types.Transaction, error)

SettleAndRebalance is settling given hermes issued promise

func (*Blockchain) SettleIntoStake added in v0.2.0

func (bc *Blockchain) SettleIntoStake(req SettleIntoStakeRequest) (*types.Transaction, error)

SettleIntoStake settles the hermes promise into stake increase.

func (*Blockchain) SettlePromise

func (bc *Blockchain) SettlePromise(req SettleRequest) (*types.Transaction, error)

SettlePromise is settling the given consumer issued promise

func (*Blockchain) SettleWithBeneficiary added in v0.0.13

func (bc *Blockchain) SettleWithBeneficiary(req SettleWithBeneficiaryRequest) (*types.Transaction, error)

SettleWithBeneficiary sets new beneficiary for the provided identity and settles lastest promise into new beneficiary address.

func (*Blockchain) SubscribeToConsumerBalanceEvent

func (bc *Blockchain) SubscribeToConsumerBalanceEvent(channel, mystSCAddress common.Address, timeout time.Duration) (chan *bindings.MystTokenTransfer, func(), error)

SubscribeToConsumerBalanceEvent subscribes to balance change events in blockchain

func (*Blockchain) SubscribeToConsumerChannelBalanceUpdate

func (bc *Blockchain) SubscribeToConsumerChannelBalanceUpdate(mystSCAddress common.Address, channelAddresses []common.Address) (sink chan *bindings.MystTokenTransfer, cancel func(), err error)

SubscribeToConsumerChannelBalanceUpdate subscribes to consumer channel balance update events

func (*Blockchain) SubscribeToIdentityRegistrationEvents

func (bc *Blockchain) SubscribeToIdentityRegistrationEvents(registryAddress common.Address) (sink chan *bindings.RegistryRegisteredIdentity, cancel func(), err error)

SubscribeToIdentityRegistrationEvents subscribes to identity registration events

func (*Blockchain) SubscribeToMystTokenTransfers

func (bc *Blockchain) SubscribeToMystTokenTransfers(mystSCAddress common.Address) (chan *bindings.MystTokenTransfer, func(), error)

SubscribeToMystTokenTransfers subscribes to myst token transfers

func (*Blockchain) SubscribeToPromiseSettledEvent

func (bc *Blockchain) SubscribeToPromiseSettledEvent(providerID, hermesID common.Address) (sink chan *bindings.HermesImplementationPromiseSettled, cancel func(), err error)

SubscribeToPromiseSettledEvent subscribes to promise settled events

func (*Blockchain) SubscribeToPromiseSettledEventByChannelID

func (bc *Blockchain) SubscribeToPromiseSettledEventByChannelID(hermesID common.Address, providerAddresses [][32]byte) (sink chan *bindings.HermesImplementationPromiseSettled, cancel func(), err error)

SubscribeToPromiseSettledEventByChannelID subscribes to promise settled events

func (*Blockchain) SubscribeToWithdrawalPromiseSettledEvent added in v1.0.0

func (bc *Blockchain) SubscribeToWithdrawalPromiseSettledEvent(providerID, hermesID common.Address) (sink chan *bindings.HermesImplementationPromiseSettled, cancel func(), err error)

SubscribeToWithdrawalPromiseSettledEvent subscribes to withdrawal promise settled events

func (*Blockchain) SuggestGasPrice added in v0.2.0

func (bc *Blockchain) SuggestGasPrice() (*big.Int, error)

func (*Blockchain) TransactionByHash added in v0.2.0

func (bc *Blockchain) TransactionByHash(hash common.Hash) (*types.Transaction, bool, error)

func (*Blockchain) TransactionReceipt added in v0.2.0

func (bc *Blockchain) TransactionReceipt(hash common.Hash) (*types.Receipt, error)

func (*Blockchain) TransferEth added in v0.2.0

func (bc *Blockchain) TransferEth(etr EthTransferRequest) (*types.Transaction, error)

TransferEth transfers ethereum to the given address.

func (*Blockchain) TransferMyst

func (bc *Blockchain) TransferMyst(req TransferRequest) (tx *types.Transaction, err error)

TransferMyst transfers myst

type ConsumerChannel

type ConsumerChannel struct {
	Settled *big.Int
	Balance *big.Int
}

ConsumerChannel represents the consumer channel

type ConsumersHermes added in v0.2.0

type ConsumersHermes struct {
	Operator        common.Address
	ContractAddress common.Address
	Settled         *big.Int
}

ConsumersHermes represents the consumers hermes

type CustodyTokensTransfer added in v1.0.0

type CustodyTokensTransfer struct {
	WriteRequest
	CustodyAddress common.Address
	Recipients     []common.Address
	Amounts        []*big.Int
}

type DecreaseProviderStakeRequest added in v0.2.0

type DecreaseProviderStakeRequest struct {
	WriteRequest
	Request    crypto.DecreaseProviderStakeRequest
	ProviderID common.Address
}

DecreaseProviderStakeRequest represents all the parameters required for decreasing provider stake.

type DefaultAddressableEthClientGetter added in v1.0.0

type DefaultAddressableEthClientGetter struct {
	*DefaultEthClientGetter
	// contains filtered or unexported fields
}

func (*DefaultAddressableEthClientGetter) Address added in v1.0.0

type DefaultEthClientGetter added in v1.0.0

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

func (*DefaultEthClientGetter) Client added in v1.0.0

func (eth *DefaultEthClientGetter) Client() EtherClient

type ErrorTransactionReverted added in v0.2.0

type ErrorTransactionReverted struct {
	Err    rpc.Error
	Reason string
}

ErrorTransactionReverted when contract execution is interrupted with an error./

func (ErrorTransactionReverted) Error added in v0.2.0

func (e ErrorTransactionReverted) Error() string

type Estimatable added in v0.2.0

type Estimatable interface {
	// contains filtered or unexported methods
}

type EthClientGetter added in v1.0.0

type EthClientGetter interface {
	// Client returns a client to use for making call to the eth blockchain.
	Client() EtherClient
}

EthClientGetter wraps any eth client.

func NewDefaultEthClientGetter added in v1.0.0

func NewDefaultEthClientGetter(cl EtherClient) EthClientGetter

type EthMultiClient added in v1.0.0

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

EthMultiClient is a ethereum client that can reconnect.

func NewEthMultiClient added in v1.0.0

func NewEthMultiClient(defaulTimeout time.Duration, clients []AddressableEthClientGetter) (*EthMultiClient, error)

NewEthMultiClient creates a new multi clients eth client.

func NewEthMultiClientNotifyDown added in v1.0.0

func NewEthMultiClientNotifyDown(defaulTimeout time.Duration, clients []AddressableEthClientGetter, notifications chan<- string) (*EthMultiClient, error)

NewEthMultiClientNotifyDown creates a new multi clients eth client.

Channel `notifications` must be given and will be used to push notifications to the client if any nodes go down. The channel is closed when before the clients are closed.

func (*EthMultiClient) BalanceAt added in v1.0.0

func (c *EthMultiClient) BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)

BalanceAt returns the wei balance of the given account. The block number can be nil, in which case the balance is taken from the latest known block.

func (*EthMultiClient) BlockByHash added in v1.0.0

func (c *EthMultiClient) BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error)

BlockByHash returns the given full block.

Note that loading full blocks requires two requests. Use HeaderByHash if you don't need all transactions or uncle headers.

func (*EthMultiClient) BlockByNumber added in v1.0.0

func (c *EthMultiClient) BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)

BlockByNumber returns a block from the current canonical chain. If number is nil, the latest known block is returned.

Note that loading full blocks requires two requests. Use HeaderByNumber if you don't need all transactions or uncle headers.

func (*EthMultiClient) BlockNumber added in v1.0.0

func (c *EthMultiClient) BlockNumber(ctx context.Context) (uint64, error)

BlockNumber returns the most recent block number

func (*EthMultiClient) CallContract added in v1.0.0

func (c *EthMultiClient) CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)

CallContract executes a message call transaction, which is directly executed in the VM of the node, but never mined into the blockchain.

blockNumber selects the block height at which the call runs. It can be nil, in which case the code is taken from the latest known block. Note that state from very old blocks might not be available.

func (*EthMultiClient) ChainID added in v1.0.0

func (c *EthMultiClient) ChainID(ctx context.Context) (*big.Int, error)

ChainId retrieves the current chain ID for transaction replay protection.

func (*EthMultiClient) Client added in v1.0.0

func (c *EthMultiClient) Client() EtherClient

Client implements the EthClientGetter interface and returns itself as a EtherClient.

func (*EthMultiClient) Close added in v1.0.0

func (c *EthMultiClient) Close()

Close will close all the clients the multiclient instance holds.

func (*EthMultiClient) CodeAt added in v1.0.0

func (c *EthMultiClient) CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error)

CodeAt returns the contract code of the given account. The block number can be nil, in which case the code is taken from the latest known block.

func (*EthMultiClient) CurrentClientOrder added in v1.0.0

func (c *EthMultiClient) CurrentClientOrder() []string

CurrentClientOrder returns the current orders of all clients the multiclient uses.

func (*EthMultiClient) EstimateGas added in v1.0.0

func (c *EthMultiClient) EstimateGas(ctx context.Context, msg ethereum.CallMsg) (uint64, error)

EstimateGas tries to estimate the gas needed to execute a specific transaction based on the current pending state of the backend blockchain. There is no guarantee that this is the true gas limit requirement as other transactions may be added or removed by miners, but it should provide a basis for setting a reasonable default.

func (*EthMultiClient) FilterLogs added in v1.0.0

func (c *EthMultiClient) FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error)

FilterLogs executes a filter query.

func (*EthMultiClient) HeaderByHash added in v1.0.0

func (c *EthMultiClient) HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)

HeaderByHash returns the block header with the given hash.

func (*EthMultiClient) HeaderByNumber added in v1.0.0

func (c *EthMultiClient) HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)

HeaderByNumber returns a block header from the current canonical chain. If number is nil, the latest known header is returned.

func (*EthMultiClient) NetworkID added in v1.0.0

func (c *EthMultiClient) NetworkID(ctx context.Context) (*big.Int, error)

NetworkID returns the network ID (also known as the chain ID) for this chain.

func (*EthMultiClient) NonceAt added in v1.0.0

func (c *EthMultiClient) NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error)

NonceAt returns the account nonce of the given account. The block number can be nil, in which case the nonce is taken from the latest known block.

func (*EthMultiClient) PendingBalanceAt added in v1.0.0

func (c *EthMultiClient) PendingBalanceAt(ctx context.Context, account common.Address) (*big.Int, error)

PendingBalanceAt returns the wei balance of the given account in the pending state.

func (*EthMultiClient) PendingCallContract added in v1.0.0

func (c *EthMultiClient) PendingCallContract(ctx context.Context, msg ethereum.CallMsg) ([]byte, error)

PendingCallContract executes a message call transaction using the EVM. The state seen by the contract call is the pending state.

func (*EthMultiClient) PendingCodeAt added in v1.0.0

func (c *EthMultiClient) PendingCodeAt(ctx context.Context, account common.Address) ([]byte, error)

PendingCodeAt returns the contract code of the given account in the pending state.

func (*EthMultiClient) PendingNonceAt added in v1.0.0

func (c *EthMultiClient) PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)

PendingNonceAt returns the account nonce of the given account in the pending state. This is the nonce that should be used for the next transaction.

func (*EthMultiClient) PendingStorageAt added in v1.0.0

func (c *EthMultiClient) PendingStorageAt(ctx context.Context, account common.Address, key common.Hash) ([]byte, error)

PendingStorageAt returns the value of key in the contract storage of the given account in the pending state.

func (*EthMultiClient) PendingTransactionCount added in v1.0.0

func (c *EthMultiClient) PendingTransactionCount(ctx context.Context) (uint, error)

PendingTransactionCount returns the total number of transactions in the pending state.

func (*EthMultiClient) ReorderClients added in v1.0.0

func (c *EthMultiClient) ReorderClients(addresses []string) error

ReorderClients reorders clients to use in BC calls by the given address slice. If there are a lot of clients this function could be expensive and it will block all other calls or usage of these clients while reordering.

func (*EthMultiClient) SendTransaction added in v1.0.0

func (c *EthMultiClient) SendTransaction(ctx context.Context, tx *types.Transaction) error

SendTransaction injects a signed transaction into the pending pool for execution.

If the transaction was a contract creation use the TransactionReceipt method to get the contract address after the transaction has been mined.

func (*EthMultiClient) StorageAt added in v1.0.0

func (c *EthMultiClient) StorageAt(ctx context.Context, account common.Address, key common.Hash, blockNumber *big.Int) ([]byte, error)

StorageAt returns the value of key in the contract storage of the given account. The block number can be nil, in which case the value is taken from the latest known block.

func (*EthMultiClient) SubscribeFilterLogs added in v1.0.0

func (c *EthMultiClient) SubscribeFilterLogs(ctx context.Context, q ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error)

SubscribeFilterLogs subscribes to the results of a streaming filter query.

func (*EthMultiClient) SubscribeNewHead added in v1.0.0

func (c *EthMultiClient) SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error)

SubscribeNewHead subscribes to notifications about the current blockchain head on the given channel.

func (*EthMultiClient) SuggestGasPrice added in v1.0.0

func (c *EthMultiClient) SuggestGasPrice(ctx context.Context) (*big.Int, error)

SuggestGasPrice retrieves the currently suggested gas price to allow a timely execution of a transaction.

func (*EthMultiClient) SyncProgress added in v1.0.0

func (c *EthMultiClient) SyncProgress(ctx context.Context) (*ethereum.SyncProgress, error)

SyncProgress retrieves the current progress of the sync algorithm. If there's no sync currently running, it returns nil.

func (*EthMultiClient) TransactionByHash added in v1.0.0

func (c *EthMultiClient) TransactionByHash(ctx context.Context, hash common.Hash) (*types.Transaction, bool, error)

TransactionByHash returns the transaction with the given hash.

func (*EthMultiClient) TransactionCount added in v1.0.0

func (c *EthMultiClient) TransactionCount(ctx context.Context, blockHash common.Hash) (uint, error)

TransactionCount returns the total number of transactions in the given block.

func (*EthMultiClient) TransactionInBlock added in v1.0.0

func (c *EthMultiClient) TransactionInBlock(ctx context.Context, blockHash common.Hash, index uint) (*types.Transaction, error)

TransactionInBlock returns a single transaction at index in the given block.

func (*EthMultiClient) TransactionReceipt added in v1.0.0

func (c *EthMultiClient) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)

TransactionReceipt returns the receipt of a transaction by transaction hash. Note that the receipt is not available for pending transactions.

func (*EthMultiClient) TransactionSender added in v1.0.0

func (c *EthMultiClient) TransactionSender(ctx context.Context, tx *types.Transaction, block common.Hash, index uint) (common.Address, error)

TransactionSender returns the sender address of the given transaction. The transaction must be known to the remote node and included in the blockchain at the given block and index. The sender is the one derived by the protocol at the time of inclusion.

There is a fast-path for transactions retrieved by TransactionByHash and TransactionInBlock. Getting their sender address can be done without an RPC interaction.

type EthTransferRequest added in v0.2.0

type EthTransferRequest struct {
	WriteRequest
	To     common.Address
	Amount *big.Int
}

EthTransferRequest represents the ethereum transfer request input parameters.

type EtherClient added in v1.0.0

type EtherClient interface {
	Close()
	// ChainId retrieves the current chain ID for transaction replay protection.
	ChainID(ctx context.Context) (*big.Int, error)
	// BlockByHash returns the given full block.
	//
	// Note that loading full blocks requires two requests. Use HeaderByHash
	// if you don't need all transactions or uncle headers.
	BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error)
	// BlockByNumber returns a block from the current canonical chain. If number is nil, the
	// latest known block is returned.
	//
	// Note that loading full blocks requires two requests. Use HeaderByNumber
	// if you don't need all transactions or uncle headers.
	BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)
	// BlockNumber returns the most recent block number
	BlockNumber(ctx context.Context) (uint64, error)
	// HeaderByHash returns the block header with the given hash.
	HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)
	// HeaderByNumber returns a block header from the current canonical chain. If number is
	// nil, the latest known header is returned.
	HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)
	// TransactionByHash returns the transaction with the given hash.
	TransactionByHash(ctx context.Context, hash common.Hash) (tx *types.Transaction, isPending bool, err error)
	// TransactionSender returns the sender address of the given transaction. The transaction
	// must be known to the remote node and included in the blockchain at the given block and
	// index. The sender is the one derived by the protocol at the time of inclusion.
	//
	// There is a fast-path for transactions retrieved by TransactionByHash and
	// TransactionInBlock. Getting their sender address can be done without an RPC interaction.
	TransactionSender(ctx context.Context, tx *types.Transaction, block common.Hash, index uint) (common.Address, error)
	// TransactionCount returns the total number of transactions in the given block.
	TransactionCount(ctx context.Context, blockHash common.Hash) (uint, error)
	// TransactionInBlock returns a single transaction at index in the given block.
	TransactionInBlock(ctx context.Context, blockHash common.Hash, index uint) (*types.Transaction, error)
	// TransactionReceipt returns the receipt of a transaction by transaction hash.
	// Note that the receipt is not available for pending transactions.
	TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
	// SyncProgress retrieves the current progress of the sync algorithm. If there's
	// no sync currently running, it returns nil.
	SyncProgress(ctx context.Context) (*ethereum.SyncProgress, error)
	// SubscribeNewHead subscribes to notifications about the current blockchain head
	// on the given channel.
	SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error)
	// NetworkID returns the network ID (also known as the chain ID) for this chain.
	NetworkID(ctx context.Context) (*big.Int, error)
	// BalanceAt returns the wei balance of the given account.
	// The block number can be nil, in which case the balance is taken from the latest known block.
	BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)
	// StorageAt returns the value of key in the contract storage of the given account.
	// The block number can be nil, in which case the value is taken from the latest known block.
	StorageAt(ctx context.Context, account common.Address, key common.Hash, blockNumber *big.Int) ([]byte, error)
	// CodeAt returns the contract code of the given account.
	// The block number can be nil, in which case the code is taken from the latest known block.
	CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error)
	// NonceAt returns the account nonce of the given account.
	// The block number can be nil, in which case the nonce is taken from the latest known block.
	NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error)
	// FilterLogs executes a filter query.
	FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error)
	// SubscribeFilterLogs subscribes to the results of a streaming filter query.
	SubscribeFilterLogs(ctx context.Context, q ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error)
	// PendingBalanceAt returns the wei balance of the given account in the pending state.
	PendingBalanceAt(ctx context.Context, account common.Address) (*big.Int, error)
	// PendingStorageAt returns the value of key in the contract storage of the given account in the pending state.
	PendingStorageAt(ctx context.Context, account common.Address, key common.Hash) ([]byte, error)
	// PendingCodeAt returns the contract code of the given account in the pending state.
	PendingCodeAt(ctx context.Context, account common.Address) ([]byte, error)
	// PendingNonceAt returns the account nonce of the given account in the pending state.
	// This is the nonce that should be used for the next transaction.
	PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)
	// PendingTransactionCount returns the total number of transactions in the pending state.
	PendingTransactionCount(ctx context.Context) (uint, error)
	// CallContract executes a message call transaction, which is directly executed in the VM
	// of the node, but never mined into the blockchain.
	//
	// blockNumber selects the block height at which the call runs. It can be nil, in which
	// case the code is taken from the latest known block. Note that state from very old
	// blocks might not be available.
	CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)
	// PendingCallContract executes a message call transaction using the EVM.
	// The state seen by the contract call is the pending state.
	PendingCallContract(ctx context.Context, msg ethereum.CallMsg) ([]byte, error)
	// SuggestGasPrice retrieves the currently suggested gas price to allow a timely
	// execution of a transaction.
	SuggestGasPrice(ctx context.Context) (*big.Int, error)
	// EstimateGas tries to estimate the gas needed to execute a specific transaction based on
	// the current pending state of the backend blockchain. There is no guarantee that this is
	// the true gas limit requirement as other transactions may be added or removed by miners,
	// but it should provide a basis for setting a reasonable default.
	EstimateGas(ctx context.Context, msg ethereum.CallMsg) (uint64, error)
	// SendTransaction injects a signed transaction into the pending pool for execution.
	//
	// If the transaction was a contract creation use the TransactionReceipt method to get the
	// contract address after the transaction has been mined.
	SendTransaction(ctx context.Context, tx *types.Transaction) error
}

EtherClient interface implements all methods required for a EtherClient to work

type Hermes added in v0.2.0

type Hermes struct {
	Operator common.Address
	ImplVer  *big.Int
	Stake    *big.Int
	URL      string
}

Hermes represents the hermes in registry.

type MultiChainAddressKeeper added in v0.2.0

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

MultiChainAddressKeeper keeps track of smart contract addresses.

func NewMultiChainAddressKeeper added in v0.2.0

func NewMultiChainAddressKeeper(addresses map[int64]SmartContractAddresses) *MultiChainAddressKeeper

NewMultiChainAddressKeeper creates a new instance of MultiChainAddressKeeper.

func (*MultiChainAddressKeeper) GetActiveHermes added in v0.2.0

func (mcak *MultiChainAddressKeeper) GetActiveHermes(chainID int64) (common.Address, error)

GetActiveHermes returns active hermes address for the given chain.

func (*MultiChainAddressKeeper) GetAddressesForChain added in v0.2.0

func (mcak *MultiChainAddressKeeper) GetAddressesForChain(chainID int64) (SmartContractAddresses, error)

GetAddressesForChain returns the SmartContractAddresses for the given chain.

func (*MultiChainAddressKeeper) GetChannelImplementation added in v0.2.0

func (mcak *MultiChainAddressKeeper) GetChannelImplementation(chainID int64) (common.Address, error)

GetChannelImplementation returns the channel implementation sc address for the given chain.

func (*MultiChainAddressKeeper) GetHermesImplementation added in v0.2.0

func (mcak *MultiChainAddressKeeper) GetHermesImplementation(chainID int64) (common.Address, error)

GetHermesImplementation returns the hermes implementation sc address for the given chain.

func (*MultiChainAddressKeeper) GetMystAddress added in v0.2.0

func (mcak *MultiChainAddressKeeper) GetMystAddress(chainID int64) (common.Address, error)

GetMystAddress returns the myst sc address for the given chain.

func (*MultiChainAddressKeeper) GetRegistryAddress added in v0.2.0

func (mcak *MultiChainAddressKeeper) GetRegistryAddress(chainID int64) (common.Address, error)

GetRegistryAddress returns the registry sc address for the given chain.

type MultichainBlockchainClient added in v0.2.0

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

func NewMultichainBlockchainClient added in v0.2.0

func NewMultichainBlockchainClient(clients map[int64]BC) *MultichainBlockchainClient

func (*MultichainBlockchainClient) CalculateHermesFee added in v0.2.0

func (mbc *MultichainBlockchainClient) CalculateHermesFee(chainID int64, hermesAddress common.Address, value *big.Int) (*big.Int, error)

func (*MultichainBlockchainClient) CustodyTransferTokens added in v1.0.0

func (mbc *MultichainBlockchainClient) CustodyTransferTokens(chainID int64, req CustodyTokensTransfer) (*types.Transaction, error)

func (*MultichainBlockchainClient) DecreaseProviderStake added in v0.2.0

func (mbc *MultichainBlockchainClient) DecreaseProviderStake(chainID int64, req DecreaseProviderStakeRequest) (*types.Transaction, error)

func (*MultichainBlockchainClient) FilterLogs added in v0.2.0

func (mbc *MultichainBlockchainClient) FilterLogs(chainID int64, q ethereum.FilterQuery) ([]types.Log, error)

FilterLogs executes a filter query.

func (*MultichainBlockchainClient) FilterPromiseSettledEventByChannelID added in v1.0.0

func (mbc *MultichainBlockchainClient) FilterPromiseSettledEventByChannelID(chainID int64, from uint64, to *uint64, hermesID common.Address, providerAddresses [][32]byte) ([]bindings.HermesImplementationPromiseSettled, error)

func (*MultichainBlockchainClient) GetBeneficiary added in v0.2.0

func (mbc *MultichainBlockchainClient) GetBeneficiary(chainID int64, registryAddress, identity common.Address) (common.Address, error)

func (*MultichainBlockchainClient) GetChannelImplementationByVersion added in v0.2.0

func (mbc *MultichainBlockchainClient) GetChannelImplementationByVersion(chainID int64, registryID common.Address, version *big.Int) (common.Address, error)

func (*MultichainBlockchainClient) GetConsumerChannel added in v0.2.0

func (mbc *MultichainBlockchainClient) GetConsumerChannel(chainID int64, addr common.Address, mystSCAddress common.Address) (ConsumerChannel, error)

func (*MultichainBlockchainClient) GetConsumerChannelOperator added in v0.2.0

func (mbc *MultichainBlockchainClient) GetConsumerChannelOperator(chainID int64, channelAddress common.Address) (common.Address, error)

func (*MultichainBlockchainClient) GetConsumerChannelsHermes added in v0.2.0

func (mbc *MultichainBlockchainClient) GetConsumerChannelsHermes(chainID int64, channelAddress common.Address) (ConsumersHermes, error)

func (*MultichainBlockchainClient) GetEthBalance added in v0.2.0

func (mbc *MultichainBlockchainClient) GetEthBalance(chainID int64, address common.Address) (*big.Int, error)

func (*MultichainBlockchainClient) GetHermes added in v0.2.0

func (mbc *MultichainBlockchainClient) GetHermes(chainID int64, registryID, hermesID common.Address) (Hermes, error)

func (*MultichainBlockchainClient) GetHermesFee added in v0.2.0

func (mbc *MultichainBlockchainClient) GetHermesFee(chainID int64, hermesAddress common.Address) (uint16, error)

func (*MultichainBlockchainClient) GetHermesOperator added in v0.2.0

func (mbc *MultichainBlockchainClient) GetHermesOperator(chainID int64, hermesID common.Address) (common.Address, error)

func (*MultichainBlockchainClient) GetHermesURL added in v0.2.0

func (mbc *MultichainBlockchainClient) GetHermesURL(chainID int64, registryID, hermesID common.Address) (string, error)

func (*MultichainBlockchainClient) GetHermessAvailableBalance added in v0.2.0

func (mbc *MultichainBlockchainClient) GetHermessAvailableBalance(chainID int64, hermesAddress common.Address) (*big.Int, error)

func (*MultichainBlockchainClient) GetLastRegistryNonce added in v0.2.0

func (mbc *MultichainBlockchainClient) GetLastRegistryNonce(chainID int64, registry common.Address) (*big.Int, error)

func (*MultichainBlockchainClient) GetMystBalance added in v0.2.0

func (mbc *MultichainBlockchainClient) GetMystBalance(chainID int64, mystSCAddress, address common.Address) (*big.Int, error)

func (*MultichainBlockchainClient) GetProviderChannel added in v0.2.0

func (mbc *MultichainBlockchainClient) GetProviderChannel(chainID int64, hermesAddress common.Address, addressToCheck common.Address, pending bool) (ProviderChannel, error)

func (*MultichainBlockchainClient) GetProviderChannelByID added in v0.2.0

func (mbc *MultichainBlockchainClient) GetProviderChannelByID(chainID int64, acc common.Address, chID []byte) (ProviderChannel, error)

func (*MultichainBlockchainClient) GetProvidersWithdrawalChannel added in v1.0.0

func (mbc *MultichainBlockchainClient) GetProvidersWithdrawalChannel(chainID int64, hermesAddress common.Address, addressToCheck common.Address, pending bool) (ProviderChannel, error)

func (*MultichainBlockchainClient) GetStakeThresholds added in v0.2.0

func (mbc *MultichainBlockchainClient) GetStakeThresholds(chainID int64, hermesID common.Address) (min, max *big.Int, err error)

GetStakeThresholds returns the stake tresholds for the given hermes.

func (*MultichainBlockchainClient) HeaderByNumber added in v0.2.0

func (mbc *MultichainBlockchainClient) HeaderByNumber(chainID int64, number *big.Int) (*types.Header, error)

HeaderByNumber returns a block header from the current canonical chain. If number is nil, the latest known header is returned.

func (*MultichainBlockchainClient) IncreaseProviderStake added in v0.2.0

func (mbc *MultichainBlockchainClient) IncreaseProviderStake(chainID int64, req ProviderStakeIncreaseRequest) (*types.Transaction, error)

func (*MultichainBlockchainClient) IsChannelOpened added in v0.2.0

func (mbc *MultichainBlockchainClient) IsChannelOpened(chainID int64, registryID, identity, hermesID common.Address) (bool, error)

func (*MultichainBlockchainClient) IsHermesActive added in v0.2.0

func (mbc *MultichainBlockchainClient) IsHermesActive(chainID int64, hermesID common.Address) (bool, error)

func (*MultichainBlockchainClient) IsHermesRegistered added in v0.2.0

func (mbc *MultichainBlockchainClient) IsHermesRegistered(chainID int64, registryAddress, hermesID common.Address) (bool, error)

func (*MultichainBlockchainClient) IsRegistered added in v0.2.0

func (mbc *MultichainBlockchainClient) IsRegistered(chainID int64, registryAddress, addressToCheck common.Address) (bool, error)

func (*MultichainBlockchainClient) IsRegisteredAsProvider added in v0.2.0

func (mbc *MultichainBlockchainClient) IsRegisteredAsProvider(chainID int64, hermesAddress, registryAddress, addressToCheck common.Address) (bool, error)

func (*MultichainBlockchainClient) NetworkID added in v0.2.0

func (mbc *MultichainBlockchainClient) NetworkID(chainID int64) (*big.Int, error)

NetworkID method is really not that useful, as chain id == networkid

func (*MultichainBlockchainClient) PayAndSettle added in v0.2.0

func (mbc *MultichainBlockchainClient) PayAndSettle(chainID int64, psr PayAndSettleRequest) (*types.Transaction, error)

func (*MultichainBlockchainClient) RegisterIdentity added in v0.2.0

func (mbc *MultichainBlockchainClient) RegisterIdentity(chainID int64, rr RegistrationRequest) (*types.Transaction, error)

func (*MultichainBlockchainClient) RewarderAirDrop added in v0.2.0

func (mbc *MultichainBlockchainClient) RewarderAirDrop(chainID int64, req RewarderAirDrop) (*types.Transaction, error)

func (*MultichainBlockchainClient) RewarderTotalClaimed added in v0.2.0

func (mbc *MultichainBlockchainClient) RewarderTotalClaimed(chainID int64, rewarderAddress common.Address) (*big.Int, error)

RewarderTotalClaimed is a free lookup in the blockchain for the total amount of claimed tokens in the blockchain.

func (*MultichainBlockchainClient) RewarderTotalPayoutsFor added in v0.2.0

func (mbc *MultichainBlockchainClient) RewarderTotalPayoutsFor(chainID int64, rewarderAddress common.Address, payoutsFor common.Address) (*big.Int, error)

func (*MultichainBlockchainClient) RewarderUpdateRoot added in v0.2.0

func (mbc *MultichainBlockchainClient) RewarderUpdateRoot(chainID int64, req RewarderUpdateRoot) (*types.Transaction, error)

func (*MultichainBlockchainClient) SendTransaction added in v0.2.0

func (mbc *MultichainBlockchainClient) SendTransaction(chainID int64, tx *types.Transaction) error

func (*MultichainBlockchainClient) SettleAndRebalance added in v0.2.0

func (*MultichainBlockchainClient) SettleIntoStake added in v0.2.0

func (*MultichainBlockchainClient) SettlePromise added in v0.2.0

func (mbc *MultichainBlockchainClient) SettlePromise(req SettleRequest) (*types.Transaction, error)

func (*MultichainBlockchainClient) SettleWithBeneficiary added in v0.2.0

func (*MultichainBlockchainClient) SubscribeToConsumerBalanceEvent added in v0.2.0

func (mbc *MultichainBlockchainClient) SubscribeToConsumerBalanceEvent(chainID int64, channel, mystSCAddress common.Address, timeout time.Duration) (chan *bindings.MystTokenTransfer, func(), error)

func (*MultichainBlockchainClient) SubscribeToConsumerChannelBalanceUpdate added in v0.2.0

func (mbc *MultichainBlockchainClient) SubscribeToConsumerChannelBalanceUpdate(chainID int64, mystSCAddress common.Address, channelAddresses []common.Address) (sink chan *bindings.MystTokenTransfer, cancel func(), err error)

func (*MultichainBlockchainClient) SubscribeToIdentityRegistrationEvents added in v0.2.0

func (mbc *MultichainBlockchainClient) SubscribeToIdentityRegistrationEvents(chainID int64, registryAddress common.Address) (sink chan *bindings.RegistryRegisteredIdentity, cancel func(), err error)

func (*MultichainBlockchainClient) SubscribeToMystTokenTransfers added in v0.2.0

func (mbc *MultichainBlockchainClient) SubscribeToMystTokenTransfers(chainID int64, mystSCAddress common.Address) (chan *bindings.MystTokenTransfer, func(), error)

func (*MultichainBlockchainClient) SubscribeToPromiseSettledEvent added in v0.2.0

func (mbc *MultichainBlockchainClient) SubscribeToPromiseSettledEvent(chainID int64, providerID, hermesID common.Address) (sink chan *bindings.HermesImplementationPromiseSettled, cancel func(), err error)

func (*MultichainBlockchainClient) SubscribeToPromiseSettledEventByChannelID added in v0.2.0

func (mbc *MultichainBlockchainClient) SubscribeToPromiseSettledEventByChannelID(chainID int64, hermesID common.Address, providerAddresses [][32]byte) (sink chan *bindings.HermesImplementationPromiseSettled, cancel func(), err error)

func (*MultichainBlockchainClient) SubscribeToWithdrawalPromiseSettledEvent added in v1.0.0

func (mbc *MultichainBlockchainClient) SubscribeToWithdrawalPromiseSettledEvent(chainID int64, providerID, hermesID common.Address) (sink chan *bindings.HermesImplementationPromiseSettled, cancel func(), err error)

func (*MultichainBlockchainClient) SuggestGasPrice added in v0.2.0

func (mbc *MultichainBlockchainClient) SuggestGasPrice(chainID int64) (*big.Int, error)

func (*MultichainBlockchainClient) TransactionByHash added in v0.2.0

func (mbc *MultichainBlockchainClient) TransactionByHash(chainID int64, hash common.Hash) (*types.Transaction, bool, error)

func (*MultichainBlockchainClient) TransactionReceipt added in v0.2.0

func (mbc *MultichainBlockchainClient) TransactionReceipt(chainID int64, hash common.Hash) (*types.Receipt, error)

func (*MultichainBlockchainClient) TransferEth added in v0.2.0

func (mbc *MultichainBlockchainClient) TransferEth(chainID int64, etr EthTransferRequest) (*types.Transaction, error)

func (*MultichainBlockchainClient) TransferMyst added in v0.2.0

func (mbc *MultichainBlockchainClient) TransferMyst(chainID int64, req TransferRequest) (tx *types.Transaction, err error)

type NonceTracker

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

NonceTracker keeps track of nonces atomically.

func NewNonceTracker

func NewNonceTracker(client client) *NonceTracker

NewNonceTracker returns a new nonce tracker.

func (*NonceTracker) ForceReloadNonce

func (nt *NonceTracker) ForceReloadNonce(account common.Address)

ForceReloadNonce clears the nonce cache. This will force loading from BC next time.

func (*NonceTracker) GetNonce

func (nt *NonceTracker) GetNonce(ctx context.Context, account common.Address) (uint64, error)

GetNonce returns an atomically increasing nonce for the account.

type PayAndSettleRequest added in v0.2.0

type PayAndSettleRequest struct {
	WriteRequest
	Beneficiary          common.Address
	HermesID             common.Address
	ProviderID           common.Address
	Promise              crypto.Promise
	BeneficiarySignature []byte
}

PayAndSettleRequest allows to pay and settle and exit to l1 via this.

type ProviderChannel

type ProviderChannel struct {
	Settled       *big.Int
	Stake         *big.Int
	LastUsedNonce *big.Int
	Timelock      *big.Int
}

ProviderChannel represents the provider channel

type ProviderStakeIncreaseRequest added in v0.2.0

type ProviderStakeIncreaseRequest struct {
	WriteRequest
	ChannelID [32]byte
	HermesID  common.Address
	Amount    *big.Int
}

ProviderStakeIncreaseRequest represents all the parameters required for stake increase.

type ReconnectableEthClient

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

ReconnectableEthClient is a ethereum client that can reconnect.

func NewReconnectableEthClient

func NewReconnectableEthClient(address string, connectTimeout time.Duration) (*ReconnectableEthClient, error)

NewReconnectableEthClient creates new ethereum client that can reconnect.

func (*ReconnectableEthClient) Address added in v1.0.0

func (c *ReconnectableEthClient) Address() string

Address returns the current address which was used to create the client.

func (*ReconnectableEthClient) Client

func (c *ReconnectableEthClient) Client() EtherClient

Client returns the currently connected ethereum client.

func (*ReconnectableEthClient) Reconnect

func (c *ReconnectableEthClient) Reconnect(connectTimeout time.Duration) error

Reconnect creates new ethereum client and replaces the current one.

type RegistrationRequest

type RegistrationRequest struct {
	WriteRequest
	ChainID         int64
	HermesID        common.Address
	Stake           *big.Int
	TransactorFee   *big.Int
	Beneficiary     common.Address
	Signature       []byte
	RegistryAddress common.Address
	Nonce           *big.Int
}

RegistrationRequest contains all the parameters for the registration request

type RewarderAirDrop added in v0.2.0

type RewarderAirDrop struct {
	WriteRequest
	RewaderID     common.Address
	Beneficiaries []common.Address
	TotalEarnings []*big.Int
}

type RewarderUpdateRoot added in v0.2.0

type RewarderUpdateRoot struct {
	WriteRequest
	RewaderID   common.Address
	ClaimRoot   []byte
	BlockNumber *big.Int
	TotalReward *big.Int
}

type SettleAndRebalanceRequest

type SettleAndRebalanceRequest struct {
	WriteRequest
	HermesID   common.Address
	ProviderID common.Address
	Promise    crypto.Promise
}

SettleAndRebalanceRequest represents all the parameters required for settle and rebalance

type SettleIntoStakeRequest added in v0.2.0

type SettleIntoStakeRequest struct {
	WriteRequest
	Promise    crypto.Promise
	HermesID   common.Address
	ProviderID common.Address
}

SettleIntoStakeRequest represents all the parameters required for settling into stake.

type SettleRequest

type SettleRequest struct {
	WriteRequest
	ChannelID common.Address
	Promise   crypto.Promise
}

SettleRequest represents all the parameters required for settle

type SettleWithBeneficiaryRequest added in v0.0.13

type SettleWithBeneficiaryRequest struct {
	WriteRequest
	Promise     crypto.Promise
	HermesID    common.Address
	ProviderID  common.Address
	Beneficiary common.Address
	Signature   []byte
}

SettleWithBeneficiaryRequest represents all the parameters required for setting new beneficiary via transactor.

type SmartContractAddresses added in v0.2.0

type SmartContractAddresses struct {
	Registry              common.Address
	Myst                  common.Address
	HermesImplementation  common.Address
	ChannelImplementation common.Address
	Hermes                common.Address
}

SmartContractAddresses represents the mysterium smart contract address collection.

type TransferRequest

type TransferRequest struct {
	MystAddress common.Address
	Recipient   common.Address
	Amount      *big.Int
	WriteRequest
}

TransferRequest contains all the parameters for a transfer request

type WithDryRuns

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

WithDryRuns forces a dry run before running a write transaction on blockchain. Ethereum client will perform a dry run on a transaction with no gas limit set. This component will perform a dry run if and only if the gas limit is set to a non zero value. In this way, the dry run is always performed before sending the transaction to the network. For convenience, this component proxies read only calls to the underlying blockchain.

func NewWithDryRuns

func NewWithDryRuns(bc BC, ethClient EthClientGetter) *WithDryRuns

NewWithDryRuns creates a new instance of client with dry runs.

func (*WithDryRuns) CalculateHermesFee added in v0.2.0

func (cwdr *WithDryRuns) CalculateHermesFee(hermesAddress common.Address, value *big.Int) (*big.Int, error)

CalculateHermesFee fetches the hermes fee from blockchain

func (*WithDryRuns) CustodyTransferTokens added in v1.0.0

func (cwdr *WithDryRuns) CustodyTransferTokens(req CustodyTokensTransfer) (*types.Transaction, error)

func (*WithDryRuns) DecreaseProviderStake added in v0.2.0

func (cwdr *WithDryRuns) DecreaseProviderStake(req DecreaseProviderStakeRequest) (*types.Transaction, error)

DecreaseProviderStake decreases provider stake.

func (*WithDryRuns) DryRun added in v0.2.0

func (cwdr *WithDryRuns) DryRun(req Estimatable) error

DryRun simulates the (paid) contract method with params as input values.

func (*WithDryRuns) Estimate added in v0.2.0

func (cwdr *WithDryRuns) Estimate(req Estimatable) (uint64, error)

func (*WithDryRuns) FilterLogs added in v0.2.0

func (cwdr *WithDryRuns) FilterLogs(q ethereum.FilterQuery) ([]types.Log, error)

func (*WithDryRuns) GetBeneficiary added in v0.2.0

func (cwdr *WithDryRuns) GetBeneficiary(registryAddress, identity common.Address) (common.Address, error)

func (*WithDryRuns) GetChannelImplementationByVersion added in v0.2.0

func (cwdr *WithDryRuns) GetChannelImplementationByVersion(registryID common.Address, version *big.Int) (common.Address, error)

func (*WithDryRuns) GetConsumerChannel

func (cwdr *WithDryRuns) GetConsumerChannel(addr common.Address, mystSCAddress common.Address) (ConsumerChannel, error)

GetConsumerChannel returns the consumer channel

func (*WithDryRuns) GetConsumerChannelOperator

func (cwdr *WithDryRuns) GetConsumerChannelOperator(channelAddress common.Address) (common.Address, error)

GetConsumerChannelOperator returns the consumer channel operator/identity

func (*WithDryRuns) GetConsumerChannelsHermes added in v0.2.0

func (cwdr *WithDryRuns) GetConsumerChannelsHermes(channelAddress common.Address) (ConsumersHermes, error)

GetConsumerChannelsHermes returns the consumer channels hermes

func (*WithDryRuns) GetEthBalance added in v0.2.0

func (cwdr *WithDryRuns) GetEthBalance(address common.Address) (*big.Int, error)

GetEthBalance gets the current ethereum balance for the address.

func (*WithDryRuns) GetHermes added in v0.2.0

func (cwdr *WithDryRuns) GetHermes(registryID, hermesID common.Address) (Hermes, error)

func (*WithDryRuns) GetHermesFee added in v0.2.0

func (cwdr *WithDryRuns) GetHermesFee(hermesAddress common.Address) (uint16, error)

GetHermesFee fetches the hermes fee from blockchain

func (*WithDryRuns) GetHermesOperator added in v0.2.0

func (cwdr *WithDryRuns) GetHermesOperator(hermesID common.Address) (common.Address, error)

GetHermesOperator returns operator address of given hermes

func (*WithDryRuns) GetHermesURL added in v0.2.0

func (cwdr *WithDryRuns) GetHermesURL(registryID, hermesID common.Address) (string, error)

GetHermesURL returns the thermes URL.

func (*WithDryRuns) GetHermessAvailableBalance added in v0.2.0

func (cwdr *WithDryRuns) GetHermessAvailableBalance(hermesAddress common.Address) (*big.Int, error)

func (*WithDryRuns) GetLastRegistryNonce added in v0.2.0

func (cwdr *WithDryRuns) GetLastRegistryNonce(registry common.Address) (*big.Int, error)

func (*WithDryRuns) GetMystBalance

func (cwdr *WithDryRuns) GetMystBalance(mystSCAddress, address common.Address) (*big.Int, error)

GetMystBalance returns the balance in myst

func (*WithDryRuns) GetProviderChannel

func (cwdr *WithDryRuns) GetProviderChannel(hermesAddress common.Address, addressToCheck common.Address, pending bool) (ProviderChannel, error)

GetProviderChannel returns the provider channel

func (*WithDryRuns) GetProviderChannelByID

func (cwdr *WithDryRuns) GetProviderChannelByID(acc common.Address, chID []byte) (ProviderChannel, error)

GetProviderChannelByID returns the given channel information

func (*WithDryRuns) GetProvidersWithdrawalChannel added in v1.0.0

func (cwdr *WithDryRuns) GetProvidersWithdrawalChannel(hermesAddress common.Address, addressToCheck common.Address, pending bool) (ProviderChannel, error)

func (*WithDryRuns) GetStakeThresholds added in v0.2.0

func (cwdr *WithDryRuns) GetStakeThresholds(hermesID common.Address) (min, max *big.Int, err error)

GetStakeThresholds returns the stake tresholds for the given hermes.

func (*WithDryRuns) HeaderByNumber added in v0.2.0

func (cwdr *WithDryRuns) HeaderByNumber(number *big.Int) (*types.Header, error)

func (*WithDryRuns) IncreaseProviderStake added in v0.2.0

func (cwdr *WithDryRuns) IncreaseProviderStake(req ProviderStakeIncreaseRequest) (*types.Transaction, error)

IncreaseProviderStake increases the provider stake.

func (*WithDryRuns) IsChannelOpened added in v0.2.0

func (cwdr *WithDryRuns) IsChannelOpened(registryID, identity, hermesID common.Address) (bool, error)

func (*WithDryRuns) IsHermesActive added in v0.2.0

func (cwdr *WithDryRuns) IsHermesActive(hermesID common.Address) (bool, error)

func (*WithDryRuns) IsHermesRegistered added in v0.2.0

func (cwdr *WithDryRuns) IsHermesRegistered(registryAddress, acccountantID common.Address) (bool, error)

IsHermesRegistered checks if given hermes is registered and returns true or false.

func (*WithDryRuns) IsRegistered

func (cwdr *WithDryRuns) IsRegistered(registryAddress, addressToCheck common.Address) (bool, error)

IsRegistered checks wether the given identity is registered or not

func (*WithDryRuns) IsRegisteredAsProvider

func (cwdr *WithDryRuns) IsRegisteredAsProvider(hermesAddress, registryAddress, addressToCheck common.Address) (bool, error)

IsRegisteredAsProvider checks if the provider is registered with the hermes properly

func (*WithDryRuns) NetworkID

func (cwdr *WithDryRuns) NetworkID() (*big.Int, error)

NetworkID returns the network id

func (*WithDryRuns) PayAndSettle added in v0.2.0

func (cwdr *WithDryRuns) PayAndSettle(req PayAndSettleRequest) (*types.Transaction, error)

func (*WithDryRuns) RegisterIdentity

func (cwdr *WithDryRuns) RegisterIdentity(req RegistrationRequest) (*types.Transaction, error)

RegisterIdentity registers the given identity on blockchain

func (*WithDryRuns) RewarderAirDrop added in v0.2.0

func (cwdr *WithDryRuns) RewarderAirDrop(req RewarderAirDrop) (*types.Transaction, error)

func (*WithDryRuns) RewarderTotalClaimed added in v0.2.0

func (cwdr *WithDryRuns) RewarderTotalClaimed(rewarderAddress common.Address) (*big.Int, error)

RewarderTotalClaimed is a free lookup in the blockchain for the total amount of claimed tokens in the blockchain.

func (*WithDryRuns) RewarderTotalPayoutsFor added in v0.2.0

func (cwdr *WithDryRuns) RewarderTotalPayoutsFor(rewarderAddress common.Address, payoutsFor common.Address) (*big.Int, error)

func (*WithDryRuns) RewarderUpdateRoot added in v0.2.0

func (cwdr *WithDryRuns) RewarderUpdateRoot(req RewarderUpdateRoot) (*types.Transaction, error)

func (*WithDryRuns) SendTransaction added in v0.2.0

func (cwdr *WithDryRuns) SendTransaction(tx *types.Transaction) error

func (*WithDryRuns) SettleAndRebalance

func (cwdr *WithDryRuns) SettleAndRebalance(req SettleAndRebalanceRequest) (*types.Transaction, error)

SettleAndRebalance is settling given hermes issued promise

func (*WithDryRuns) SettleIntoStake added in v0.2.0

func (cwdr *WithDryRuns) SettleIntoStake(req SettleIntoStakeRequest) (*types.Transaction, error)

SettleIntoStake settles the hermes promise into stake increase.

func (*WithDryRuns) SettlePromise

func (cwdr *WithDryRuns) SettlePromise(req SettleRequest) (*types.Transaction, error)

SettlePromise is settling the given consumer issued promise

func (*WithDryRuns) SettleWithBeneficiary added in v0.0.13

func (cwdr *WithDryRuns) SettleWithBeneficiary(req SettleWithBeneficiaryRequest) (*types.Transaction, error)

SettleWithBeneficiary sets new beneficiary and settling given hermes issued promise into it.

func (*WithDryRuns) SubscribeToConsumerBalanceEvent

func (cwdr *WithDryRuns) SubscribeToConsumerBalanceEvent(channel, mystSCAddress common.Address, timeout time.Duration) (chan *bindings.MystTokenTransfer, func(), error)

SubscribeToConsumerBalanceEvent subscribes to the consumer balance change events

func (*WithDryRuns) SubscribeToConsumerChannelBalanceUpdate

func (cwdr *WithDryRuns) SubscribeToConsumerChannelBalanceUpdate(mystSCAddress common.Address, channelAddresses []common.Address) (sink chan *bindings.MystTokenTransfer, cancel func(), err error)

SubscribeToConsumerChannelBalanceUpdate subscribes to consumer channel balance update events

func (*WithDryRuns) SubscribeToIdentityRegistrationEvents

func (cwdr *WithDryRuns) SubscribeToIdentityRegistrationEvents(registryAddress common.Address) (sink chan *bindings.RegistryRegisteredIdentity, cancel func(), err error)

SubscribeToIdentityRegistrationEvents subscribes to identity registration events

func (*WithDryRuns) SubscribeToMystTokenTransfers

func (cwdr *WithDryRuns) SubscribeToMystTokenTransfers(mystSCAddress common.Address) (chan *bindings.MystTokenTransfer, func(), error)

SubscribeToMystTokenTransfers subscribes to myst token transfers

func (*WithDryRuns) SubscribeToPromiseSettledEvent

func (cwdr *WithDryRuns) SubscribeToPromiseSettledEvent(providerID, hermesID common.Address) (sink chan *bindings.HermesImplementationPromiseSettled, cancel func(), err error)

SubscribeToPromiseSettledEvent subscribes to promise settled events

func (*WithDryRuns) SubscribeToPromiseSettledEventByChannelID

func (cwdr *WithDryRuns) SubscribeToPromiseSettledEventByChannelID(hermesID common.Address, providerAddresses [][32]byte) (sink chan *bindings.HermesImplementationPromiseSettled, cancel func(), err error)

SubscribeToPromiseSettledEventByChannelID subscribes to promise settled events

func (*WithDryRuns) SubscribeToWithdrawalPromiseSettledEvent added in v1.0.0

func (cwdr *WithDryRuns) SubscribeToWithdrawalPromiseSettledEvent(providerID, hermesID common.Address) (sink chan *bindings.HermesImplementationPromiseSettled, cancel func(), err error)

func (*WithDryRuns) SuggestGasPrice added in v0.2.0

func (cwdr *WithDryRuns) SuggestGasPrice() (*big.Int, error)

func (*WithDryRuns) TransactionByHash added in v0.2.0

func (cwdr *WithDryRuns) TransactionByHash(hash common.Hash) (*types.Transaction, bool, error)

func (*WithDryRuns) TransactionReceipt added in v0.2.0

func (cwdr *WithDryRuns) TransactionReceipt(hash common.Hash) (*types.Receipt, error)

func (*WithDryRuns) TransferEth added in v0.2.0

func (cwdr *WithDryRuns) TransferEth(etr EthTransferRequest) (*types.Transaction, error)

func (*WithDryRuns) TransferMyst

func (cwdr *WithDryRuns) TransferMyst(req TransferRequest) (tx *types.Transaction, err error)

TransferMyst transfers myst

type WriteRequest

type WriteRequest struct {
	Identity common.Address
	Signer   bind.SignerFn
	GasLimit uint64
	GasPrice *big.Int
	Nonce    *big.Int
}

WriteRequest contains the required params for a write request

Jump to

Keyboard shortcuts

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