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.
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
sectionCurrently the
git
andbranch
entries in thecontracts
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 sectionrepositories
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 thegit
subfolder in thebuildFolder
of the project can be given the name of the named repository instead of a hash.Make
importpaths
definition relative to repositoriesThe
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 therepository
section and should allow to be defined per named repository. Additionally it should be possible to overwrite this is in thecontracts
section of the configuration file per named contract.Add
importmaps
definitionSimilarly to the
importpaths
definition an optionalimportmaps
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 entriesfrom
andto
, wherefrom
refers to a prefix of references to imported contracts in the compiled Solidity contract files (e.g.,@openzeppelin/contracts/
) and theto
path refers to a path inside the repository. This setting will be used by Solang to resolve import references.