15,000 USDC
View results
Submission Details
Severity: gas
Valid

`DSCEngine` should deploy its own `DecentralizedStableCoin`

Summary

DSCEngine should deploy its own DecentralizedStableCoin instead of accepting an address upon construction.

Vulnerability Details

There is a perfect 1:1 correspondence between DSCEngine and DecentralizedStableCoin:

  • DSCEngine tracks a single, immutable i_dsc address.

  • DecentralizedStableCoin has a single owner with the power to mint() and burn() tokens.

Therefore, it is needless to deploy the DecentralizedStableCoin prior to deployment of a DSCEngine and only serves to add extra steps to the process, including migration of the owner.

Impact

Unnecessary gas/deployment UX burden.

Tools Used

Manual review.

Recommendations

Consider changing the DSCEngine constructor like this:

- i_dsc = DecentralizedStableCoin(dscAddress);
+ i_dsc = new DecentralizedStableCoin();

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.