Skip to content

Commit

Permalink
address comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
pmckelvy1 committed Sep 24, 2024
1 parent 70b7893 commit e04cb43
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
9 changes: 4 additions & 5 deletions contracts/p0/RToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ contract RTokenP0 is ComponentP0, ERC20PermitUpgradeable, IRToken {
__ERC20Permit_init(name_);

mandate = mandate_;
setRedemptionThrottleParams(redemptionThrottleParams_);
setIssuanceThrottleParams(issuanceThrottleParams_);
setThrottleParams(issuanceThrottleParams_, redemptionThrottleParams_);

issuanceThrottle.lastTimestamp = uint48(block.timestamp);
redemptionThrottle.lastTimestamp = uint48(block.timestamp);
Expand Down Expand Up @@ -350,7 +349,7 @@ contract RTokenP0 is ComponentP0, ERC20PermitUpgradeable, IRToken {
function setThrottleParams(
ThrottleLib.Params calldata issuanceParams,
ThrottleLib.Params calldata redemptionParams
) external governance {
) public governance {
_setIssuanceThrottleParams(issuanceParams);
_setRedemptionThrottleParams(redemptionParams);
require(
Expand All @@ -361,7 +360,7 @@ contract RTokenP0 is ComponentP0, ERC20PermitUpgradeable, IRToken {

// === Private ===

function _setIssuanceThrottleParams(ThrottleLib.Params calldata params) public governance {
function _setIssuanceThrottleParams(ThrottleLib.Params calldata params) private {
require(params.amtRate >= MIN_THROTTLE_RATE_AMT, "issuance amtRate too small");
require(params.amtRate <= MAX_THROTTLE_RATE_AMT, "issuance amtRate too big");
require(params.pctRate <= MAX_THROTTLE_PCT_AMT, "issuance pctRate too big");
Expand All @@ -372,7 +371,7 @@ contract RTokenP0 is ComponentP0, ERC20PermitUpgradeable, IRToken {
}

/// @custom:governance
function _setRedemptionThrottleParams(ThrottleLib.Params calldata params) public governance {
function _setRedemptionThrottleParams(ThrottleLib.Params calldata params) private {
require(params.amtRate >= MIN_THROTTLE_RATE_AMT, "redemption amtRate too small");
require(params.amtRate <= MAX_THROTTLE_RATE_AMT, "redemption amtRate too big");
require(params.pctRate <= MAX_THROTTLE_PCT_AMT, "redemption pctRate too big");
Expand Down
9 changes: 4 additions & 5 deletions contracts/p1/RToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ contract RTokenP1 is ComponentP1, ERC20PermitUpgradeable, IRToken {
furnace = main_.furnace();

mandate = mandate_;
setRedemptionThrottleParams(redemptionThrottleParams_);
setIssuanceThrottleParams(issuanceThrottleParams_);
setThrottleParams(issuanceThrottleParams_, redemptionThrottleParams_);

issuanceThrottle.lastTimestamp = uint48(block.timestamp);
redemptionThrottle.lastTimestamp = uint48(block.timestamp);
Expand Down Expand Up @@ -464,7 +463,7 @@ contract RTokenP1 is ComponentP1, ERC20PermitUpgradeable, IRToken {
function setThrottleParams(
ThrottleLib.Params calldata issuanceParams,
ThrottleLib.Params calldata redemptionParams
) external governance {
) public governance {
_setIssuanceThrottleParams(issuanceParams);
_setRedemptionThrottleParams(redemptionParams);
require(
Expand All @@ -475,7 +474,7 @@ contract RTokenP1 is ComponentP1, ERC20PermitUpgradeable, IRToken {

// === Private Helpers ===

function _setIssuanceThrottleParams(ThrottleLib.Params calldata params) public governance {
function _setIssuanceThrottleParams(ThrottleLib.Params calldata params) private {
require(params.amtRate >= MIN_THROTTLE_RATE_AMT, "issuance amtRate too small");
require(params.amtRate <= MAX_THROTTLE_RATE_AMT, "issuance amtRate too big");
require(params.pctRate <= MAX_THROTTLE_PCT_AMT, "issuance pctRate too big");
Expand All @@ -486,7 +485,7 @@ contract RTokenP1 is ComponentP1, ERC20PermitUpgradeable, IRToken {
}

/// @custom:governance
function _setRedemptionThrottleParams(ThrottleLib.Params calldata params) public governance {
function _setRedemptionThrottleParams(ThrottleLib.Params calldata params) private {
require(params.amtRate >= MIN_THROTTLE_RATE_AMT, "redemption amtRate too small");
require(params.amtRate <= MAX_THROTTLE_RATE_AMT, "redemption amtRate too big");
require(params.pctRate <= MAX_THROTTLE_PCT_AMT, "redemption pctRate too big");
Expand Down

0 comments on commit e04cb43

Please sign in to comment.