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

Refactor distrbiuteProfit #304

Merged
merged 1 commit into from
Dec 30, 2023
Merged

Refactor distrbiuteProfit #304

merged 1 commit into from
Dec 30, 2023

Conversation

bin-57blocks
Copy link
Contributor

  1. Update distProfitToTranches to include first loss cover profits
  2. Move distLossToTranches and distLossRecoveryToTranches out to pool

Fix a bug

Fix failed tests

Move distLossToTranches and distLossRecoveryToTranches from policy to pool
Copy link

height bot commented Dec 30, 2023

Link Height tasks by mentioning a task ID in the pull request title or commit messages, or description and comments with the keyword link (e.g. "Link T-123").

💡Tip: You can also use "Close T-X" to automatically close a task when the pull request is merged.

Copy link
Contributor

@ljiatu ljiatu left a comment

Choose a reason for hiding this comment

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

LGTM % nits

for (uint256 i = 0; i < covers.length; i++) {
if (covers[i] != address(0)) {
_firstLossCovers.push(IFirstLossCover(covers[i]));
} else break;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: why not put this into the termination condition i.e. i < cover.length && covers[i] != address(0)?

}
}

function _distributeProfitForSeniorTranche(
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I would name this _distProfitToSeniorTranche to be consistent.

)
external
returns (
uint256[2] memory profitsForTrancheVault,
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: profitsForTranches?

* @param juniorTotalAssets the total asset amount for junior tranche
* @custom:access Internal function without access restriction. Caller needs to control access
*/
function _calcProfitForFirstLossCovers(
Copy link
Contributor

Choose a reason for hiding this comment

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

Call this _distProditToFirstLossCovers to be consistent?

@@ -11,25 +11,23 @@ import {SENIOR_TRANCHE, JUNIOR_TRANCHE, HUNDRED_PERCENT_IN_BPS} from "./SharedDe
*/
contract RiskAdjustedTranchesPolicy is BaseTranchesPolicy {
/**
* @notice Distributes profit between tranches.
* @dev Ignores solhint warning, it can't be view function because it implements ITranchesPolicy's disProfitToTranches.
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment is no longer accurate, is it?

@wisdant wisdant merged commit f06a8dc into develop Dec 30, 2023
5 checks passed
@wisdant wisdant deleted the refactor-tranche-policy branch December 30, 2023 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants