Skip to content

Commit

Permalink
chore: change error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Schlagonia committed Oct 2, 2023
1 parent 83dfff2 commit f68ed1f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions contracts/VaultV3.vy
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ def _deposit(sender: address, recipient: address, assets: uint256) -> uint256:
# Issue the corresponding shares for assets.
shares: uint256 = self._issue_shares_for_amount(assets, recipient)

assert shares > 0, "ZERO_SHARES"
assert shares > 0, "cannot mint zero"

log Deposit(sender, recipient, assets, shares)
return shares
Expand All @@ -597,7 +597,7 @@ def _mint(sender: address, recipient: address, shares: uint256) -> uint256:

assets: uint256 = self._convert_to_assets(shares, Rounding.ROUND_UP)

assert assets > 0, "ZERO_ASSETS"
assert assets > 0, "cannot deposit zero"
assert self._total_assets() + assets <= self.deposit_limit, "ERC4626: mint more than max"

# Transfer the tokens to the vault first.
Expand Down Expand Up @@ -668,7 +668,7 @@ def _redeem(
shares: uint256 = shares_to_burn
shares_balance: uint256 = self.balance_of[owner]

assert shares > 0, "ZERO_SHARES"
assert shares > 0, "no shares to redeem"
assert shares_balance >= shares, "insufficient shares to redeem"

if sender != owner:
Expand Down Expand Up @@ -1443,7 +1443,7 @@ def buy_debt(strategy: address, amount: uint256):
# due to strategy issues so won't rely on its conversion rates.
shares: uint256 = IStrategy(strategy).balanceOf(self) * _amount / current_debt

assert shares > 0, "can't buy 0"
assert shares > 0, "cannot buy zero"

self._erc20_safe_transfer_from(ASSET.address, msg.sender, self, _amount)

Expand Down
6 changes: 3 additions & 3 deletions tests/unit/vault/test_profit_unlocking.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ def test_gain_no_fees_with_refunds_no_buffer(
assert asset.balanceOf(fish) == fish_amount + first_profit + total_refunds

# Accountant redeems shares
with reverts("ZERO_SHARES"):
with reverts("no shares to redeem"):
vault.redeem(
vault.balanceOf(accountant), accountant, accountant, sender=accountant
)
Expand Down Expand Up @@ -421,7 +421,7 @@ def test_gain_no_fees_with_refunds_with_buffer(
)

# Accountant redeems shares
with reverts("ZERO_SHARES"):
with reverts("no shares to redeem"):
vault.redeem(
vault.balanceOf(accountant), accountant, accountant, sender=accountant
)
Expand Down Expand Up @@ -1629,7 +1629,7 @@ def test_loss_no_fees_with_refunds_with_buffer(
)

# Accountant redeems shares
with reverts("ZERO_SHARES"):
with reverts("no shares to redeem"):
vault.redeem(
vault.balanceOf(accountant), accountant, accountant, sender=accountant
)
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/vault/test_shares.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def test_deposit__with_zero_funds__reverts(fish, asset, create_vault):
vault = create_vault(asset)
amount = 0

with ape.reverts("ZERO_SHARES"):
with ape.reverts("cannot mint zero"):
vault.deposit(amount, fish.address, sender=fish)


Expand Down Expand Up @@ -111,7 +111,7 @@ def test_mint__with_zero_funds__reverts(fish, asset, create_vault):
vault = create_vault(asset)
shares = 0

with ape.reverts("ZERO_ASSETS"):
with ape.reverts("cannot deposit zero"):
vault.mint(shares, fish.address, sender=fish)


Expand Down Expand Up @@ -218,7 +218,7 @@ def test_withdraw__with_no_shares__reverts(fish, asset, create_vault):
vault = create_vault(asset)
shares = 0

with ape.reverts("ZERO_SHARES"):
with ape.reverts("no shares to redeem"):
vault.withdraw(shares, fish.address, fish.address, sender=fish)


Expand Down Expand Up @@ -345,7 +345,7 @@ def test_redeem__with_no_shares__reverts(fish, asset, create_vault):
vault = create_vault(asset)
amount = 0

with ape.reverts("ZERO_SHARES"):
with ape.reverts("no shares to redeem"):
vault.withdraw(amount, fish.address, fish.address, sender=fish)


Expand Down

0 comments on commit f68ed1f

Please sign in to comment.