@@ -39,13 +39,15 @@ contract NFATFacilityTest is DssTest {
3939
4040 address almProxy = address (0xA1 );
4141 address pauseProxy;
42- address lpha = address (0xC1 );
43- address pauser = address (0xC2 );
42+ address operator = address (0xC1 );
43+ address freezer = address (0xC2 );
4444 address prime1 = address (0xB1 );
4545 address prime2 = address (0xB2 );
4646
47- event SetUserRole (address indexed who , uint8 indexed role , bool enabled );
48- event SetRoleAction (uint8 indexed role , bytes4 sig , bool enabled );
47+ event Kiss (address indexed usr );
48+ event Diss (address indexed usr );
49+ event AddFreezer (address indexed usr );
50+ event RemoveFreezer (address indexed usr );
4951 event Stop ();
5052 event Start ();
5153 event Subscribe (address indexed depositor , uint256 amount );
@@ -73,14 +75,14 @@ contract NFATFacilityTest is DssTest {
7375 susds = SUsdsLike (address (facility.gem ()));
7476
7577 // Init via NFATInit as pauseProxy
76- address [] memory pausers = new address [](1 );
77- pausers [0 ] = pauser ;
78+ address [] memory _freezers = new address [](1 );
79+ _freezers [0 ] = freezer ;
7880 NFATConfig memory cfg = NFATConfig ({
7981 facilityKey: "NFAT_FAC_HALO1 " ,
8082 almProxy: almProxy,
8183 identityNetwork: address (0 ),
82- lpha : lpha ,
83- pausers : pausers
84+ operator : operator ,
85+ freezers : _freezers
8486 });
8587 vm.startPrank (pauseProxy);
8688 NFATInit.init (dss, facility_, cfg);
@@ -101,7 +103,7 @@ contract NFATFacilityTest is DssTest {
101103
102104 function _claim (address target , uint256 amount ) internal returns (uint256 tokenId ) {
103105 tokenId = facility.nextTokenId ();
104- vm.prank (lpha ); facility.claim (target, amount);
106+ vm.prank (operator ); facility.claim (target, amount);
105107 }
106108
107109 function _fundToken (uint256 tokenId , uint256 amount ) internal {
@@ -115,13 +117,11 @@ contract NFATFacilityTest is DssTest {
115117 function testDeployAndInit () public view {
116118 assertEq (facility.wards (pauseProxy), 1 );
117119
118- // Pauser role configured by init
119- assertTrue (facility.hasUserRole (pauser, NFATInit.PAUSER));
120- assertTrue (facility.isActionInRole (facility.stop.selector , NFATInit.PAUSER));
120+ // Freezer configured by init
121+ assertEq (facility.cops (freezer), 1 );
121122
122- // Lpha role configured by init
123- assertTrue (facility.hasUserRole (lpha, NFATInit.LPHA));
124- assertTrue (facility.isActionInRole (facility.claim.selector , NFATInit.LPHA));
123+ // Operator configured by init
124+ assertEq (facility.buds (operator), 1 );
125125
126126 // Chainlog entry
127127 assertEq (dss.chainlog.getAddress ("NFAT_FAC_HALO1 " ), address (facility));
@@ -140,57 +140,67 @@ contract NFATFacilityTest is DssTest {
140140 function testModifiers () public {
141141 vm.startPrank (address (0xBEEF ));
142142 checkModifier (address (facility), "NFATFacility/not-authorized " , [
143- facility.setUserRole.selector ,
144- facility.setRoleAction.selector ,
143+ facility.kiss.selector ,
144+ facility.diss.selector ,
145+ facility.addFreezer.selector ,
146+ facility.removeFreezer.selector ,
145147 facility.start.selector
146148 ]);
147- checkModifier (address (facility), "NFATFacility/role-not-authorized " , [
148- facility.stop.selector ,
149+ vm.stopPrank ();
150+
151+ checkModifier (address (facility), "NFATFacility/not-operator " , [
149152 facility.claim.selector
150153 ]);
151- vm.stopPrank ();
154+ checkModifier (address (facility), "NFATFacility/not-freezer " , [
155+ facility.stop.selector
156+ ]);
152157 }
153158
154- function testSetUserRole () public {
155- vm.startPrank (pauseProxy);
159+ function testKissDiss () public {
160+ address who = address (0xb0b );
161+ assertEq (facility.buds (who), 0 );
162+
156163 vm.expectEmit (true , true , true , true );
157- emit SetUserRole (prime1, 1 , true );
158- facility. setUserRole (prime1, 1 , true );
159- assertTrue (facility.hasUserRole (prime1 , 1 ) );
164+ emit Kiss (who );
165+ vm. prank (pauseProxy); facility. kiss (who );
166+ assertEq (facility.buds (who) , 1 );
160167
161- facility.setUserRole (prime1, 1 , false );
162- assertTrue (! facility.hasUserRole (prime1, 1 ));
163- vm.stopPrank ();
168+ vm.expectEmit (true , true , true , true );
169+ emit Diss (who);
170+ vm.prank (pauseProxy); facility.diss (who);
171+ assertEq (facility.buds (who), 0 );
164172 }
165173
166- function testSetRoleAction () public {
167- bytes4 sig = facility.claim.selector ;
168- vm.startPrank (pauseProxy);
174+ function testAddRemoveFreezer () public {
175+ address who = address (0xb0b );
176+ assertEq (facility.cops (who), 0 );
177+
169178 vm.expectEmit (true , true , true , true );
170- emit SetRoleAction ( 1 , sig, true );
171- facility. setRoleAction ( 1 , sig, true );
172- assertTrue (facility.isActionInRole (sig , 1 ) );
179+ emit AddFreezer (who );
180+ vm. prank (pauseProxy); facility. addFreezer (who );
181+ assertEq (facility.cops (who) , 1 );
173182
174- facility.setRoleAction (1 , sig, false );
175- assertTrue (! facility.isActionInRole (sig, 1 ));
176- vm.stopPrank ();
183+ vm.expectEmit (true , true , true , true );
184+ emit RemoveFreezer (who);
185+ vm.prank (pauseProxy); facility.removeFreezer (who);
186+ assertEq (facility.cops (who), 0 );
177187 }
178188
179189 function testStopStart () public {
180190 _subscribe (prime1, 100 ether);
181191
182192 // claim works before stop
183- vm.prank (lpha ); facility.claim (prime1, 25 ether);
193+ vm.prank (operator ); facility.claim (prime1, 25 ether);
184194
185195 // stop
186196 vm.expectEmit (true , true , true , true );
187197 emit Stop ();
188- vm.prank (pauser ); facility.stop ();
198+ vm.prank (freezer ); facility.stop ();
189199 assertTrue (facility.stopped ());
190200
191201 // claim reverts while stopped
192202 vm.expectRevert ("NFATFacility/stopped " );
193- vm.prank (lpha ); facility.claim (prime1, 25 ether);
203+ vm.prank (operator ); facility.claim (prime1, 25 ether);
194204
195205 // start
196206 vm.expectEmit (true , true , true , true );
@@ -199,7 +209,7 @@ contract NFATFacilityTest is DssTest {
199209 assertTrue (! facility.stopped ());
200210
201211 // claim works again after start
202- vm.prank (lpha ); facility.claim (prime1, 25 ether);
212+ vm.prank (operator ); facility.claim (prime1, 25 ether);
203213 }
204214
205215 // --- Queue ---
@@ -279,22 +289,22 @@ contract NFATFacilityTest is DssTest {
279289 _subscribe (prime1, 100 ether);
280290
281291 vm.expectRevert ("NFATFacility/zero-amount " );
282- vm.prank (lpha ); facility.claim (prime1, 0 );
292+ vm.prank (operator ); facility.claim (prime1, 0 );
283293 }
284294
285295 function testRevertClaimInsufficientDeposits () public {
286296 _subscribe (prime1, 100 ether);
287297
288298 vm.expectRevert ("NFATFacility/insufficient-deposits " );
289- vm.prank (lpha ); facility.claim (prime1, 101 ether);
299+ vm.prank (operator ); facility.claim (prime1, 101 ether);
290300 }
291301
292302 function testRevertClaimStopped () public {
293303 _subscribe (prime1, 100 ether);
294304 vm.prank (pauseProxy); facility.stop ();
295305
296306 vm.expectRevert ("NFATFacility/stopped " );
297- vm.prank (lpha ); facility.claim (prime1, 50 ether);
307+ vm.prank (operator ); facility.claim (prime1, 50 ether);
298308 }
299309
300310 function testClaimWithIdentityNetwork () public {
@@ -313,7 +323,7 @@ contract NFATFacilityTest is DssTest {
313323 _subscribe (prime1, 100 ether);
314324
315325 vm.expectRevert ("NFATFacility/target-not-member " );
316- vm.prank (lpha ); facility.claim (prime1, 50 ether);
326+ vm.prank (operator ); facility.claim (prime1, 50 ether);
317327 }
318328
319329 // --- Fund ---
@@ -524,8 +534,8 @@ contract NFATFacilityTest is DssTest {
524534
525535 // Operator approves
526536 vm.prank (prime1); facility.setApprovalForAll (prime2, true );
527- vm.prank (prime2); facility.approve (lpha , tokenId);
528- assertEq (facility.getApproved (tokenId), lpha );
537+ vm.prank (prime2); facility.approve (operator , tokenId);
538+ assertEq (facility.getApproved (tokenId), operator );
529539 }
530540
531541 function testRevertApproveNotAuthorized () public {
0 commit comments