-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Description
Abstract
I am building a general purpose smart contract library called Compose. @cameel suggested I use free functions instead of Solidity libraries for my particular use case. I think that is a great idea so I refactored Compose to use modules/free files and it works great but there are some small issues I'd appreciate being fixed or clarified.
I'm going to call files that do not generate their own bytecode and that are not meant to be deployed "modules" in this issue. They contain definitions of things that are defined outside any contract or Solidity library.
-
In a Solidity library I can access
address(this)and in a free file/module I cannot. I would like to accessaddress(this)in a module, or in free functions. Rationale: the whole purpose of the free functions I use is to import them and use them in contracts, so it makes sense to give them direct access toaddress(this), without dipping into assembly. -
I cannot import a Solidity module and emit an event directly from it. Issue about that here: ICE when emitting an event via module member access #16314 Note that I can import a Solidity library and emit an event directly from it, but I am trying to replace Solidity libraries.
-
Improved NatSpec documentation for modules. I currently cannot write a NatSpec comment for a constant defined in a module. I can't write a NatSpec comment at the top of the module to document the module itself.
For example I would like to write the following NatSpec comment at the top of the module to document the module:
/**
* @title Diamond Module
* @notice Internal functions and storage for diamond proxy functionality.
* @dev Implements EIP-2535 Diamond Standard
* (https://eips.ethereum.org/EIPS/eip-2535)
*/