Replies: 1 comment 2 replies
-
Hey @mds1, Something that you can do is using the subtasks of |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to write a method that takes a contract address as input, fetches the source code from Etherscan, and uses the returned source code + compiler settings to re-compile the source code with the
storageLayout
flag (and possibly other solc flags) enabled.A sample response from this Etherscan endpoint can be found by querying
https://api.etherscan.io/api?module=contract&action=getsourcecode&address=0xc0Da02939E1441F497fd74F78cE7Decb17B66529&apikey=yourEtherscanApiKey
(make sure to fill in your API key)The source code can be flattened into a single string, and import statements and duplicate pragmas can then be removed. From there, you can save the source code to a temporary file in the
contracts
directory, then the final step is to run the compile task with the settings returned from Etherscan plus any additional settings.That final step is what I'd like to discuss here. @fvictorio mentioned in Discord that there's currently no way to do something like
await run('compile', myCustomSolcSettingsObject)
, so I wanted to get thoughts on the best way to do this. It seems I should be able to import theCompiler
class from here and use that to compile with custom settings, so that's what I'm planning to try next, but would love to hear any other thoughts here!Beta Was this translation helpful? Give feedback.
All reactions