Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: performanceFee error (yearn#348)
Browse files Browse the repository at this point in the history
* fix: performanceFee error

* fix: performace fee test

* fix: management fee

* fix: set management fee
zgfzgf authored and steffel committed May 19, 2021
1 parent 20fa5c7 commit 7c3f73d
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions contracts/Vault.vy
Original file line number Diff line number Diff line change
@@ -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)

@@ -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
self.managementFee = fee
log UpdateManagementFee(fee)

10 changes: 5 additions & 5 deletions tests/functional/strategy/test_fees.py
Original file line number Diff line number Diff line change
@@ -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)
@@ -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())

0 comments on commit 7c3f73d

Please sign in to comment.