-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathLinear.t.sol
88 lines (73 loc) · 3.87 KB
/
Linear.t.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.19 <0.9.0;
import { IERC20 } from "@openzeppelin/token/ERC20/IERC20.sol";
import { ISablierV2Base } from "src/interfaces/ISablierV2Base.sol";
import { ISablierV2Lockup } from "src/interfaces/ISablierV2Lockup.sol";
import { Linear_Shared_Test } from "../../../shared/lockup/linear/Linear.t.sol";
import { Fuzz_Test } from "../../Fuzz.t.sol";
import { Cancel_Fuzz_Test } from "../shared/cancel/cancel.t.sol";
import { GetWithdrawnAmount_Fuzz_Test } from "../shared/get-withdrawn-amount/getWithdrawnAmount.t.sol";
import { RefundableAmountOf_Fuzz_Test } from "../shared/refundable-amount-of/refundableAmountOf.t.sol";
import { Withdraw_Fuzz_Test } from "../shared/withdraw/withdraw.t.sol";
import { WithdrawMax_Fuzz_Test } from "../shared/withdraw-max/withdrawMax.t.sol";
import { WithdrawMultiple_Fuzz_Test } from "../shared/withdraw-multiple/withdrawMultiple.t.sol";
/*//////////////////////////////////////////////////////////////////////////
NON-SHARED ABSTRACT TEST
//////////////////////////////////////////////////////////////////////////*/
/// @title Linear_Fuzz_Test
/// @notice Common testing logic needed across {SablierV2LockupLinear} fuzz tests.
abstract contract Linear_Fuzz_Test is Fuzz_Test, Linear_Shared_Test {
function setUp() public virtual override(Fuzz_Test, Linear_Shared_Test) {
// Both of these contracts inherit from {Base_Test}, but this is fine because multiple inheritance is
// allowed in Solidity, and {Base_Test-setUp} will only be called once.
Fuzz_Test.setUp();
Linear_Shared_Test.setUp();
// Cast the linear contract as {ISablierV2Base} and {ISablierV2Lockup}.
base = ISablierV2Base(linear);
lockup = ISablierV2Lockup(linear);
// Set the default protocol fee.
comptroller.setProtocolFee({ asset: DEFAULT_ASSET, newProtocolFee: DEFAULT_PROTOCOL_FEE });
comptroller.setProtocolFee({ asset: IERC20(address(nonCompliantAsset)), newProtocolFee: DEFAULT_PROTOCOL_FEE });
// Make the sender the default caller in this test suite.
changePrank({ msgSender: users.sender });
}
}
/*//////////////////////////////////////////////////////////////////////////
SHARED TESTS
//////////////////////////////////////////////////////////////////////////*/
contract Cancel_Linear_Fuzz_Test is Linear_Fuzz_Test, Cancel_Fuzz_Test {
function setUp() public virtual override(Linear_Fuzz_Test, Cancel_Fuzz_Test) {
Linear_Fuzz_Test.setUp();
Cancel_Fuzz_Test.setUp();
}
}
contract GetWithdrawnAmount_Linear_Fuzz_Test is Linear_Fuzz_Test, GetWithdrawnAmount_Fuzz_Test {
function setUp() public virtual override(Linear_Fuzz_Test, GetWithdrawnAmount_Fuzz_Test) {
Linear_Fuzz_Test.setUp();
GetWithdrawnAmount_Fuzz_Test.setUp();
}
}
contract RefundableAmountOf_Linear_Fuzz_Test is Linear_Fuzz_Test, RefundableAmountOf_Fuzz_Test {
function setUp() public virtual override(Linear_Fuzz_Test, RefundableAmountOf_Fuzz_Test) {
Linear_Fuzz_Test.setUp();
RefundableAmountOf_Fuzz_Test.setUp();
}
}
contract Withdraw_Linear_Fuzz_Test is Linear_Fuzz_Test, Withdraw_Fuzz_Test {
function setUp() public virtual override(Linear_Fuzz_Test, Withdraw_Fuzz_Test) {
Linear_Fuzz_Test.setUp();
Withdraw_Fuzz_Test.setUp();
}
}
contract WithdrawMax_Linear_Fuzz_Test is Linear_Fuzz_Test, WithdrawMax_Fuzz_Test {
function setUp() public virtual override(Linear_Fuzz_Test, WithdrawMax_Fuzz_Test) {
Linear_Fuzz_Test.setUp();
WithdrawMax_Fuzz_Test.setUp();
}
}
contract WithdrawMultiple_Linear_Fuzz_Test is Linear_Fuzz_Test, WithdrawMultiple_Fuzz_Test {
function setUp() public virtual override(Linear_Fuzz_Test, WithdrawMultiple_Fuzz_Test) {
Linear_Fuzz_Test.setUp();
WithdrawMultiple_Fuzz_Test.setUp();
}
}