-
Notifications
You must be signed in to change notification settings - Fork 85
Refactor / Organize Scripts #74
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
base: main
Are you sure you want to change the base?
Conversation
I wanted to share a little bit about why we decided to way the way it is:
I'm open to ideas if you have any, for utilities to be included in one place or another. For example, will push the |
Hey @akshatmittal thanks for the insight. Like I said feel free to close if it does not fit the spec internally, I simply shared it because I spent some time rewriting it for our own needs and it felt much better using so maybe there could at minimum be some ideas provided for future iterations. Through your rewrite, things definitely are moving in a better direction and I know a lot of work was put into it. In response to the points provided though, I do have some counter points:
2 is great, let me know if any help is needed in the process!
As this repo grows, please take into consideration how other widely-used templates in other fields are used. For example |
I'm not normally one to drop large rewrites, but I had a bit of a vision for this. It may be somewhat opinionated, feel free to close if it's too extensive.
Using the scripts within the template, I'm finding myself adding a lot of code to BaseScript to make things work and it gets bloated and confusing pretty quick. What I'm suggesting in this PR is to break things up into much smaller, logical bits, which can then be combined in any manner in an "orchestrator" script to meet whatever needs a consumer may have. I feel this provides the tools to build off of this template much more easily, and it feels much less "locked in". Instead of having to modify the code we provide in the template, it enables consumers to extend it.
As an additional point, this runs much more easily on a local anvil test network, and examples run out-of-the-box with no configuration (I couldn't get anvil working with the current scripts).
What's changed
base/
actions/
which contains libraries of the same basic functionalities (get dependent contract addresses, create mock tokens, mine / deploy hooks contract, create pool and add liquidity OR create pool only OR add liquidity only, perform swap.examples/
which contains "orchestrator" scripts showing how to make the building blocks work together for the basic tasks a consumer may need to perform.By doing this, a consumer can much more easily drop a new file like
script/MyScript.s.sol
and simply import the pieces they need to test or launch their project.For me, personally, I did this because I use this repo for a lot of scripting done in ts or rust, and it enables me to do so without having to change as many hardcoded values. I figured if I'm doing it, there's at least one other person doing the same so maybe it'd be useful.
Let me know if you have questions or feedback. Thanks!