unionlabs / union

The trust-minimized, zero-knowledge bridging protocol, designed for censorship resistance, extremely high security, and usage in decentralized finance.
https://union.build
Apache License 2.0
378 stars 32 forks source link

Structure smartcontract directory #195

Open KaiserKarel opened 1 year ago

KaiserKarel commented 1 year ago

I think it'd be good to structure our smartcontracts like so:

...
contracts
    - src
        ibc-sol
           ibc.sol
           ibc-sol.nix
           ...
        ethereum-wasm
           src
           Cargo.lock
           ...
    - ethereum
           ethereum.nix
    - union
           union.nix
...
flake.nix

The contracts/src directory contains directories with actual contracts The contracts/{chain} directories contain nix files for uploading all contracts to a chain/upgrading etc. So to perform a full deploy on Union, run union.nix with some args, which will build a variety of contracts from src and deploy them.

aeryz commented 1 year ago

isn't having the contracts under specific platforms is cleaner? I mean solidity contracts under contracts/ethereum and cosmwasm contracts under contracts/union. Because contracts/src will get more mixed when we introduce other platforms as well.

KaiserKarel commented 1 year ago

I personally dislike organizing code by what language it's written in, and prefer doing it by what domain (same as when writing a webserver, instead of a models and controllers directory, organize code by domain). I also don't mind having directories with the target deployment, and a src directory for when we share stuff.

Regarding adding more platforms, there really is only the EVM, cosmwasm and perhaps solana for this year.