Skip to content

Commit

Permalink
chore: Minor update to LiquidStoneNinetyDay test
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasia committed Dec 3, 2024
1 parent cb2e428 commit f3414f4
Showing 1 changed file with 10 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { DeployLiquidMultiTokenVault } from "@script/DeployLiquidMultiTokenVault

import { IERC20Metadata } from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";

contract DeployLiquidStone is DeployLiquidMultiTokenVault {
contract DeployLiquidStoneNinetyDay is DeployLiquidMultiTokenVault {
function _createVaultParams(
LiquidContinuousMultiTokenVault.VaultAuth memory vaultAuth,
IERC20Metadata asset,
Expand All @@ -24,21 +24,21 @@ 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;

// reduced rate as 0
vaultParams.contextParams.initialReducedRate.interestRate = 0;
vaultParams.contextParams.fullRateScaled = 10 * scale;
vaultParams.contextParams.initialReducedRate.interestRate = 0; // zero for less than tenor

return vaultParams;
}
}

contract LiquidStoneTest is LiquidContinuousMultiTokenVaultTestBase {
contract LiquidStoneNinetyDayTest is LiquidContinuousMultiTokenVaultTestBase {
using TestParamSet for TestParamSet.TestParam[];

function setUp() public virtual override {
DeployLiquidMultiTokenVault _deployVault = new DeployLiquidStone();
DeployLiquidMultiTokenVault _deployVault = new DeployLiquidStoneNinetyDay();
_liquidVault = _deployVault.run(_vaultAuth);

// warp to a "real time" time rather than block.timestamp=1
Expand All @@ -51,29 +51,13 @@ contract LiquidStoneTest is LiquidContinuousMultiTokenVaultTestBase {
_transferAndAssert(_asset, _vaultAuth.owner, bob, 100_000 * _scale);
}

function test__LiquidStoneTest__VerifyDeployTenor() public view {
function test__LiquidStoneNinetyDay__VerifyDeployTenor() public view {
assertEq(90, _liquidVault.TENOR(), "tenor incorrect");
}

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() })
);
}
// TODO - need to implement and test for RetainedAssetsReceive1APY

function test__LiquidStoneTest__RedeemFullTenor() public {
function test__LiquidStoneNinetyDay__RedeemFullTenor() public {
uint256 depositPeriod = 5;
uint256 redeemPeriod = depositPeriod + _liquidVault.TENOR();
uint256 principal = 105 * _scale;
Expand Down Expand Up @@ -104,7 +88,7 @@ contract LiquidStoneTest is LiquidContinuousMultiTokenVaultTestBase {
assertEq(principal + expectedReturns, assets, "wrong assets returned");
}

function test__LiquidStoneTest__EarlyRedemptionGivesZeroYield() public {
function test__LiquidStoneNinetyDay__EarlyRedemptionGivesZeroYield() public {
uint256 depositPeriod = 25;
uint256 earlyRedeemPeriod = depositPeriod + _liquidVault.TENOR() - 1; // less than full tenor period
uint256 principal = 125 * _scale;
Expand Down

0 comments on commit f3414f4

Please sign in to comment.