Skip to content

Commit

Permalink
removed unneeded supply check
Browse files Browse the repository at this point in the history
  • Loading branch information
iChristwin committed Feb 1, 2025
1 parent ce4ffa7 commit cc855f9
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/Solaxy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,10 @@ contract Solaxy is ISolaxy, ERC20Permit, ReentrancyGuard {

RESERVE.safeTransferFrom(msg.sender, address(this), assets);
_mint(receiver, shares);

if (totalAssets() != initialAssets + assets || totalSupply() != initialShares + shares) {
revert InconsistentBalances();
}

emit Deposit(msg.sender, receiver, assets, shares);
}

Expand All @@ -273,17 +273,16 @@ contract Solaxy is ISolaxy, ERC20Permit, ReentrancyGuard {
private
nonReentrant
{
if (totalAssets() < assets || totalSupply() < shares) revert Undersupply();
(uint256 initialAssets, uint256 initialShares) = (totalAssets(), totalSupply());
RESERVE.safeTransfer(receiver, assets);

if (msg.sender != owner) _spendAllowance(owner, msg.sender, shares + tip);
RESERVE.safeTransfer(receiver, assets);
_burn(owner, shares);
_transfer(owner, tipAccount(), tip);
_burn(owner, shares);

if (totalAssets() != initialAssets - assets || totalSupply() != initialShares - shares) {
revert InconsistentBalances();
}

emit Withdraw(msg.sender, receiver, owner, assets, shares);
}

Expand Down

0 comments on commit cc855f9

Please sign in to comment.