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") //Berry Contract Address ContractAddress = util.NewKey("common", "contractAddress") //MasterContractContextKey is the shared context key to get shared master berry contract instance MasterContractContextKey = util.NewKey("common", "masterContract") NewBerryContractContextKey = util.NewKey("common", "newBerryContract") //TransactorContractContextKey is the shared context key to get shared transactor berry contract instance TransactorContractContextKey = util.NewKey("common", "transactorContract") 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") )
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.
Click to show internal directories.
Click to hide internal directories.