ajna-core icon indicating copy to clipboard operation
ajna-core copied to clipboard

Contract size improvements

Open prateek105 opened this issue 1 year ago • 1 comments

Description

  • Remove the _determineInflatorState method and add the method logic into the Pool contract.
  • Remove the _getCollateralDustPricePrecisionAdjustment method and add the method logic into the ERC20Pool contract.
  • Update the getExchangeRate method visibility in the Buckets library to external as that was only called inside the bucketExchangeRate method in the Pool contract which is a view method.

Purpose

  • PR aims to reduce contract size to accommodate contract changes that may occur in the future.

Impact

  • ERC721 contract size reduced from 24,540B (99.85%) to 24,329B (98.99%).
  • ERC20 contract size reduced from 23,597B (96.01%) to 23,375B (95.11%).

Tasks

  • [x] Changes to protocol contracts are covered by unit tests executed by CI.
  • [x] Protocol contract size limits have not been exceeded.
  • [x] Gas consumption for impacted transactions have been compared with the target branch, and nontrivial changes cited in the Impact section above.
  • [x] Scope labels have been assigned as appropriate.
  • [x] Invariant tests have been manually executed as appropriate for the nature of the change.

prateek105 avatar Dec 20 '23 14:12 prateek105