Skip to content

Latest commit

 

History

History
266 lines (247 loc) · 9.71 KB

RewardHelper.md

File metadata and controls

266 lines (247 loc) · 9.71 KB

The Reward Helper contract. (RewardHelper.sol)

View Source: contracts/mixins/RewardHelper.sol

↗ Extends: State ↘ Derived Contracts: LoanClosingsShared

RewardHelper contract

This contract calculates the reward for rollover transactions.

  • A rollover is a renewal of a deposit. Instead of liquidating a deposit on maturity, you can roll it over into a new deposit. The outstanding principal of the old deposit is rolled over with or without the interest outstanding on it.

Functions


_getRolloverReward

Calculate the reward of a rollover transaction. *

function _getRolloverReward(address collateralToken, address loanToken, uint256 positionSize) internal view
returns(reward uint256)

Arguments

Name Type Description
collateralToken address The address of the collateral token.
loanToken address The address of the loan token.
positionSize uint256 The amount of value of the position. *

Returns

The base fee + the flex fee.

Source Code
function _getRolloverReward(
        address collateralToken,
        address loanToken,
        uint256 positionSize
    ) internal view returns (uint256 reward) {
        uint256 positionSizeInCollateralToken =
            IPriceFeeds(priceFeeds).queryReturn(loanToken, collateralToken, positionSize);
        uint256 rolloverBaseRewardInCollateralToken =
            IPriceFeeds(priceFeeds).queryReturn(
                address(wrbtcToken),
                collateralToken,
                rolloverBaseReward
            );

        return
            rolloverBaseRewardInCollateralToken
                .mul(2) /// baseFee
                .add(positionSizeInCollateralToken.mul(rolloverFlexFeePercent).div(10**20)); /// flexFee = 0.1% of position size
    }

Contracts