-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: set native token env var #64
Conversation
const nativeErc20Testing = process.env.CONTRACTS_L1_NATIVE_ERC20_TOKEN_ADDR ? true : false; // if set, we assume user wants to test native erc20 tokens | ||
|
||
let mainWalletPK; | ||
if (nativeErc20Testing) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know is not exactly part of this PR but you could do if (process.env.CONTRACTS_L1_NATIVE_ERC20_TOKEN_ADDR)
and it should work fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it would, but I though that it would be better to declare a shorter variable once, and then use it three times, than calling calling process.env.CONTRACTS_L1_NATIVE_ERC20_TOKEN_ADDR
each time.
try { | ||
return JSON.parse( | ||
fs.readFileSync(configPath, { | ||
encoding: 'utf-8' | ||
}) | ||
); | ||
} catch (e) { | ||
throw e; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me know if I'm overlooking smth, but if you plan to leave the error as is and simply propagate it, you can remove the try/catch
block and keep only the parsing function, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, I'm still confused about some aspects of the language.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* use compatible error codes with the previous version * update hashes
What ❔
Set a native token environment variable:
CONTRACTS_L1_NATIVE_ERC20_TOKEN_ADDR
on native token deployment.Note: with the current implementation, if the previously mentioned env var is set, testing will be done with native token variables.
Why ❔
Prevent user from having to set token related environment variables manually, which is error prone.
Checklist
zk fmt
andzk lint
.