Add declaring result channel in SubscribeOnOracleEvents of ethclient

This commit is contained in:
ChronosX88 2020-11-14 14:00:19 +04:00
parent 5a730b9493
commit 302e4dc1f4
Signed by: ChronosXYZ
GPG Key ID: 085A69A82C8C511A

View File

@ -164,16 +164,17 @@ func (c *EthereumClient) GetEthAddress() *common.Address {
// return TxHash // return TxHash
// } // }
func (c *EthereumClient) SubscribeOnOracleEvents(incomingEventsChan chan *oracleemitter.OracleEmitterNewOracleRequest) (event.Subscription, error) { func (c *EthereumClient) SubscribeOnOracleEvents() (chan *oracleemitter.OracleEmitterNewOracleRequest, event.Subscription, error) {
resChan := make(chan *oracleemitter.OracleEmitterNewOracleRequest)
requestsFilter := c.oracleEmitter.Contract.OracleEmitterFilterer requestsFilter := c.oracleEmitter.Contract.OracleEmitterFilterer
subscription, err := requestsFilter.WatchNewOracleRequest(&bind.WatchOpts{ subscription, err := requestsFilter.WatchNewOracleRequest(&bind.WatchOpts{
Start: nil, //last block Start: nil, //last block
Context: nil, Context: nil,
}, incomingEventsChan) }, resChan)
if err != nil { if err != nil {
return nil, err return nil, nil, err
} }
return subscription, err return resChan, subscription, err
} }
func (c *EthereumClient) SubmitRequestAnswer(reqID *big.Int, data string, callbackAddress common.Address, callbackMethodID [4]byte) error { func (c *EthereumClient) SubmitRequestAnswer(reqID *big.Int, data string, callbackAddress common.Address, callbackMethodID [4]byte) error {