-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cleanup Integration tests #97
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
187008 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
180029 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
141165 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
239700 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
151880 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
250739 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
295192 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,12 +13,12 @@ contract FeeEscalatorLibTest is Test { | |
using FeeEscalatorLib for FeeEscalator; | ||
using FeeEscalatorBuilder for FeeEscalator; | ||
|
||
function testRelayFeeEscalationNoEscalation(uint256 amount, uint256 startTime, uint256 endTime) public { | ||
function test_resolve_noEscalation(uint256 amount, uint256 startTime, uint256 endTime) public { | ||
vm.assume(endTime >= startTime); | ||
assertEq(FeeEscalatorLib.resolve(amount, amount, startTime, endTime), amount); | ||
} | ||
|
||
function testRelayFeeEscalationNoEscalationYet() public { | ||
function test_resolve_noEscalationYet() public { | ||
vm.warp(100); | ||
// at startTime | ||
assertEq(FeeEscalatorLib.resolve(1 ether, 2 ether, 100, 200), 1 ether); | ||
|
@@ -28,7 +28,7 @@ contract FeeEscalatorLibTest is Test { | |
assertEq(FeeEscalatorLib.resolve(1 ether, 2 ether, 100, 200), 1 ether); | ||
} | ||
|
||
function testRelayFeeEscalation() public { | ||
function test_resolve() public { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. test_resolve_midwayEscalation? |
||
vm.warp(150); | ||
assertEq(FeeEscalatorLib.resolve(1 ether, 2 ether, 100, 200), 1.5 ether); | ||
|
||
|
@@ -42,20 +42,20 @@ contract FeeEscalatorLibTest is Test { | |
assertEq(FeeEscalatorLib.resolve(1 ether, 2 ether, 100, 200), 1.9 ether); | ||
} | ||
|
||
function testRelayFeeEscalationFullyEscalated() public { | ||
function test_resolve_fullyEscalated() public { | ||
vm.warp(200); | ||
assertEq(FeeEscalatorLib.resolve(1 ether, 2 ether, 100, 200), 2 ether); | ||
|
||
vm.warp(250); | ||
assertEq(FeeEscalatorLib.resolve(1 ether, 2 ether, 100, 200), 2 ether); | ||
} | ||
|
||
function testRelayFeeEscalationRevertsWithWrongEndStartTimes() public { | ||
function test_resolve_reverts_withWrongEndStartTimes() public { | ||
vm.expectRevert(ReactorErrors.EndTimeBeforeStartTime.selector); | ||
FeeEscalatorLib.resolve(1 ether, 2 ether, 200, 100); | ||
} | ||
|
||
function testRelayFeeEscalationEqualAmounts(uint256 amount, uint256 startTime, uint256 endTime) public { | ||
function test_resolve_equalAmounts(uint256 amount, uint256 startTime, uint256 endTime) public { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. test_fuzz_resolve_equalAmounts_doesNotEscalate |
||
vm.assume(endTime >= startTime); | ||
uint256 time = startTime; | ||
bound(time, startTime, startTime); | ||
|
@@ -64,22 +64,20 @@ contract FeeEscalatorLibTest is Test { | |
assertEq(FeeEscalatorLib.resolve(amount, amount, startTime, endTime), amount); | ||
} | ||
|
||
function testRelayFeeEscalationInvalidAmounts() public { | ||
function test_resolve_reverts_withInvalidAmounts() public { | ||
vm.expectRevert(ReactorErrors.InvalidAmounts.selector); | ||
FeeEscalatorLib.resolve(2 ether, 1 ether, 100, 200); | ||
} | ||
|
||
function testRelayFeeEscalationBounded(uint256 startAmount, uint256 endAmount, uint256 startTime, uint256 endTime) | ||
public | ||
{ | ||
function test_resolve_bounded(uint256 startAmount, uint256 endAmount, uint256 startTime, uint256 endTime) public { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. test_fuzz_resolve_bounded |
||
vm.assume(endAmount > startAmount); | ||
vm.assume(endTime >= startTime); | ||
uint256 resolved = FeeEscalatorLib.resolve(startAmount, endAmount, startTime, endTime); | ||
assertGe(resolved, startAmount); | ||
assertLe(resolved, endAmount); | ||
} | ||
|
||
function testToTokenPermissions() public { | ||
function test_toTokenPermissions() public { | ||
address token = makeAddr("token"); | ||
FeeEscalator memory fee = | ||
FeeEscalator({token: token, startAmount: 1 ether, endAmount: 2 ether, startTime: 100, endTime: 200}); | ||
|
@@ -89,7 +87,7 @@ contract FeeEscalatorLibTest is Test { | |
assertEq(permission.amount, 2 ether); | ||
} | ||
|
||
function testToTransferDetails() public { | ||
function test_toTransferDetails() public { | ||
address filler = makeAddr("filler"); | ||
FeeEscalator memory fee = | ||
FeeEscalator({token: address(this), startAmount: 1 ether, endAmount: 1 ether, startTime: 0, endTime: 0}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a note but its definitely odd UX to have exact output swap where gasToken is in the same output token cause the end balance won't be the specified "exact"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but nice test 👍