Skip to content

Commit

Permalink
Add relay decay tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongeric committed Feb 6, 2024
1 parent 435e619 commit f4f72aa
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/foundry-tests/lib/RelayDecayLib.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,20 @@ contract RelayDecayLibTest is Test {
assertEq(RelayDecayLib.decay(1 ether, 2 ether, 100, 200), 2 ether);
}

function testRelayDecayEqualAmounts(uint256 amount, uint256 decayStartTime, uint256 decayEndTime) public {
vm.assume(decayEndTime >= decayStartTime);
uint256 time = decayStartTime;
bound(time, decayStartTime, decayStartTime);

vm.warp(time);
assertEq(RelayDecayLib.decay(amount, amount, decayStartTime, decayEndTime), amount);
}

function testRelayDecayInvalidAmounts() public {
vm.expectRevert(RelayDecayLib.InvalidAmounts.selector);
RelayDecayLib.decay(2 ether, 1 ether, 100, 200);
}

function testRelayDecayBounded(uint256 startAmount, uint256 endAmount, uint256 decayStartTime, uint256 decayEndTime)
public
{
Expand Down

0 comments on commit f4f72aa

Please sign in to comment.