From 4448db3b8116a5400563cdbda371e44147721449 Mon Sep 17 00:00:00 2001 From: Taylor Brent Date: Mon, 28 Oct 2024 17:21:41 -0700 Subject: [PATCH] use uint192 --- contracts/p0/RToken.sol | 6 +++--- contracts/p1/RToken.sol | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/contracts/p0/RToken.sol b/contracts/p0/RToken.sol index b987341cc..bcc7c9f28 100644 --- a/contracts/p0/RToken.sol +++ b/contracts/p0/RToken.sol @@ -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; @@ -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; } diff --git a/contracts/p1/RToken.sol b/contracts/p1/RToken.sol index 343f4990b..1c81c3b41 100644 --- a/contracts/p1/RToken.sol +++ b/contracts/p1/RToken.sol @@ -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 @@ -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; }