Skip to content

Commit

Permalink
feat: rename YieldRateTier to RateTier
Browse files Browse the repository at this point in the history
  • Loading branch information
igorsenych-cw committed Oct 28, 2024
1 parent 2cd1c5d commit 926fd03
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
4 changes: 2 additions & 2 deletions contracts/v2/YieldStreamerConfiguration.sol
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ abstract contract YieldStreamerConfiguration is

// Add the tiers to the new yield tiered rate
for (uint256 i = 0; i < tierRates.length; i++) {
newYieldRate.tiers.push(YieldRateTier({ rate: tierRates[i].toUint48(), cap: tierCaps[i].toUint64() }));
newYieldRate.tiers.push(RateTier({ rate: tierRates[i].toUint48(), cap: tierCaps[i].toUint64() }));
}

emit YieldStreamer_YieldTieredRateAdded(groupId, effectiveDay, tierRates, tierCaps);
Expand Down Expand Up @@ -121,7 +121,7 @@ abstract contract YieldStreamerConfiguration is
// Update the tiers of the yield tiered rate
delete rate.tiers;
for (uint256 i = 0; i < tierRates.length; i++) {
rate.tiers.push(YieldRateTier({ rate: tierRates[i].toUint48(), cap: tierCaps[i].toUint64() }));
rate.tiers.push(RateTier({ rate: tierRates[i].toUint48(), cap: tierCaps[i].toUint64() }));
}

emit YieldStreamer_YieldTieredRateUpdated(groupId, itemIndex, effectiveDay, tierRates, tierCaps);
Expand Down
10 changes: 5 additions & 5 deletions contracts/v2/YieldStreamerPrimary.sol
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ abstract contract YieldStreamerPrimary is
struct CompoundYieldParams {
uint256 fromTimestamp;
uint256 toTimestamp;
YieldRateTier[] tiers;
RateTier[] tiers;
uint256 balance;
uint256 streamYield;
}
Expand Down Expand Up @@ -965,13 +965,13 @@ abstract contract YieldStreamerPrimary is
*/
function _calculatePartDayYield(
uint256 amount,
YieldRateTier[] memory tiers,
RateTier[] memory tiers,
uint256 elapsedSeconds
) private pure returns (uint256) {
uint256 remainingAmount = amount;
uint256 totalYield = 0;
uint256 i = 0;
YieldRateTier memory tier;
RateTier memory tier;

do {
if (remainingAmount == 0) {
Expand Down Expand Up @@ -999,11 +999,11 @@ abstract contract YieldStreamerPrimary is
* @param tiers The yield tiers to apply during the calculation period.
* @return The yield accrued during the full day.
*/
function _calculateFullDayYield(uint256 amount, YieldRateTier[] memory tiers) private pure returns (uint256) {
function _calculateFullDayYield(uint256 amount, RateTier[] memory tiers) private pure returns (uint256) {
uint256 remainingAmount = amount;
uint256 totalYield = 0;
uint256 i = 0;
YieldRateTier memory tier;
RateTier memory tier;

do {
if (remainingAmount == 0) {
Expand Down
7 changes: 4 additions & 3 deletions contracts/v2/interfaces/IYieldStreamerTypes.sol
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ interface IYieldStreamerTypes {
*
* Fields:
* - `effectiveDay`: The day index from which this yield rate schedule becomes effective.
* - `tiers`: An array of `YieldRateTier` structs defining the rate tiers.
* - `tiers`: An array of `RateTier` structs defining the rate tiers.
*/
struct YieldTieredRate {
YieldRateTier[] tiers;
RateTier[] tiers;
uint16 effectiveDay;
// uint240 __reserved; // Reserved for future use until the end of the storage slot.
}
Expand All @@ -53,9 +53,10 @@ interface IYieldStreamerTypes {
* - `rate`: The yield rate value (scaled by RATE_FACTOR).
* - `cap`: The maximum balance amount for which this rate applies.
*/
struct YieldRateTier {
struct RateTier {
uint48 rate;
uint64 cap;
// uint144 __reserved; // Reserved for future use until the end of the storage slot.
}

/**
Expand Down

0 comments on commit 926fd03

Please sign in to comment.