pendulum-chain / wasm-deploy

A tool to deploy an ensemble of wasm smart contracts to Pendulum
GNU General Public License v3.0
2 stars 1 forks source link

Improve the configuration file handling #20

Closed TorstenStueber closed 1 year ago

TorstenStueber commented 1 year ago

The config file usage should be improved in multiple ways.

Validate

Validation whether the config file is correctly structured. This can be done, e.g., through the npm module fefe, which allows to automatically deduct the TS types from the validation function.

Add repositories section

Currently the git and branch entries in the contracts part of the configuration need to be repeated in every entry. This requires code duplication if multiple contracts refer to the same git repository and branch (as is the case for Nabla). Instead a new section repositories should be added to the configuration file where repositories (e.g., git repository/branch combination) can be named and only be defined once and the contracts will then refer to these named repositories. This also has the advantage that the git subfolder in the buildFolder of the project can be given the name of the named repository instead of a hash.

Make importpaths definition relative to repositories

The importpaths section should not refer to the local file path structure but to file paths in any of the named repositories. Therefore this setting should be moved to the repository section and should allow to be defined per named repository. Additionally it should be possible to overwrite this is in the contracts section of the configuration file per named contract.

Add importmaps definition

Similarly to the importpaths definition an optional importmaps definition should be added that can be defined per named repository (and overwritten per named contract). If specified it should consist of an array of object with entries from and to, where from refers to a prefix of references to imported contracts in the compiled Solidity contract files (e.g., @openzeppelin/contracts/) and the to path refers to a path inside the repository. This setting will be used by Solang to resolve import references.