Brushfam / openbrush-contracts

https://openbrush.io
MIT License
25 stars 11 forks source link

All traits are loaded into end-user project #169

Open Artemka374 opened 1 year ago

Artemka374 commented 1 year ago

The OpenBrush library uses Rust features to allow users to selectively integrate contracts and modules into their codebases, thereby only importing the contracts they need. However, the system operates differently for traits. Traits are not governed by features and are loaded automatically. This means that regardless of the features chosen by the end user, all traits get loaded. This leads to unnecessary overhead at compilation time, especially for trait-related macros ( trait_definition and wrapper ). Moreover, metadata files are produced for all traits, even for contracts that are not utilized in the user's project. Reorganize the traits folder so that the traits within also use Rust features . This ensures that only relevant traits, those corresponding to the contracts users have integrated from the library, are loaded into user codebases.