Skip to content

Commit e5ca921

Browse files
author
telome
committed
Check membership in redeem
1 parent e374517 commit e5ca921

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/NFATFacility.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ contract NFATFacility {
263263

264264
address owner = _owners[tokenId];
265265
require(msg.sender == owner, "NFATFacility/not-owner");
266+
require(identityNetwork == address(0) || IdentityNetworkLike(identityNetwork).isMember(owner), "NFATFacility/not-member");
266267

267268
// Effects
268269
unchecked { funded[tokenId] -= amount; }

test/NFATFacility.t.sol

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,21 @@ contract NFATFacilityTest is DssTest {
399399
vm.prank(prime1); facility.redeem(tokenId, 11 ether);
400400
}
401401

402+
function testRevertRedeemNotMember() public {
403+
vm.prank(pauseProxy); facility.file("identityNetwork", address(idNet));
404+
idNet.setMember(prime1, true);
405+
406+
_subscribe(prime1, 100 ether);
407+
uint256 tokenId = _claim(prime1, 100 ether);
408+
_fundToken(tokenId, 50 ether);
409+
410+
// prime1 gets de-whitelisted after funding
411+
idNet.setMember(prime1, false);
412+
413+
vm.expectRevert("NFATFacility/not-member");
414+
vm.prank(prime1); facility.redeem(tokenId, 50 ether);
415+
}
416+
402417
function testRevertRedeemNotOwner() public {
403418
_subscribe(prime1, 100 ether);
404419
uint256 tokenId = _claim(prime1, 100 ether);

0 commit comments

Comments
 (0)