Concordium / concordium-rust-smart-contracts

Libraries and tools for writing and testing smart contracts on Concordium
https://docs.rs/concordium-std/latest/concordium_std/
Mozilla Public License 2.0
57 stars 35 forks source link

Create CIS-0 library and defined all `STANDARD_IDENTIFIER` constants in it #428

Open DOBEN opened 6 months ago

DOBEN commented 6 months ago

Task description

Currently, the CIS-2 library includes types and helper functions for both (CIS-2 and CIS-0). Since some contracts implement only CIS-0, it would be beneficial to have a better separation between the two standards in two libraries.

As part of the CIS-0 library, the CIS0_STANDARD_IDENTIFIER, CIS1_STANDARD_IDENTIFIER, CIS2_STANDARD_IDENTIFIER, ... should be defined to avoid having to define these constants at the top of every smart contract.

Sub-tasks

DOBEN commented 5 months ago

Some benchmarking is needed to compare the different approaches.

A more efficient approach (but requires more refactoring/breaking changes) would likely be to move the CIS2-library and (logic-related for an equivalent CIS0-library) into the concordium-std crate. The reason is that when Rust complies the smart contract project, it can more efficiently optimize the project (smaller module size) when everything lives in one module/library (concordium-std) rather than across several independent crates/code units.