Skip to content

Commit

Permalink
Merge branch 'main' into feat/TLC-ExposeVestingScheduleData
Browse files Browse the repository at this point in the history
  • Loading branch information
iamsahu authored Sep 11, 2024
2 parents 5d47334 + fe801e2 commit 840ed9c
Show file tree
Hide file tree
Showing 18 changed files with 18 additions and 127 deletions.
2 changes: 1 addition & 1 deletion contracts/src/Allowlist.1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,6 @@ contract AllowlistV1 is IAllowlistV1, Initializable, Administrable, IProtocolVer
}

function version() external pure returns (string memory) {
return "1.2.0";
return "1.2.1";
}
}
2 changes: 1 addition & 1 deletion contracts/src/CoverageFund.1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,6 @@ contract CoverageFundV1 is Initializable, ICoverageFundV1, IProtocolVersion {
}

function version() external pure returns (string memory) {
return "1.2.0";
return "1.2.1";
}
}
2 changes: 1 addition & 1 deletion contracts/src/ELFeeRecipient.1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ contract ELFeeRecipientV1 is Initializable, IELFeeRecipientV1, IProtocolVersion
}

function version() external pure returns (string memory) {
return "1.2.0";
return "1.2.1";
}
}
2 changes: 1 addition & 1 deletion contracts/src/Firewall.sol
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,6 @@ contract Firewall is IFirewall, IProtocolVersion, Administrable {

/// @inheritdoc IProtocolVersion
function version() external pure returns (string memory) {
return "1.2.0";
return "1.2.1";
}
}
2 changes: 1 addition & 1 deletion contracts/src/OperatorsRegistry.1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,6 @@ contract OperatorsRegistryV1 is IOperatorsRegistryV1, Initializable, Administrab
}

function version() external pure returns (string memory) {
return "1.2.0";
return "1.2.1";
}
}
2 changes: 1 addition & 1 deletion contracts/src/Oracle.1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,6 @@ contract OracleV1 is IOracleV1, Initializable, Administrable, IProtocolVersion {
}

function version() external pure returns (string memory) {
return "1.2.0";
return "1.2.1";
}
}
2 changes: 1 addition & 1 deletion contracts/src/RedeemManager.1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,6 @@ contract RedeemManagerV1 is Initializable, IRedeemManagerV1, IProtocolVersion {
}

function version() external pure returns (string memory) {
return "1.2.0";
return "1.2.1";
}
}
2 changes: 1 addition & 1 deletion contracts/src/River.1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,6 @@ contract RiverV1 is
}

function version() external pure returns (string memory) {
return "1.2.0";
return "1.2.1";
}
}
2 changes: 1 addition & 1 deletion contracts/src/Withdraw.1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ contract WithdrawV1 is IWithdrawV1, Initializable, IProtocolVersion {

/// @inheritdoc IProtocolVersion
function version() external pure returns (string memory) {
return "1.2.0";
return "1.2.1";
}
}
2 changes: 1 addition & 1 deletion contracts/test/Allowlist.1.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,6 @@ contract AllowlistV1Tests is AllowlistV1TestBase {
}

function testVersion() external {
assertEq(allowlist.version(), "1.2.0");
assertEq(allowlist.version(), "1.2.1");
}
}
2 changes: 1 addition & 1 deletion contracts/test/CoverageFund.1.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,6 @@ contract CoverageFundTestV1 is CoverageFundV1TestBase {
}

function testVersion() external {
assertEq(coverageFund.version(), "1.2.0");
assertEq(coverageFund.version(), "1.2.1");
}
}
2 changes: 1 addition & 1 deletion contracts/test/ELFeeRecipient.1.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,6 @@ contract ELFeeRecipientV1Test is ELFeeRecipientV1TestBase {
}

function testVersion() external {
assertEq(feeRecipient.version(), "1.2.0");
assertEq(feeRecipient.version(), "1.2.1");
}
}
2 changes: 1 addition & 1 deletion contracts/test/Firewall.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,6 @@ contract FirewallTests is BytesGenerator, Test {
}

function testVersion() external {
assertEq(riverFirewall.version(), "1.2.0");
assertEq(riverFirewall.version(), "1.2.1");
}
}
2 changes: 1 addition & 1 deletion contracts/test/OperatorsRegistry.1.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3078,6 +3078,6 @@ contract OperatorsRegistryV1TestDistribution is Test {
}

function testVersion() external {
assertEq(operatorsRegistry.version(), "1.2.0");
assertEq(operatorsRegistry.version(), "1.2.1");
}
}
2 changes: 1 addition & 1 deletion contracts/test/Oracle.1.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,6 @@ contract OracleV1Tests is OracleV1TestBase {
}

function testVersion() external {
assertEq(oracle.version(), "1.2.0");
assertEq(oracle.version(), "1.2.1");
}
}
111 changes: 1 addition & 110 deletions contracts/test/RedeemManager.1.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1919,7 +1919,7 @@ contract RedeemManagerV1Tests is RedeeManagerV1TestBase {
}

