Skip to content

Commit

Permalink
Fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
toninorair committed Oct 31, 2024
1 parent 923e903 commit 1092d8b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Portal.sol
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ abstract contract Portal is NttManagerNoRateLimiting, IPortal {
emit MTokenSent(destinationChainId_, messageId_, sender_, recipient_, untrimmedAmount_, index_);
}

/// @dev Hook that is called before cross-chain transfer
/// @dev Hook that is called before sending M tokens via cross-chain transfer
function _beforeTokenSent(uint256 amount_) internal virtual {}

/// @dev Hook that is called before receiving M tokens
/// @dev Hook that is called after receiving M tokens via cross-chain transfer
function _afterTokenReceived(uint256 amount_) internal virtual {}

/// @dev Handles token transfer with an additional payload and custom payload types on the destination.
Expand Down
4 changes: 2 additions & 2 deletions src/SpokePortal.sol
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,14 @@ contract SpokePortal is ISpokePortal, Portal {
}
}

/// @dev Decreases `outstandingPrincipal` to allow calculations of HubPortal's `excess` of M token.
/// @dev Decreases `outstandingPrincipal` after transfer out to track maximum possible M principal of earners on the Spoke Portal..
function _beforeTokenSent(uint256 amount_) internal override {
unchecked {
outstandingPrincipal -= IndexingMath.getPrincipalAmountRoundedDown(amount_.safe240(), _currentIndex());
}
}

/// @dev Increases `outstandingPrincipal` to account for icreasing priallow calculations of HubPortal's `excess` of M token.
/// @dev Increases `outstandingPrincipal` after transfer in to track maximum possible M principal of earners on the Spoke Portal.
function _afterTokenReceived(uint256 amount_) internal override {
unchecked {
outstandingPrincipal += IndexingMath.getPrincipalAmountRoundedDown(amount_.safe240(), _currentIndex());
Expand Down
6 changes: 4 additions & 2 deletions src/interfaces/ISpokePortal.sol
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@ interface ISpokePortal is IPortal {

/* ============ View/Pure Functions ============ */

/// @notice The maximum earning principal of the total bridged amount, used for calculations of yield excess of the Hub Portal
/// @notice The maximum possible principal of the total bridged-in M tokens,
/// it will be used for calculations of excess of M yield in the Hub Portal.
function outstandingPrincipal() external view returns (uint112);

/// @notice The excess of M token on the Hub accumulated due to index propagation delays
/// @notice The excess of M yield in the Hub Portal contributed by the Spoke Portal,
/// total Hub Portal M yield excess equals to sum of all Spoke Portal M excesses.
function excess() external view returns (uint240);
}

0 comments on commit 1092d8b

Please sign in to comment.