Skip to content

Commit

Permalink
use uint192
Browse files Browse the repository at this point in the history
  • Loading branch information
tbrent committed Oct 29, 2024
1 parent 6182ce4 commit 4448db3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions contracts/p0/RToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ contract RTokenP0 is ComponentP0, ERC20PermitUpgradeable, IRToken {
uint192 public constant MAX_THROTTLE_PCT_AMT = 1e18; // {qRTok}
uint192 public constant MIN_EXCHANGE_RATE = 1e9; // D18{BU/rTok}
uint192 public constant MAX_EXCHANGE_RATE = 1e27; // D18{BU/rTok}
uint256 public constant MIN_THROTTLE_DELTA = 25; // {%}
uint192 public constant MIN_THROTTLE_DELTA = 25e16; // {1} 25%

/// Weakly immutable: expected to be an IPFS link but could be the mandate itself
string public mandate;
Expand Down Expand Up @@ -404,9 +404,9 @@ contract RTokenP0 is ComponentP0, ERC20PermitUpgradeable, IRToken {
ThrottleLib.Params memory redemption
) private pure returns (bool) {
uint256 requiredAmtRate = issuance.amtRate +
((issuance.amtRate * MIN_THROTTLE_DELTA) / 100);
((issuance.amtRate * MIN_THROTTLE_DELTA) / FIX_ONE);
uint256 requiredPctRate = issuance.pctRate +
((issuance.pctRate * MIN_THROTTLE_DELTA) / 100);
((issuance.pctRate * MIN_THROTTLE_DELTA) / FIX_ONE);

return redemption.amtRate >= requiredAmtRate && redemption.pctRate >= requiredPctRate;
}
Expand Down
6 changes: 3 additions & 3 deletions contracts/p1/RToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ contract RTokenP1 is ComponentP1, ERC20PermitUpgradeable, IRToken {
uint192 public constant MAX_THROTTLE_PCT_AMT = 1e18; // {qRTok}
uint192 public constant MIN_EXCHANGE_RATE = 1e9; // D18{BU/rTok}
uint192 public constant MAX_EXCHANGE_RATE = 1e27; // D18{BU/rTok}
uint256 public constant MIN_THROTTLE_DELTA = 25; // {%}
uint192 public constant MIN_THROTTLE_DELTA = 25e16; // {1} 25%

/// The mandate describes what goals its governors should try to achieve. By succinctly
/// explaining the RToken's purpose and what the RToken is intended to do, it provides common
Expand Down Expand Up @@ -526,9 +526,9 @@ contract RTokenP1 is ComponentP1, ERC20PermitUpgradeable, IRToken {
ThrottleLib.Params memory redemption
) private pure returns (bool) {
uint256 requiredAmtRate = issuance.amtRate +
((issuance.amtRate * MIN_THROTTLE_DELTA) / 100);
((issuance.amtRate * MIN_THROTTLE_DELTA) / FIX_ONE);
uint256 requiredPctRate = issuance.pctRate +
((issuance.pctRate * MIN_THROTTLE_DELTA) / 100);
((issuance.pctRate * MIN_THROTTLE_DELTA) / FIX_ONE);

return redemption.amtRate >= requiredAmtRate && redemption.pctRate >= requiredPctRate;
}
Expand Down

0 comments on commit 4448db3

Please sign in to comment.