Skip to content

Commit

Permalink
fix: evm proxy history object string (#898)
Browse files Browse the repository at this point in the history
* fix: evm proxy history object string

* fix: evm proxy history object string

* fix: evm proxy history object string
  • Loading branch information
phamphong9981 committed Sep 9, 2024
1 parent b3b2844 commit b063b30
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions src/services/evm/crawl_evm_proxy_history.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export default class CrawlProxyContractEVMService extends BullableService {
}) as EVMSmartContract;
const firstTimeCatchProxyEvent =
proxyContractDb.find((proxy) => proxy.address === evmEvent.address) &&
anyProxyHistoryByAddress[evmEvent.address];
!anyProxyHistoryByAddress[evmEvent.address];
const newJSONProxy: Dictionary<any> = {};

switch (evmEvent.topic0) {
Expand All @@ -139,22 +139,29 @@ export default class CrawlProxyContractEVMService extends BullableService {
// break;
default:
if (firstTimeCatchProxyEvent) {
implementationAddress = await this.contractHelper.isContractProxy(
evmEvent.address,
_.find(
EIPProxyContractSupportByteCode,
(value, __) => value.TYPE === evmEventProxy.type
)?.SLOT,
undefined,
bytecodes[evmEvent.address]
);
implementationAddress = (
await this.contractHelper.isContractProxy(
evmEvent.address,
_.find(
EIPProxyContractSupportByteCode,
(value, __) => value.TYPE === evmEventProxy.type
)?.SLOT,
undefined,
bytecodes[evmEvent.address]
)
)?.logicContractAddress;
}
break;
}

newJSONProxy.proxy_contract = _.toLower(evmEvent.address);
newJSONProxy.implementation_contract =
_.toLower(implementationAddress as string) || null;
if (implementationAddress) {
newJSONProxy.implementation_contract = _.toLower(
implementationAddress as string
);
} else {
newJSONProxy.implementation_contract = null;
}
newJSONProxy.block_height = evmEvent.block_height;
newJSONProxy.tx_hash = evmEvent.tx_hash;
newJSONProxy.last_updated_height = lastUpdatedHeight;
Expand Down

0 comments on commit b063b30

Please sign in to comment.