Theopetra / theo-contracts

1 stars 0 forks source link

TTC-05: skip calculation if previousCirculating_ is zero #138

Closed dreadful-dev closed 2 years ago

dreadful-dev commented 2 years ago

this pr updates this line in sTheopetraERC20 and pTheopetraERC20:

        uint256 rebasePercent = profit_.mul(1e18).div(previousCirculating_);

to:

        uint256 rebasePercent = previousCirculating_ > 0 ? profit_.mul(1e18).div(previousCirculating_) : 0;

to avoid a divide by zero situation.