Skip to content

Commit b3ccf64

Browse files
committed
Fix BaseStrategyUpgradeable test imports and event
1 parent 83d6b73 commit b3ccf64

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

pkg/contracts/test/BaseStrategyUpgradeable.t.sol

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ import "forge-std/Test.sol";
66
import {BaseStrategyUpgradeable} from "../src/BaseStrategyUpgradeable.sol";
77
import {IAllo} from "allo-v2-contracts/core/interfaces/IAllo.sol";
88
import {IStrategy} from "allo-v2-contracts/core/interfaces/IStrategy.sol";
9-
import {UNAUTHORIZED, INVALID, ALREADY_INITIALIZED, NOT_INITIALIZED, POOL_INACTIVE, POOL_ACTIVE}
10-
from "allo-v2-contracts/core/libraries/Errors.sol";
9+
import {Errors} from "allo-v2-contracts/core/libraries/Errors.sol";
1110

1211
contract MockAllo {
1312
mapping(uint256 => mapping(address => bool)) public managers;
@@ -79,6 +78,8 @@ contract BaseStrategyUpgradeableHarness is BaseStrategyUpgradeable {
7978
}
8079

8180
contract BaseStrategyUpgradeableTest is Test {
81+
event PoolActive(bool active);
82+
8283
BaseStrategyUpgradeableHarness internal strategy;
8384
MockAllo internal allo;
8485
address internal owner = makeAddr("owner");
@@ -98,7 +99,7 @@ contract BaseStrategyUpgradeableTest is Test {
9899
}
99100

100101
function test_onlyAlloGuard() public {
101-
vm.expectRevert(abi.encodeWithSelector(UNAUTHORIZED.selector));
102+
vm.expectRevert(abi.encodeWithSelector(Errors.UNAUTHORIZED.selector));
102103
strategy.exposedCheckOnlyAllo();
103104

104105
vm.prank(address(allo));
@@ -107,20 +108,20 @@ contract BaseStrategyUpgradeableTest is Test {
107108

108109
function test_BaseStrategyInit_validatesCallerAndPoolId() public {
109110
vm.prank(address(allo));
110-
vm.expectRevert(abi.encodeWithSelector(INVALID.selector));
111+
vm.expectRevert(abi.encodeWithSelector(Errors.INVALID.selector));
111112
strategy.callBaseStrategyInit(0);
112113

113114
vm.prank(address(allo));
114115
strategy.callBaseStrategyInit(1);
115116
assertEq(strategy.getPoolId(), 1);
116117

117118
vm.prank(address(allo));
118-
vm.expectRevert(abi.encodeWithSelector(ALREADY_INITIALIZED.selector));
119+
vm.expectRevert(abi.encodeWithSelector(Errors.ALREADY_INITIALIZED.selector));
119120
strategy.callBaseStrategyInit(2);
120121
}
121122

122123
function test_onlyInitializedGuard() public {
123-
vm.expectRevert(abi.encodeWithSelector(NOT_INITIALIZED.selector));
124+
vm.expectRevert(abi.encodeWithSelector(Errors.NOT_INITIALIZED.selector));
124125
strategy.exposedCheckOnlyInitialized();
125126

126127
vm.prank(address(allo));
@@ -133,27 +134,27 @@ contract BaseStrategyUpgradeableTest is Test {
133134
vm.prank(address(allo));
134135
strategy.callBaseStrategyInit(3);
135136

136-
vm.expectRevert(abi.encodeWithSelector(UNAUTHORIZED.selector));
137+
vm.expectRevert(abi.encodeWithSelector(Errors.UNAUTHORIZED.selector));
137138
strategy.exposedCheckOnlyPoolManager(manager);
138139

139140
allo.setPoolManager(3, manager, true);
140141
strategy.exposedCheckOnlyPoolManager(manager);
141142
}
142143

143144
function test_poolActiveStateAndGuards() public {
144-
vm.expectRevert(abi.encodeWithSelector(POOL_INACTIVE.selector));
145+
vm.expectRevert(abi.encodeWithSelector(Errors.POOL_INACTIVE.selector));
145146
strategy.exposedCheckOnlyActivePool();
146147

147148
strategy.exposedCheckInactivePool();
148149
assertFalse(strategy.exposedIsPoolActive());
149150

150151
vm.expectEmit(false, false, false, true);
151-
emit IStrategy.PoolActive(true);
152+
emit PoolActive(true);
152153
strategy.exposedSetPoolActive(true);
153154

154155
assertTrue(strategy.exposedIsPoolActive());
155156

156-
vm.expectRevert(abi.encodeWithSelector(POOL_ACTIVE.selector));
157+
vm.expectRevert(abi.encodeWithSelector(Errors.POOL_ACTIVE.selector));
157158
strategy.exposedCheckInactivePool();
158159

159160
strategy.exposedCheckOnlyActivePool();

0 commit comments

Comments
 (0)