ChainSafe / foundry-multichain-deploy

9 stars 3 forks source link

Add cli/script to fetch available target chains #17

Open mpetrunic opened 8 months ago

mpetrunic commented 8 months ago

Command should be something like multichain listTargets --source sepolia --env testnet and should return list of domainId, networkName pairs that are available from source chain.

It should implemented method similar to https://github.com/sygmaprotocol/sygma-sdk/blob/main/packages/sdk/src/utils.ts#L118 that uses sygma indexer API and "type=gmp"

stonecharioteer commented 8 months ago

@mpetrunic Should I make a call to the upstream contract to get this information or just output what targets I have in this adapter?

mpetrunic commented 8 months ago

I think you should make a call to our api endpoint (same one linked sdk is using) :)

stonecharioteer commented 8 months ago

Ah okay, since this seems to exist outside of the main tool, can I just write this in any language? Doing it with curl would make it easiest without having to add a chainlink dependency since this is all solidity. I could alternatively write it in Rust, but then that'd introduce a language dependency here that's unnecessary IMO.

mpetrunic commented 8 months ago

But isn't foundry already using rust. I think other foundry packages added cli in rust I think

stonecharioteer commented 8 months ago

Foundry itself is written using Rust, but it encourages using solidity to write any scripts a project would need. This particular command would just be a utility that doesn't need to be in solidity (to avoid oracles), so as long as it's a command the user can run, it could be written in anything. I don't mind writing it in Rust, just that I can't find any example of a utility to a foundry project being written in it. Could you point me to one so I understand how they packaged it?

mpetrunic commented 8 months ago

Indeed, then until forge adds http request cheatcode, you could try to use https://github.com/memester-xyz/surl and foundry's parseJson cheatcodes