Skip to content
This repository has been archived by the owner on Jan 18, 2023. It is now read-only.

Performance Fee Calculator Adjust Fee Fix and Scenario Tests #637

Merged
merged 11 commits into from
May 20, 2020

Conversation

felix2feng
Copy link
Contributor

No description provided.

@coveralls
Copy link

coveralls commented May 17, 2020

Pull Request Test Coverage Report for Build 8124

  • 6 of 6 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 8096: 0.0%
Covered Lines: 1726
Relevant Lines: 1726

💛 - Coveralls

uint256 rebalancingSetValue = SetUSDValuation.calculateRebalancingSetValue(msg.sender, oracleWhiteList);

feeState[msg.sender].lastProfitFeeTimestamp = block.timestamp;
feeState[msg.sender].highWatermark = rebalancingSetValue;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be checked to make sure its higher than the previous high watermark. We don't want to reduce the high watermark by accident

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch

// Thus, we need to reset the high water mark here so that users do not pay for profit fees
// since inception.
uint256 rebalancingSetValue = SetUSDValuation.calculateRebalancingSetValue(msg.sender, oracleWhiteList);
uint256 existingHighwatermark = feeState[msg.sender].highWatermark;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why put this into its own variable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thought it would be more clear

@felix2feng felix2feng changed the title Performance Fee Calculator Adjust Fee Fix [WIP]Performance Fee Calculator Adjust Fee Fix and Tests May 19, 2020
@felix2feng felix2feng force-pushed the felix/per-fee-adjust-fee-patch branch from 30c8297 to e9d5ab0 Compare May 19, 2020 22:33
@felix2feng felix2feng changed the title [WIP]Performance Fee Calculator Adjust Fee Fix and Tests [WIP]Performance Fee Calculator Adjust Fee Fix and Scenario Tests May 20, 2020
@felix2feng felix2feng changed the title [WIP]Performance Fee Calculator Adjust Fee Fix and Scenario Tests Performance Fee Calculator Adjust Fee Fix and Scenario Tests May 20, 2020
*
* CHANGELOG:
* - 5/17/2020: Update adjustFee function to update high watermark to prevent unexpected fee actualizations
* when the profitFee was initially 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a note on the new require as well

@@ -258,6 +262,23 @@ contract PerformanceFeeCalculator is IFeeCalculator {
} else {
validateProfitFeePercentage(feePercentage);

// IMPORATNT: In the case that a profit fee is initially 0 and is set to a non-zero number,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMPORTANT

await blockchain.mineBlockAsync();
});

describe('and there is a profit', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think we'd want to test whether the new fee is set here as well

@@ -566,6 +568,109 @@ contract('PerformanceFeeCalculator', accounts => {
expect(feeState.profitFeePercentage).to.be.bignumber.equal(newFeePercentage);
});

describe('when the profit fee is initially 0 and a profit is marked', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think we need the and a profit is marked phrase here since it tests that and the complementary case below

@felix2feng felix2feng merged commit c4aabf1 into master May 20, 2020
@felix2feng felix2feng deleted the felix/per-fee-adjust-fee-patch branch May 20, 2020 23:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants