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
Our solution to setup storage slots prior being accessed is trap Provider's request calls. However, something we overlook is when a contract calls an HTS token. For example
contractCallToken {
function getTokenTotalSupply(addresshtsTokenAddress) externalviewreturns (uint256) {
returnIERC20(htsTokenAddress).totalSupply();
}
}
In this case, the request mechanism won't work because the call is internal and not visible through the provider. We need a solution that allows us to hook into the EVM when calls are being executed.
where vm is provider._node._vm. It seems this approach allows us to catch all messages calls before the actual call.
If this solution works, it would change the current approach. Instead of extending the provider, we need would need to listen to this event, and hook only into calls to 0x167. From the payload data to 0x167 we can get the actual token address and setup the storage accordingly. This should solve both #55 and #50 (comment) as well.
se7enarianelabs
changed the title
Hook into EVM internal message calls to properly setup the storage
[Hardhat] Hook into EVM internal message calls to properly setup the storage
Nov 2, 2024
Our solution to setup storage slots prior being accessed is trap Provider's
request
calls. However, something we overlook is when a contract calls an HTS token. For exampleIn this case, the
request
mechanism won't work because the call is internal and not visible through the provider. We need a solution that allows us to hook into the EVM when calls are being executed.We could hook into the EVM using something like1
where
vm
isprovider._node._vm
. It seems this approach allows us to catch all messages calls before the actual call.If this solution works, it would change the current approach. Instead of extending the provider, we need would need to listen to this event, and hook only into calls to
0x167
. From the payload data to0x167
we can get the actual token address and setup the storage accordingly. This should solve both #55 and #50 (comment) as well.Footnotes
https://github.com/zemse/hardhat-tracer/blob/bc75d49be050476d01f078489ba2a50823af6faa/src/trace-recorder.ts#L57 ↩
The text was updated successfully, but these errors were encountered: