Concordium / concordium-smart-contract-tools

Tools for building, deploying, and interacting with smart contracts
Apache License 2.0
2 stars 8 forks source link

Implement workspace feature to compile, build and deploy multiple contracts #157

Open dhruvja opened 7 months ago

dhruvja commented 7 months ago

Description For building multiple contracts, we need to write a script to build multiple programs and maintain a file to manually maintain contract address of each program.

Solution We could have a config file for concordium in the root level with the workspace members and also storing the contract address of the deployed programs in the file. The config file can be thought as an extension of the workspace feature of cargo which can be utilized in building and deploying multiple contracts.

The config file and workspace is heavily inspired by the Anchor framework from solana. Example: https://github.com/coral-xyz/anchor/blob/2f552a17f5e4cb0f5b075240c2645b6485e59752/docs/src/pages/docs/manifest.md?plain=1#L4

abizjak commented 7 months ago

Hi @dhruvja and thank you for the input.

I am not really sure what you are suggesting here. I don't think an SDK is the place for such configuration files, these would typically be for configuring a tool such as cargo-concordium.

At present cargo-concordium does not have any deployment features, but that has been discussed in the past and would make sense, but has never been a high priority.

With regards to building multiple contracts in a workspace automatically, or a subset of the workspace, that makes sense as well.

Maybe you can elaborate on what workflow you would ideally want, so we can best see which components and features best support it.

dhruvja commented 7 months ago

Yes sorry, i meant it for the cli app anyways. But i was wondering if we can have a manifest which can manage the programs in the workspace. Ideally this is what i would like.

abizjak commented 7 months ago

I think this generally makes sense, however this is a major new addition to cargo-concordium that overlaps a bit in features with some things we already have solved with deploy scripts.

So we need some thinking about the best design for this, also taking into account the testing library and cargo concordium test which would ideally be aware of this.

I think it's good input.

FYI I'm transferring the issue to concordium-smart-contract-tools repository since that is more appropriate for it.

target-san commented 2 months ago

Second on this issue. It's a bit annoying that verified contract must be completely isolated to build. You can't reference other contracts from workspace or even just put it into workspace for shared dependencies versioning.