common

package
v0.0.0-...-7d63ed4 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//ClientContextKey is the key used to set the eth client on tracker contexts
	ClientContextKey = util.NewKey("common", "ETHClient")

	//DBContextKey is the shared context key where a DB instance can be found in a context
	DBContextKey = util.NewKey("common", "DB")

	//Zap Contract Address
	ContractAddress = util.NewKey("common", "contractAddress")

	//MasterContractContextKey is the shared context key to get shared master zap contract instance
	MasterContractContextKey = util.NewKey("common", "masterContract")

	NewZapContractContextKey = util.NewKey("common", "newZapContract")

	//TransactorContractContextKey is the shared context key to get shared transactor zap contract instance
	TransactorContractContextKey = util.NewKey("common", "transactorContract")

	TokenTransactorContractContextKey = util.NewKey("common", "tokenTransactorContract")

	NewTransactorContractContextKey = util.NewKey("common", "newTransactorContract")

	//DataProxyKey used to access the local or remote data server proxy
	DataProxyKey = util.NewKey("common", "DataServerProxy")

	//Ethereum wallet private key
	PrivateKey = util.NewKey("common", "PrivateKey")

	//Ethereum wallet public address
	PublicAddress = util.NewKey("common", "PublicAddress")

	TokenFilterContextKey = util.NewKey("common", "tokenFilter")

	VaultTransactorContractContextKey = util.NewKey("common", "vaultTransactorContract")
)

Functions

This section is empty.

Types

type ContractInterface

type ContractInterface interface {
	AddTip(requestID *big.Int, amount *big.Int) (*types.Transaction, error)
	SubmitSolution(solution string, requestID *big.Int, value *big.Int) (*types.Transaction, error)
	// NewSubmitSolution(solution string, requestID [5]*big.Int, value [5]*big.Int) (*types.Transaction, error)
	DidMine(challenge [32]byte) (bool, error)
}

ContractInterface represents an abstraction of function definitions that can be called on the smart contract. This is mostly so that we can do unit tests without needing to call the actual contract

type TransactionGeneratorFN

type TransactionGeneratorFN func(ctx context.Context, contract ContractInterface) (*types.Transaction, error)

TransactionGeneratorFN is a callback function that a TransactionSubmitter uses to actually invoke a contract and generate a transaction

type TransactionSubmitter

type TransactionSubmitter interface {

	//PrepareTransaction creates a ContractInterface and sends it to the generatorFN. The ctxName is
	//primarily for logging under which context the transaction is being prepared.
	PrepareTransaction(ctx context.Context, proxy db.DataServerProxy, ctxName string, factoryFn TransactionGeneratorFN) error
}

TransactionSubmitter is an abstraction for something that will callback a generator fn with a contract able to submit and generate transactions. This, like the ContractInterface, is an abstraction mainly so we can test isolated functionality.

Jump to

Keyboard shortcuts

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