Best way to turn a solidity contract as a string into bytecode #4335
Unanswered
roninjin10
asked this question in
Help
Replies: 0 comments
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.
Uh oh!
There was an error while loading. Please reload this page.
-
I am building a tool that allows one to use forge scripts in their javascript similar to how one would write graphql queries or mutations in a template string
To implement this I have a babel plugin parsing these template strings. My question is what is the best way to take this contract string in memory and turn it into bytecode? Looking through the forge cli docs I don't see any way to go straight from string to byte code.
I was thinking I need to create a forge project in a temp directory and temporarily write the file but that feels hacky, potentially slow as this scales, and like there must be a better way
edit: so my solution so far is to write to a tempdir https://github.com/roninjin10/stax/blob/main/packages/babel-plugin-sol/src/index.ts#L130 . I would prefer to not have to use file system if possible though.
Beta Was this translation helpful? Give feedback.
All reactions