You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to register events triggered by a contract to another contract. Basically it would like to register ERC721 transfer generated by a linked contract
public function processLog(FilterChange $filterChange) {
if ($filterChange->address->hexVal() !== $this->contractAddress) {
return null;
}
if (is_array($filterChange->topics)) {
$topic = $filterChange->topics[0]->hexVal();
if (isset($this->events[$topic])) { //todo investigate here
$transaction = $this->eth->eth_getTransactionByHash($filterChange->transactionHash);
// We have a relevant event.
$event = new EmittedEvent($this->events[$topic], $filterChange, $transaction);
// Process onEventName handler.
if (method_exists($this, $event->getHandler())) {
call_user_func([$this, $event->getHandler()], $event);
}
return $event;
}
}
return null;
}
I changed this method to inject tracked contracts list on order to delegate the call process log
This way
public function processLog(FilterChange $filterChange, $otherTrackedContracts = null) {
if ($filterChange->address->hexVal() !== $this->contractAddress) {
if (isset($otherTrackedContracts[$filterChange->address->hexVal()])){
$matchingContract = $otherTrackedContracts[$filterChange->address->hexVal()];
return $matchingContract->processLog($filterChange);
}
return null;
}
if (is_array($filterChange->topics)) {
$topic = $filterChange->topics[0]->hexVal();
if (isset($this->events[$topic])) { //todo investigate here
$transaction = $this->eth->eth_getTransactionByHash($filterChange->transactionHash);
// We have a relevant event.
$event = new EmittedEvent($this->events[$topic], $filterChange, $transaction);
// Process onEventName handler.
if (method_exists($this, $event->getHandler())) {
call_user_func([$this, $event->getHandler()], $event);
}
return $event;
}
}
return null;
}
Is there a better way ? Running this code I'm getting an issue later processing other events while parsing the ABI.
Not sure it's related but I wonder if this this hack is the cause.
Thanks
Shaban
The text was updated successfully, but these errors were encountered:
Hello !
I'm trying to register events triggered by a contract to another contract. Basically it would like to register ERC721 transfer generated by a linked contract
I changed this method to inject tracked contracts list on order to delegate the call process log
This way
Is there a better way ? Running this code I'm getting an issue later processing other events while parsing the ABI.
Not sure it's related but I wonder if this this hack is the cause.
Thanks
Shaban
The text was updated successfully, but these errors were encountered: