Skip to content

Instantly share code, notes, and snippets.

@thaarok
Last active November 6, 2024 15:21
Show Gist options
  • Save thaarok/d3e8f9a85deae6ddfbc58001a27e45ea to your computer and use it in GitHub Desktop.
Save thaarok/d3e8f9a85deae6ddfbc58001a27e45ea to your computer and use it in GitHub Desktop.
SFClib code checking

SFClib code checking

Using hardhat-tracer to get slot key, where is sfclib address in SFC during npx hardhat test --fulltrace:

[CALL] UnitTestSFC(0x5fbdb2315678afecb367f032d93f642f64180aa3).initialize(sealedEpoch: 12, _totalSupply: 0, nodeDriver: [NodeDriverAuth], lib: 0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9, _c: [UnitTestConstantsManager], owner: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266)
[SSTORE] 0x0000000000000000000000000000000000000000000000000000000000000080 ← 0x000000000000000000000000dc64a140aa3e981100a9beca4e685f962f0cf6c9

Read storage slot with sfclib address from SFC:

curl 'https://rpcapi.fantom.network/' -X POST -H 'Content-Type: application/json' --data '{"jsonrpc":"2.0", "id":1, "method":"eth_getStorageAt", "params": ["0xFC00FACE00000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000080", "latest"]}'
{"jsonrpc":"2.0","id":1,"result":"0x000000000000000000000000adb3d6b5407858555c59afdfdbc46982fa2f470a"}

Get contract code:

curl 'https://rpcapi.fantom.network/' -X POST -H 'Content-Type: application/json' --data '{"jsonrpc":"2.0", "id":1, "method":"eth_getCode", "params": ["0xadb3d6b5407858555c59afdfdbc46982fa2f470a", "latest"]}'

{"jsonrpc":"2.0","id":1,"result":"0x6080604052600436106103555760003560e01c80637cacb...a94e61db7659872453664736f6c63430005110032"}

Matches (except of footer) with "deployedBytecode" of tag release/3.0.5-rc.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment