Skip to content

v2.4.0

Compare
Choose a tag to compare
@rya-sge rya-sge released this 03 May 10:11
· 35 commits to master since this release
23a1e59

Main goals of this release

  • Improve the flexibility of the CMTAT
  • Reduce the actual code size
  • Reduce gas deployment through factory

New architecture for the RuleEngine #250

  • A new function operateOnTransfer is added and used inside the ValidationModule.
  • Contrary to validateTransfer, operateOnTransfer has to be protected by an access control (if not implemented as view or pure)
  • This function can be used to perform operation which modifies the state of the blockchain (storage) by the RuleEngine.
  • The RuleEngine inherits now from IRuleEngine which contains in its interface the function operateOnTransfer + IERC-1404
  • The function validateTransfer is still available to verify a transfer without performing operation. The behavior is the same than with the previous CMTAT version.
  • Add new interfaces IERC1404EnumCode to only contain restriction code, in order to be used in the RuleEngine

SnapshotModule #256

  • Create an interface ICMTATSnapshot with the main public functions to simplify the calls to a contract with a snapshotModule, for example useful for debt payment.
  • Imported by default again since the whole code can no longer be considered as "audited" now
  • Split the snapshotModuleInternal in two parts: one with the inheritance with ERC-20 and the other part with the base function and does not inherit from ERC-20.
    Thus, if we want to build a snapshotModule with the RuleEngine, we can use the base contract to avoid the inheritance with ERC-20.
  • Add twos functions to reduce number of call when computing debt payment
    --SnapshotInfo to get a user's balance and the total supply
    --SnapshotInfoBatch to get several user's balances and the total supply
    --SnapshotInfoBatch to get several user's balances and the total supply for several different times

ERC20BaseModule (Done)
-- Add a function balanceInfo to get the balance for two addresses and the total supply
Useful to perform transfer restriction based on the user's balance.

AuthorizationEngine #254

  • Add the AuthorizationEngine. With that, it is possible to add supplementary check on the functions grantRole and revokeRolewithout modifying the CMTAT.
  • Remove inheritance with AccessControlDefaultAdminRulesUpgradeable, introduces in the version 2.3.1, from OpenZeppelin since this contract is difficult to manage and increases also the smart contract code size.

BurnModule

  • rename forceBurn and forceBurnBatch toburn and burnBatch
  • Add a function burnFrom with a specific role (useful for bridge) for compatibility with CCIP #260
  • Add a function burnAndMint to perform a burn/mint operation atomically.

ValidationModule
Create an internal function _validateTransferByModule which performs check with others module (PauseModule & EnforcementModule)

Gas optimization

  • Add factory contract for deployment with transparent and beacon proxy #259
  • Remove useless init function in internal modules (Done) #237

Other

  • Remove custom approval function #225
  • Upgrade some JS libraries
  • Upgrade OpenZeppelin to the version v5.0.2