diff --git a/contracts/VaultV3.vy b/contracts/VaultV3.vy index af65d12b..4d69d260 100644 --- a/contracts/VaultV3.vy +++ b/contracts/VaultV3.vy @@ -120,8 +120,8 @@ event UpdateAccountant: event UpdateDefaultQueue: new_default_queue: DynArray[address, MAX_QUEUE] -event UpdateOverrideQueue: - override_queue: bool +event UpdateUseDefaultQueue: + use_default_queue: bool event UpdatedMaxDebtForStrategy: sender: indexed(address) @@ -209,8 +209,8 @@ FACTORY: public(immutable(address)) strategies: public(HashMap[address, StrategyParams]) # The current default withdrawal queue. default_queue: public(DynArray[address, MAX_QUEUE]) -# Should custom withdraw queues be overriden -override_queue: public(bool) +# Should the vault use the default_queue regardless whats passed in. +use_default_queue: public(bool) # ERC20 - amount of shares per account balance_of: HashMap[address, uint256] @@ -709,8 +709,8 @@ def _redeem( # Cache the default queue. _strategies: DynArray[address, MAX_QUEUE] = self.default_queue - # If a custom queue was passed, and we dont override it. - if len(strategies) != 0 and not self.override_queue: + # If a custom queue was passed, and we dont force the default queue. + if len(strategies) != 0 and not self.use_default_queue: # Use the custom queue. _strategies = strategies @@ -1239,15 +1239,17 @@ def set_default_queue(new_default_queue: DynArray[address, MAX_QUEUE]): log UpdateDefaultQueue(new_default_queue) @external -def set_override_queue(override_queue: bool): +def set_use_default_queue(use_default_queue: bool): """ - @notice Set a new value for `override_queue`. - @param override_queue New value. + @notice Set a new value for `use_default_queue`. + @dev If set `True` the default queue will always be + used no matter whats passed in. + @param use_default_queue new value. """ self._enforce_role(msg.sender, Roles.QUEUE_MANAGER) - self.override_queue = override_queue + self.use_default_queue = use_default_queue - log UpdateOverrideQueue(override_queue) + log UpdateUseDefaultQueue(use_default_queue) @external def set_deposit_limit(deposit_limit: uint256): diff --git a/tests/unit/vault/test_role_base_access.py b/tests/unit/vault/test_role_base_access.py index 94d82fd8..2a5edca9 100644 --- a/tests/unit/vault/test_role_base_access.py +++ b/tests/unit/vault/test_role_base_access.py @@ -325,9 +325,9 @@ def test_set_default_queue__no_queue_manager__reverts(bunny, vault): vault.set_default_queue([], sender=bunny) -def test_override_queue__no_queue_manager__reverts(bunny, vault): +def test_use_default_queue__no_queue_manager__reverts(bunny, vault): with ape.reverts("not allowed"): - vault.set_override_queue(True, sender=bunny) + vault.set_use_default_queue(True, sender=bunny) def test_set_default_queue__queue_manager(gov, vault, strategy, bunny): @@ -344,7 +344,7 @@ def test_set_default_queue__queue_manager(gov, vault, strategy, bunny): assert vault.get_default_queue() == [] -def test_set_override_queue__queue_manager(gov, vault, strategy, bunny): +def test_set_use_default_queue__queue_manager(gov, vault, strategy, bunny): # We temporarily give bunny the role of DEBT_MANAGER tx = vault.set_role(bunny.address, ROLES.QUEUE_MANAGER, sender=gov) @@ -353,13 +353,13 @@ def test_set_override_queue__queue_manager(gov, vault, strategy, bunny): assert event[0].account == bunny.address assert event[0].role == ROLES.QUEUE_MANAGER - assert vault.override_queue() == False - tx = vault.set_override_queue(True, sender=bunny) + assert vault.use_default_queue() == False + tx = vault.set_use_default_queue(True, sender=bunny) - event = list(tx.decode_logs(vault.UpdateOverrideQueue)) + event = list(tx.decode_logs(vault.UpdateUseDefaultQueue)) assert len(event) == 1 - assert event[0].override_queue == True - assert vault.override_queue() == True + assert event[0].use_default_queue == True + assert vault.use_default_queue() == True # PROFIT UNLOCK MANAGER diff --git a/tests/unit/vault/test_role_permissioned_access.py b/tests/unit/vault/test_role_permissioned_access.py index 53a9f8f4..6c170cd6 100644 --- a/tests/unit/vault/test_role_permissioned_access.py +++ b/tests/unit/vault/test_role_permissioned_access.py @@ -714,9 +714,9 @@ def test_set_default_queue__queue_manager_closed__reverts(bunny, vault): vault.set_default_queue([], sender=bunny) -def test_set_override_queue__queue_manager_closed__reverts(bunny, vault): +def test_set_use_default_queue__queue_manager_closed__reverts(bunny, vault): with ape.reverts("not allowed"): - vault.set_override_queue(True, sender=bunny) + vault.set_use_default_queue(True, sender=bunny) def test_set_default_queue__queue_manager_open(gov, vault, strategy, bunny): @@ -733,7 +733,7 @@ def test_set_default_queue__queue_manager_open(gov, vault, strategy, bunny): assert vault.get_default_queue() == [] -def test_set_override_queue__queue_manager_open(gov, vault, strategy, bunny): +def test_set_use_default_queue__queue_manager_open(gov, vault, strategy, bunny): # We temporarily give bunny the role of DEBT_MANAGER tx = vault.set_open_role(ROLES.QUEUE_MANAGER, sender=gov) @@ -742,13 +742,13 @@ def test_set_override_queue__queue_manager_open(gov, vault, strategy, bunny): assert event[0].role == ROLES.QUEUE_MANAGER assert event[0].status == RoleStatusChange.OPENED - assert vault.override_queue() == False - tx = vault.set_override_queue(True, sender=bunny) + assert vault.use_default_queue() == False + tx = vault.set_use_default_queue(True, sender=bunny) - event = list(tx.decode_logs(vault.UpdateOverrideQueue)) + event = list(tx.decode_logs(vault.UpdateUseDefaultQueue)) assert len(event) == 1 - assert event[0].override_queue == True - assert vault.override_queue() == True + assert event[0].use_default_queue == True + assert vault.use_default_queue() == True def test_set_default_queue__queue_manager_open_then_close__reverts( @@ -777,7 +777,7 @@ def test_set_default_queue__queue_manager_open_then_close__reverts( vault.set_default_queue([], sender=fish) -def test_set_override_queue__queue_manager_open_then_close__reverts( +def test_set_use_default_queue__queue_manager_open_then_close__reverts( gov, vault, strategy, bunny, fish ): # We temporarily give bunny the role of DEBT_MANAGER @@ -788,13 +788,13 @@ def test_set_override_queue__queue_manager_open_then_close__reverts( assert event[0].role == ROLES.QUEUE_MANAGER assert event[0].status == RoleStatusChange.OPENED - assert vault.override_queue() == False - tx = vault.set_override_queue(True, sender=bunny) + assert vault.use_default_queue() == False + tx = vault.set_use_default_queue(True, sender=bunny) - event = list(tx.decode_logs(vault.UpdateOverrideQueue)) + event = list(tx.decode_logs(vault.UpdateUseDefaultQueue)) assert len(event) == 1 - assert event[0].override_queue == True - assert vault.override_queue() == True + assert event[0].use_default_queue == True + assert vault.use_default_queue() == True tx = vault.close_open_role(ROLES.QUEUE_MANAGER, sender=gov) @@ -804,4 +804,4 @@ def test_set_override_queue__queue_manager_open_then_close__reverts( assert event[0].status == RoleStatusChange.CLOSED with ape.reverts("not allowed"): - vault.set_override_queue(False, sender=fish) + vault.set_use_default_queue(False, sender=fish) diff --git a/tests/unit/vault/test_strategy_withdraw.py b/tests/unit/vault/test_strategy_withdraw.py index 6210e0c0..d5446657 100644 --- a/tests/unit/vault/test_strategy_withdraw.py +++ b/tests/unit/vault/test_strategy_withdraw.py @@ -2012,7 +2012,7 @@ def test_withdraw__with_multiple_liquid_strategies_more_assets_than_debt__withdr assert asset.balanceOf(fish) == amount -def test_withdraw__with_custom_queue_and_override_queue__overrides( +def test_withdraw__with_custom_queue_and_use_default_queue__overrides( gov, fish, fish_amount, @@ -2049,7 +2049,7 @@ def test_withdraw__with_custom_queue_and_override_queue__overrides( add_debt_to_strategy(gov, strategy, vault, amount_per_strategy) # Set override to true - vault.set_override_queue(True, sender=gov) + vault.set_use_default_queue(True, sender=gov) # Set queue to opposite of the custom one vault.set_default_queue([second_strategy, first_strategy], sender=gov) @@ -2089,7 +2089,7 @@ def test_withdraw__with_custom_queue_and_override_queue__overrides( assert vault.balanceOf(fish) > 0 -def test_redeem__with_custom_queue_and_override_queue__overrides( +def test_redeem__with_custom_queue_and_use_default_queue__overrides( gov, fish, fish_amount, @@ -2126,7 +2126,7 @@ def test_redeem__with_custom_queue_and_override_queue__overrides( add_debt_to_strategy(gov, strategy, vault, amount_per_strategy) # Set override to true - vault.set_override_queue(True, sender=gov) + vault.set_use_default_queue(True, sender=gov) # Set queue to opposite of the custom one vault.set_default_queue([second_strategy, first_strategy], sender=gov)