naddison36 / sol2uml

Solidity contract visualisation tool
MIT License
1.13k stars 268 forks source link

Incorrect storage slots for arrays declared with a constant or expression #74

Open naddison36 opened 2 years ago

naddison36 commented 2 years ago

The TestStorage contract has two examples

    uint256 public constant N_COINS = 3;

    address[N_COINS] coins;
    IERC20[2 * N_COINS] doubleTokens;
    IERC20[N_COINS ** 2] powerTokens;

The coins variable is currently showing as only taking one slot but it actually takes three. The doubleTokens variable is currently showing as only taking one slot but it actually takes six.

Joey139 commented 3 months ago
uint256 public constant N_COINS = 3;

address[N_COINS] coins;
IERC20[2 * N_COINS] doubleTokens;
IERC20[N_COINS ** 2] powerTokens;