concordium-rust-smart-contracts icon indicating copy to clipboard operation
concordium-rust-smart-contracts copied to clipboard

Investigate smart contract components

Open limemloh opened this issue 9 months ago • 0 comments

Investigate how to introduce composable framework for smart contract development in Rust. Currently, the approach for smart contract development is to copy code from several of our examples, if you need an upgradable smart contract you copy from one example, if you need to restrict access on some endpoints you might need the code from another example. We could take inspiration from the rust crate tower.

Examples of components:

  • Admins Holds a list of address which have admin rights. Creates endpoints for managing admins. Must know which endpoints to authorize sender on.
  • Roles Extension of Admins to include roles for each address.
  • Freezeable/Pausable Create endpoint for (un)freezing contract. Must know which endpoints to freeze. - Upgradable Create endpoint for upgrading contract.
  • CIS-2 Create endpoints require by CIS2. Takes some simpler implementation. Add middleware for each endpoint. Add middleware for all the queries Add middleware for all the mutable functions
  • CIS-2 receive tokens Create an endpoint for receiving CIS2. Add middleware.
  • CIS-0 Create endpoint required by CIS0. Create endpoints for managing implementors.
  • ReentrancyGuard Middleware which reject on reentrancy.

limemloh avatar May 16 '24 12:05 limemloh