Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: performanceFee error #348

Merged
4 commits merged into from
May 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions contracts/Vault.vy
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ def setPerformanceFee(fee: uint256):
@param fee The new performance fee to use.
"""
assert msg.sender == self.governance
assert fee <= MAX_BPS
assert fee <= MAX_BPS / 2
self.performanceFee = fee
log UpdatePerformanceFee(fee)

Expand All @@ -476,7 +476,7 @@ def setManagementFee(fee: uint256):
@param fee The new management fee to use.
"""
assert msg.sender == self.governance
assert fee <= MAX_BPS / 2
assert fee <= MAX_BPS
This conversation was marked as resolved.
Show resolved Hide resolved
self.managementFee = fee
log UpdateManagementFee(fee)

Expand Down
10 changes: 5 additions & 5 deletions tests/functional/strategy/test_fees.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ def test_zero_fees(gov, vault, token, TestStrategy, rewards, strategist, chain):

def test_max_fees(gov, vault, token, TestStrategy, rewards, strategist):
# performance fee should not be higher than MAX
vault.setPerformanceFee(FEE_MAX, {"from": gov})
vault.setPerformanceFee(FEE_MAX / 2, {"from": gov})
with brownie.reverts():
vault.setPerformanceFee(FEE_MAX + 1, {"from": gov})
vault.setPerformanceFee(FEE_MAX / 2 + 1, {"from": gov})

# management fee should not be higher than MAX
vault.setManagementFee(FEE_MAX / 2, {"from": gov})
vault.setManagementFee(FEE_MAX, {"from": gov})

with brownie.reverts():
vault.setManagementFee(FEE_MAX / 2 + 1, {"from": gov})
vault.setManagementFee(FEE_MAX + 1, {"from": gov})

# addStrategy should check for MAX FEE
strategy = strategist.deploy(TestStrategy, vault)
Expand Down Expand Up @@ -104,7 +104,7 @@ def test_gain_less_than_fees(chain, rewards, vault, strategy, gov, token):

# Performance fees higher than 100%
vault.updateStrategyPerformanceFee(strategy, 9000, {"from": gov})
vault.setPerformanceFee(9000, {"from": gov})
vault.setPerformanceFee(5000, {"from": gov})

token.transfer(strategy, 10 ** token.decimals())

Expand Down