Replies: 3 comments 13 replies
-
Thx for sharing your idea @defido - I like it! The calculation of the contract address is however not so simple. In your case, you wait for the event logs. But this only works if there are events in the contract creation transaction (i.e. there are constructor arguments). If there are none you can't rely on the logs. However, this can be resolved by directly calling the |
Beta Was this translation helpful? Give feedback.
-
I am not sure if I miss-understood this, but I did a test without constructor arguments & it seems to work. I will test more tomorrow, but maybe it does work? |
Beta Was this translation helpful? Give feedback.
-
@defido I've created a PR here that implements the discussed changes. I will review my own code in the coming days again and if ok will merge it. The error handling of different contract addresses is not something I will implement since this can't happen by design (the same contract is deployed with the same arguments across all chains). The |
Beta Was this translation helpful? Give feedback.
-
Here is an idea, feel free to add your input or suggest if you don't like it. I am sure you might have a better idea how to make the code base cleaner. I have written it in JS (tested in JS), although it should work in TS. Some of the colours constants could be put at the top, it could also be refactored to be better.
I have tested on hardhat, BSC, Polygon etc. It should work on all EVM chains. I have used in built terminal colours, instead of an external package for colours. I find the all white of so much information was getting me confused, thus the colours.
FILE LOCATION:
Index.ts
ISSUE:
When deploying to multiple chains, it's easy to get lost on which chain was being deployed to. It's also confusing what the contract address is, as it's never returned, only the hash. There is also times where a contract is deployed and the contract address would be different, possibly due to different constructor inputs, or different byte codes.
IDEA:
Deployment success with number of which deployment it is on
Chain name
Contract Address
TX Hash
Output location (I think this could be removed or the message shortened)
Errors still work as normal in subtasks.
NEXT:
Chain ID
Link to TX URL explorer of the specific chain in the terminal to shorten testing times.
GIST EXAMPLE:
https://gist.github.com/defido/0d251cd6eb106e93a045d28dd0308caa
Beta Was this translation helpful? Give feedback.
All reactions