There are places that do not check if the amount is greater than 0. If the amount is 0 it still performs useless calculations (e.g. adding 0 to the total balance, etc). An example where checking against 0 could save some gas (calls _registerDeposit even when addedHolding is 0):
// no overflow because depositAmount >= extinguishableDebt
uint256 addedHolding = depositAmount - extinguishableDebt;
_registerDeposit(account, token, addedHolding);
or here function _withdrawBond may return 0 when there is a liquidity issue:
Vulnerability details
Gas optimization suggestion:
There are places that do not check if the amount is greater than 0. If the amount is 0 it still performs useless calculations (e.g. adding 0 to the total balance, etc). An example where checking against 0 could save some gas (calls _registerDeposit even when addedHolding is 0): // no overflow because depositAmount >= extinguishableDebt uint256 addedHolding = depositAmount - extinguishableDebt; _registerDeposit(account, token, addedHolding); or here function _withdrawBond may return 0 when there is a liquidity issue:
uint256 withdrawAmount = super._withdrawBond(bondId, bond); disburse(bond.issuer, msg.sender, withdrawAmount);
Eth address
0x523B5b2Cc58A818667C22c862930B141f85d49DD
Handle
paulius.eth
Email address
pauliax6@gmail.com