Skip to content
This repository was archived by the owner on Dec 23, 2024. It is now read-only.

[feat] optimize payouts & transfers #141

Merged
merged 2 commits into from
Feb 22, 2022
Merged

[feat] optimize payouts & transfers #141

merged 2 commits into from
Feb 22, 2022

Conversation

kulkarohan
Copy link
Contributor

No description provided.

(, address feeRecipient) = protocolFeeSettings.moduleFeeSetting(address(this));
_handleOutgoingTransfer(feeRecipient, protocolFee, _payoutCurrency, 0);
// If fee switch off --
if (protocolFee == 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Inspired by ESLint's no-else-return rule and Palantir's TSLint unnecessary-else rule -- since the if block contains a return statement, the else block becomes unnecessary:

Suggested change
if (protocolFee == 0) {
// If fee switch off, return initial amount
if (protocolFee == 0) {
return _amount;
}
// Get fee recipient
(, address feeRecipient) = protocolFeeSettings.moduleFeeSetting(address(this));
// Payout protocol fee
_handleOutgoingTransfer(feeRecipient, protocolFee, _payoutCurrency, 50000);
// Return remaining amount
return _amount - protocolFee;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ty !

@almndbtr almndbtr mentioned this pull request Feb 21, 2022
4 tasks
@kulkarohan kulkarohan merged commit 479e45c into main Feb 22, 2022
@kulkarohan kulkarohan deleted the payouts branch February 22, 2022 00:38
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.

2 participants