Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
return;
}
const maybeDecodedLog = this._collisionResistantAbiDecoder.tryToDecodeLogOrNoop(
// At this moment we are sure that no error occured and log is defined.
logIfExists as LogEntryEvent,
);
const isLogDecoded = ((maybeDecodedLog as any) as LogWithDecodedArgs).event !== undefined;
if (!isLogDecoded) {
return; // noop
}
const decodedLog = (maybeDecodedLog as any) as LogWithDecodedArgs;
const transactionHash = decodedLog.transactionHash;
switch (decodedLog.event) {
case ERC20TokenEvents.Approval:
case ERC721TokenEvents.Approval: {
// ERC20 and ERC721 Transfer events have the same name so we need to distinguish them by args
if (decodedLog.args._value !== undefined) {
// ERC20
// Invalidate cache
const args = decodedLog.args as ERC20TokenApprovalEventArgs;
const tokenAssetData = assetDataUtils.encodeERC20AssetData(decodedLog.address);
this._deleteLazyStoreProxyAllowance(tokenAssetData, args._owner);
// Revalidate orders
const orderHashes = this._dependentOrderHashesTracker.getDependentOrderHashesByAssetDataByMaker(
args._owner,
tokenAssetData,
);
await this._emitRevalidateOrdersAsync(orderHashes, transactionHash);
break;
} else {
// ERC721