Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

TradeModuleV2 and GeneralIndexModuleV2#154

Open
richardliang wants to merge 4 commits intomaster from
richard/rebate-module
Open

TradeModuleV2 and GeneralIndexModuleV2 #154
richardliang wants to merge 4 commits intomaster from
richard/rebate-module

Conversation

@richardliang
Copy link
Contributor

@richardliang richardliang commented Oct 14, 2021
edited
Loading

Code Review Processes

New Feature Review

Before submitting a pull request for new review, make sure the following is done:

README Checks

  • [] README has proper context for the reviewer to understand what the code includes, any important design considerations, and areas to pay more attention to

Code Checks

  • [] Add explanatory comments. If there is complex code that requires specific context or understanding, note that in a comment
  • [] Remove unncessary comments. Any comments that do not add additional context, information, etc. should be removed
  • [] Add javadocs.
  • [] Scrub through the code for inconsistencies (e.g. removing extra spaces)
  • [] Ensure there are not any .onlys in spec files

Broader Considerations

  • [] Ensure variable, function and event naming is clear, consistent, and reflective for the scope of the code.
  • [] Consider if certain pieces of logic should be placed in a different library, module

@richardliang richardliang changed the title (削除) [WIP] - TradeModuleV2 and GeneralIndexModuleV2 (削除ここまで) (追記) TradeModuleV2 and GeneralIndexModuleV2 (追記ここまで) Oct 15, 2021
Copy link
Contributor

bweick commented Oct 21, 2021

Commenting the diff for TradeModule and GeneralIndexModule

internal
returns (uint256 protocolFee, uint256 managerRebate)
{
uint256 totalFeePercentage = controller.getModuleFee(address(this), TRADE_MODULE_V2_TOTAL_FEE_INDEX);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not use:

uint256 totalFees = getModuleFee(TRADE_MODULE_PROTOCOL_FEE_INDEX, _exchangedQuantity);
managerRebate = controller.getModuleFee(address(this), TRADE_MODULE_V2_MANAGER_REBATE_SPLIT_INDEX).preciseMul(totalFees);
protocolFee = totalFees.sub(managerRebate);

I think that way you can be more confident about not having some extra wei sent out due to rounding and you aren't recalculating totalFeePercentage.preciseMul(_exchangedQuantity)

* @param _setToken Instance of the SetToken to update fee recipient
* @param _newRebateRecipient New rebate fee recipient address
*/
function updateFeeRecipient(
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe make this clearer and call it updateRebateRecipient

* @param _setToken Instance of the SetToken to update fee recipient
* @param _newRebateRecipient New rebate fee recipient address
*/
function updateFeeRecipient(
Copy link
Contributor

Choose a reason for hiding this comment

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

Would call this updateRebateRecipient as well

uint256 totalFeePercentage = controller.getModuleFee(address(this), GENERAL_INDEX_MODULE_V2_TOTAL_FEE_INDEX);
uint256 managerRebateSplitPercentage = controller.getModuleFee(address(this), GENERAL_INDEX_MODULE_V2_MANAGER_REBATE_SPLIT_INDEX);

managerRebate = totalFeePercentage.preciseMul(exchangedQuantity).preciseMul(managerRebateSplitPercentage);
Copy link
Contributor

Choose a reason for hiding this comment

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

Would change this math similarly to TradeModuleV2 comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer

@bweick bweick bweick left review comments

Reviewers whose approvals may not affect merge requirements

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /