Skip to content

Commit

Permalink
fix: improve the test
Browse files Browse the repository at this point in the history
  • Loading branch information
sakulstra committed Aug 8, 2024
1 parent 9436581 commit 5f9c5a9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests/periphery/static-a-token/StaticATokenLM.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,12 @@ contract StaticATokenLMTest is BaseTest {
);
uint256 stataPrice = uint256(staticATokenLM.latestAnswer());
uint256 underlyingPrice = contracts.aaveOracle.getAssetPrice(UNDERLYING);
assertEq(stataPrice, (underlyingPrice * liquidityIndex) / 1e27);
uint256 expectedStataPrice = (underlyingPrice * liquidityIndex) / 1e27;
assertEq(stataPrice, expectedStataPrice);

// reverse the math to ensure precision loss is within bounds
uint256 reversedUnderlying = (stataPrice * 1e27) / liquidityIndex;
assertApproxEqAbs(underlyingPrice, reversedUnderlying, 1);
}

function test_convertersAndPreviews() public view {
Expand Down

0 comments on commit 5f9c5a9

Please sign in to comment.