-
Notifications
You must be signed in to change notification settings - Fork 91
/
CreditRedemptionCalculatorFacet.sol
42 lines (37 loc) · 1.34 KB
/
CreditRedemptionCalculatorFacet.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
import "../../dollar/interfaces/ICreditRedemptionCalculator.sol";
import {Modifiers} from "../libraries/LibAppStorage.sol";
import {LibCreditRedemptionCalculator} from "../libraries/LibCreditRedemptionCalculator.sol";
/// @notice Contract facet for calculating amount of Credits to mint on Dollars burn
contract CreditRedemptionCalculatorFacet is
Modifiers,
ICreditRedemptionCalculator
{
/**
* @notice Sets the `p` param in the Credit mint calculation formula:
* `y = x * ((BlockDebtStart / BlockBurn) ^ p)`
* @param coef New `p` param in wei
*/
function setConstant(uint256 coef) external onlyIncentiveAdmin {
LibCreditRedemptionCalculator.setConstant(coef);
}
/**
* @notice Returns the `p` param used in the Credit mint calculation formula
* @return `p` param
*/
function getConstant() external view returns (uint256) {
return LibCreditRedemptionCalculator.getConstant();
}
/// @inheritdoc ICreditRedemptionCalculator
function getCreditAmount(
uint256 dollarsToBurn,
uint256 blockHeightDebt
) external view override returns (uint256) {
return
LibCreditRedemptionCalculator.getCreditAmount(
dollarsToBurn,
blockHeightDebt
);
}
}