Skip to content

Commit

Permalink
Revert "chore: Minor LiquidStone 90 day test cleanup"
Browse files Browse the repository at this point in the history
This reverts commit 5cd9f52.
  • Loading branch information
lucasia committed Dec 3, 2024
1 parent 5cd9f52 commit cb2e428
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 4 deletions.
24 changes: 24 additions & 0 deletions packages/contracts/src/timelock/ITimelockOpenEnded.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

/**
* @title ITimelockOpenEnded
* @dev Interface for managing open-ended token locks with multiple deposit periods.
* Tokens are locked indefinitely, but associated with specific deposit periods for tracking.
*/
interface ITimelockOpenEnded {
error ITimelockOpenEnded__ExceededMaxUnlock(address account, uint256 amount, uint256 maxUnlock);

/// @notice Locks `amount` of tokens for `account` at the given `depositPeriod`.
function lock(address account, uint256 depositPeriod, uint256 amount) external;

/// @notice Unlocks `amount` of tokens for `account` from the given `depositPeriod`.
function unlock(address account, uint256 depositPeriod, uint256 amount) external;

/// @notice Returns the amount of tokens locked for `account` at the given `depositPeriod`.
/// MUST always be the total amount locked, even if some locks are unlocked
function lockedAmount(address account, uint256 depositPeriod) external view returns (uint256 lockedAmount_);

/// @notice Returns the amount of tokens locked for `account` at the given `depositPeriod`.
function unlockedAmount(address account, uint256 depositPeriod) external view returns (uint256 unlockedAmount_);
}
24 changes: 20 additions & 4 deletions packages/contracts/test/src/LiquidStoneTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ contract DeployLiquidStone is DeployLiquidMultiTokenVault {
LiquidContinuousMultiTokenVault.VaultParams memory vaultParams =
super._createVaultParams(vaultAuth, asset, yieldStrategy, redeemOptimizer);

uint256 scale = 10 ** asset.decimals();
vaultParams.contextParams.tenor = 90;
vaultParams.redeemNoticePeriod = 0;
vaultParams.contextParams.fullRateScaled = 10 * scale;
vaultParams.contextParams.initialReducedRate.interestRate = 0; // zero for less than tenor

// reduced rate as 0
vaultParams.contextParams.initialReducedRate.interestRate = 0;

return vaultParams;
}
Expand All @@ -55,7 +55,23 @@ contract LiquidStoneTest is LiquidContinuousMultiTokenVaultTestBase {
assertEq(90, _liquidVault.TENOR(), "tenor incorrect");
}

// TODO - need to implement and test for RetainedAssetsReceive1APY
function test__LiquidStoneTest__SimpleDepositAndRedeem() public {
(TestParamSet.TestUsers memory depositUsers, TestParamSet.TestUsers memory redeemUsers) =
_createTestUsers(alice);
TestParamSet.TestParam[] memory testParams = new TestParamSet.TestParam[](1);
testParams[0] = TestParamSet.TestParam({ principal: 100 * _scale, depositPeriod: 0, redeemPeriod: 5 });

uint256[] memory sharesAtPeriods = _testDepositOnly(depositUsers, _liquidVault, testParams);
_testRedeemOnly(redeemUsers, _liquidVault, testParams, sharesAtPeriods);
}

function test__LiquidStoneTest__RedeemAtTenor() public {
testVaultAtOffsets(
alice,
_liquidVault,
TestParamSet.TestParam({ principal: 25 * _scale, depositPeriod: 0, redeemPeriod: _liquidVault.TENOR() })
);
}

function test__LiquidStoneTest__RedeemFullTenor() public {
uint256 depositPeriod = 5;
Expand Down

0 comments on commit cb2e428

Please sign in to comment.