function testVersion() external {
assertEq(redeemManager.version(), "1.2.0");
assertEq(redeemManager.version(), "1.2.1");
}
}

Expand Down Expand Up @@ -2084,115 +2084,6 @@ contract MockRedeemManagerV1_2 is MockRedeemManagerV1Base {
}
}

contract MockRedeemManagerV2 is MockRedeemManagerV1Base {
function initializeRedeemManagerV1_2(address[] calldata _prevInitiators) external init(1) {
_redeemQueueMigrationV1_2(_prevInitiators);
}

function _redeemQueueMigrationV1_2(address[] memory _prevInitiators) internal {
RedeemQueueV1.RedeemRequest[] memory initialQueue = RedeemQueueV1.get();
RedeemQueueV1_2.RedeemRequest[] memory currentQueue = RedeemQueueV1_2.get(); //TODO: Remove after dev upgrade, not needed for staging/prod
uint256 currentQueueLen = currentQueue.length;
RedeemQueueV2.RedeemRequest[] storage newQueue = RedeemQueueV2.get();

if (currentQueue.length == 0) {
return;
}

//TODO: Remove after dev upgrade, not needed for staging/prod
if (_prevInitiators.length != 7) {
revert IncompatibleArrayLengths();
}

//TODO: Remove after dev upgrade, not needed for staging/prod
for (uint256 i = 0; i < 7;) {
newQueue[i] = RedeemQueueV2.RedeemRequest({
amount: initialQueue[i].amount,
maxRedeemableEth: initialQueue[i].maxRedeemableEth,
recipient: initialQueue[i].recipient,
height: initialQueue[i].height,
initiator: _prevInitiators[i] // Assign the provided initiators
});

unchecked {
++i;
}
}

uint256 heightDeficit = initialQueue[6].height + initialQueue[6].amount;
for (uint256 i = 7; i < currentQueueLen;) {
newQueue[i] = RedeemQueueV2.RedeemRequest({
amount: currentQueue[i].amount,
maxRedeemableEth: currentQueue[i].maxRedeemableEth,
recipient: currentQueue[i].recipient,
height: currentQueue[i].height + heightDeficit,
initiator: currentQueue[i].initiator // Reuse the initiator from the current queue
});

unchecked {
++i;
}
}
}

function getRedeemRequestCount() external view returns (uint256) {
return RedeemQueueV2.get().length;
}

function getRedeemRequestDetails(uint32 _redeemRequestId)
external
view
returns (RedeemQueueV2.RedeemRequest memory)
{
return RedeemQueueV2.get()[_redeemRequestId];
}

function requestRedeem(uint256 _lsETHAmount, address _recipient)
external
onlyRedeemerOrRiver
returns (uint32 redeemRequestId)
{
IRiverV1 river = _castedRiver();
if (IAllowlistV1(river.getAllowlist()).isDenied(_recipient)) {
revert RecipientIsDenied();
}
return _requestRedeem(_lsETHAmount, _recipient);
}

function _requestRedeem(uint256 _lsETHAmount, address _recipient) internal returns (uint32 redeemRequestId) {
LibSanitize._notZeroAddress(_recipient);
if (_lsETHAmount == 0) {
revert InvalidZeroAmount();
}
if (!_castedRiver().transferFrom(msg.sender, address(this), _lsETHAmount)) {
revert TransferError();
}
RedeemQueueV2.RedeemRequest[] storage redeemRequests = RedeemQueueV2.get();
redeemRequestId = uint32(redeemRequests.length);
uint256 height = 0;
if (redeemRequestId != 0) {
RedeemQueueV2.RedeemRequest memory previousRedeemRequest = redeemRequests[redeemRequestId - 1];
height = previousRedeemRequest.height + previousRedeemRequest.amount;
}

uint256 maxRedeemableEth = _castedRiver().underlyingBalanceFromShares(_lsETHAmount);

redeemRequests.push(
RedeemQueueV2.RedeemRequest({
height: height,
amount: _lsETHAmount,
recipient: _recipient,
initiator: msg.sender,
maxRedeemableEth: maxRedeemableEth
})
);

_setRedeemDemand(RedeemDemand.get() + _lsETHAmount);

emit RequestedRedeem(_recipient, height, _lsETHAmount, maxRedeemableEth, redeemRequestId);
}
}

contract InitializeRedeemManagerV1_2Test is RedeeManagerV1TestBase {
address[] public prevInitiators;
address public admin = address(0x123);
Expand Down
2 changes: 1 addition & 1 deletion contracts/test/River.1.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ contract RiverV1Tests is RiverV1TestBase {
}

function testVersion() external {
assertEq(river.version(), "1.2.0");
assertEq(river.version(), "1.2.1");
}

function testOnlyAdminCanSetKeeper() public {
Expand Down
2 changes: 1 addition & 1 deletion contracts/test/Withdraw.1.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,6 @@ contract WithdrawV1Tests is WithdrawV1TestBase {
}

function testVersion() external {
assertEq(withdraw.version(), "1.2.0");
assertEq(withdraw.version(), "1.2.1");
}
}

0 comments on commit 840ed9c

Please sign in to comment.