code-423n4 / 2021-11-yaxis-findings

0 stars 0 forks source link

Make global variables of adapters immutable #101

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Handle

0x0x0x

Vulnerability details

Proof of Concept

At YearnVaultAdapter.sol, we have vault, admin and decimals and at YaxisVaultAdapter.sol, we have vault and admin as global variables. They are set at constructor and never changed again. Therefore, it saves gas by making them immutable. It also increases code readibilty, since immutable variables are guaranteed to be constant after constructor.

Tools Used

Manual analysis

Xuefeng-Zhu commented 2 years ago

https://github.com/code-423n4/2021-11-yaxis-findings/issues/37