Skip to content

Commit

Permalink
misc: SkipTokenGate refactored to a more generic SkipGate permission
Browse files Browse the repository at this point in the history
  • Loading branch information
donosonaumczuk committed Jan 14, 2025
1 parent f4b42d5 commit 738c509
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 24 deletions.
8 changes: 4 additions & 4 deletions contracts/rules/feed/TokenGatedFeedRule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ contract TokenGatedFeedRule is TokenGatedRule, IFeedRule {
using AccessControlLib for IAccessControl;
using AccessControlLib for address;

/// @custom:keccak lens.permission.SkipTokenGate
uint256 constant PID__SKIP_TOKEN_GATE = uint256(0x42073514d6ebc3c4c46bdc33d53105f5c563a0d184e86952704eb3e7b74ec1ae);
/// @custom:keccak lens.permission.SkipGate
uint256 constant PID__SKIP_GATE = uint256(0xeb7f30e4c97d5211e2534aa42375c26931bd55b57a8101e5eb7918daead714eb);

/// @custom:keccak lens.param.accessControl
bytes32 constant PARAM__ACCESS_CONTROL = 0xcf3b0fab90208e4185bf857e0f943f6672abffb7d0898e0750beeeb991ae35fa;
Expand All @@ -29,7 +29,7 @@ contract TokenGatedFeedRule is TokenGatedRule, IFeedRule {
mapping(address => mapping(bytes32 => Configuration)) internal _configuration;

constructor(string memory metadataURI) TokenGatedRule(metadataURI) {
emit Events.Lens_PermissionId_Available(PID__SKIP_TOKEN_GATE, "lens.permission.SkipTokenGate");
emit Events.Lens_PermissionId_Available(PID__SKIP_GATE, "lens.permission.SkipGate");
}

function configure(bytes32 configSalt, KeyValue[] calldata ruleParams) external override {
Expand Down Expand Up @@ -86,7 +86,7 @@ contract TokenGatedFeedRule is TokenGatedRule, IFeedRule {
TokenGateConfiguration memory tokenGateConfiguration,
address account
) internal view {
if (!accessControl.hasAccess(account, PID__SKIP_TOKEN_GATE)) {
if (!accessControl.hasAccess(account, PID__SKIP_GATE)) {
_validateTokenBalance(tokenGateConfiguration, account);
}
}
Expand Down
8 changes: 4 additions & 4 deletions contracts/rules/follow/TokenGatedFollowRule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ contract TokenGatedFollowRule is TokenGatedRule, IFollowRule {
using AccessControlLib for IAccessControl;
using AccessControlLib for address;

/// @custom:keccak lens.permission.SkipTokenGate
uint256 constant PID__SKIP_TOKEN_GATE = uint256(0x42073514d6ebc3c4c46bdc33d53105f5c563a0d184e86952704eb3e7b74ec1ae);
/// @custom:keccak lens.permission.SkipGate
uint256 constant PID__SKIP_GATE = uint256(0xeb7f30e4c97d5211e2534aa42375c26931bd55b57a8101e5eb7918daead714eb);

/// @custom:keccak lens.param.accessControl
bytes32 constant PARAM__ACCESS_CONTROL = 0xcf3b0fab90208e4185bf857e0f943f6672abffb7d0898e0750beeeb991ae35fa;
Expand All @@ -27,7 +27,7 @@ contract TokenGatedFollowRule is TokenGatedRule, IFollowRule {
mapping(address => mapping(address => mapping(bytes32 => Configuration))) internal _configuration;

constructor(string memory metadataURI) TokenGatedRule(metadataURI) {
emit Events.Lens_PermissionId_Available(PID__SKIP_TOKEN_GATE, "lens.permission.SkipTokenGate");
emit Events.Lens_PermissionId_Available(PID__SKIP_GATE, "lens.permission.SkipGate");
}

function configure(bytes32 configSalt, address account, KeyValue[] calldata ruleParams) external override {
Expand Down Expand Up @@ -57,7 +57,7 @@ contract TokenGatedFollowRule is TokenGatedRule, IFollowRule {
TokenGateConfiguration memory tokenGateConfiguration,
address account
) internal view {
if (!accessControl.hasAccess(account, PID__SKIP_TOKEN_GATE)) {
if (!accessControl.hasAccess(account, PID__SKIP_GATE)) {
_validateTokenBalance(tokenGateConfiguration, account);
}
}
Expand Down
8 changes: 4 additions & 4 deletions contracts/rules/graph/GroupGatedGraphRule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ contract GroupGatedGraphRule is IGraphRule, MetadataBased {

event Lens_Rule_MetadataURISet(string metadataURI);

/// @custom:keccak lens.permission.SkipTokenGate
uint256 constant PID__SKIP_TOKEN_GATE = uint256(0x42073514d6ebc3c4c46bdc33d53105f5c563a0d184e86952704eb3e7b74ec1ae);
/// @custom:keccak lens.permission.SkipGate
uint256 constant PID__SKIP_GATE = uint256(0xeb7f30e4c97d5211e2534aa42375c26931bd55b57a8101e5eb7918daead714eb);

/// @custom:keccak lens.param.accessControl
bytes32 constant PARAM__ACCESS_CONTROL = 0xcf3b0fab90208e4185bf857e0f943f6672abffb7d0898e0750beeeb991ae35fa;
Expand All @@ -34,7 +34,7 @@ contract GroupGatedGraphRule is IGraphRule, MetadataBased {

constructor(string memory metadataURI) {
_setMetadataURI(metadataURI);
emit Events.Lens_PermissionId_Available(PID__SKIP_TOKEN_GATE, "lens.permission.SkipTokenGate");
emit Events.Lens_PermissionId_Available(PID__SKIP_GATE, "lens.permission.SkipGate");
}

function _emitMetadataURISet(string memory metadataURI) internal override {
Expand Down Expand Up @@ -93,7 +93,7 @@ contract GroupGatedGraphRule is IGraphRule, MetadataBased {
}

function _validateGroupMembership(address accessControl, address group, address account) internal view {
if (!accessControl.hasAccess(account, PID__SKIP_TOKEN_GATE)) {
if (!accessControl.hasAccess(account, PID__SKIP_GATE)) {
require(IGroup(group).isMember(account), Errors.NotAMember());
}
}
Expand Down
8 changes: 4 additions & 4 deletions contracts/rules/graph/TokenGatedGraphRule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ contract TokenGatedGraphRule is TokenGatedRule, IGraphRule {
using AccessControlLib for IAccessControl;
using AccessControlLib for address;

/// @custom:keccak lens.permission.SkipTokenGate
uint256 constant PID__SKIP_TOKEN_GATE = uint256(0x42073514d6ebc3c4c46bdc33d53105f5c563a0d184e86952704eb3e7b74ec1ae);
/// @custom:keccak lens.permission.SkipGate
uint256 constant PID__SKIP_GATE = uint256(0xeb7f30e4c97d5211e2534aa42375c26931bd55b57a8101e5eb7918daead714eb);

/// @custom:keccak lens.param.accessControl
bytes32 constant PARAM__ACCESS_CONTROL = 0xcf3b0fab90208e4185bf857e0f943f6672abffb7d0898e0750beeeb991ae35fa;
Expand All @@ -28,7 +28,7 @@ contract TokenGatedGraphRule is TokenGatedRule, IGraphRule {
mapping(address => mapping(bytes32 => Configuration)) internal _configuration;

constructor(string memory metadataURI) TokenGatedRule(metadataURI) {
emit Events.Lens_PermissionId_Available(PID__SKIP_TOKEN_GATE, "lens.permission.SkipTokenGate");
emit Events.Lens_PermissionId_Available(PID__SKIP_GATE, "lens.permission.SkipGate");
}

function configure(bytes32 configSalt, KeyValue[] calldata ruleParams) external {
Expand Down Expand Up @@ -87,7 +87,7 @@ contract TokenGatedGraphRule is TokenGatedRule, IGraphRule {
TokenGateConfiguration memory tokenGateConfiguration,
address account
) internal view {
if (!accessControl.hasAccess(account, PID__SKIP_TOKEN_GATE)) {
if (!accessControl.hasAccess(account, PID__SKIP_GATE)) {
_validateTokenBalance(tokenGateConfiguration, account);
}
}
Expand Down
8 changes: 4 additions & 4 deletions contracts/rules/group/TokenGatedGroupRule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ contract TokenGatedGroupRule is TokenGatedRule, IGroupRule {
using AccessControlLib for IAccessControl;
using AccessControlLib for address;

/// @custom:keccak lens.permission.SkipTokenGate
uint256 constant PID__SKIP_TOKEN_GATE = uint256(0x42073514d6ebc3c4c46bdc33d53105f5c563a0d184e86952704eb3e7b74ec1ae);
/// @custom:keccak lens.permission.SkipGate
uint256 constant PID__SKIP_GATE = uint256(0xeb7f30e4c97d5211e2534aa42375c26931bd55b57a8101e5eb7918daead714eb);

/// @custom:keccak lens.param.accessControl
bytes32 constant PARAM__ACCESS_CONTROL = 0xcf3b0fab90208e4185bf857e0f943f6672abffb7d0898e0750beeeb991ae35fa;
Expand All @@ -28,7 +28,7 @@ contract TokenGatedGroupRule is TokenGatedRule, IGroupRule {
mapping(address => mapping(bytes32 => Configuration)) internal _configuration;

constructor(string memory metadataURI) TokenGatedRule(metadataURI) {
emit Events.Lens_PermissionId_Available(PID__SKIP_TOKEN_GATE, "lens.permission.SkipTokenGate");
emit Events.Lens_PermissionId_Available(PID__SKIP_GATE, "lens.permission.SkipGate");
}

function configure(bytes32 configSalt, KeyValue[] calldata ruleParams) external {
Expand Down Expand Up @@ -86,7 +86,7 @@ contract TokenGatedGroupRule is TokenGatedRule, IGroupRule {
TokenGateConfiguration memory tokenGateConfiguration,
address account
) internal view {
if (!accessControl.hasAccess(account, PID__SKIP_TOKEN_GATE)) {
if (!accessControl.hasAccess(account, PID__SKIP_GATE)) {
_validateTokenBalance(tokenGateConfiguration, account);
}
}
Expand Down
8 changes: 4 additions & 4 deletions contracts/rules/namespace/TokenGatedNamespaceRule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ contract TokenGatedNamespaceRule is TokenGatedRule, INamespaceRule {
using AccessControlLib for IAccessControl;
using AccessControlLib for address;

/// @custom:keccak lens.permission.SkipTokenGate
uint256 constant PID__SKIP_TOKEN_GATE = uint256(0x42073514d6ebc3c4c46bdc33d53105f5c563a0d184e86952704eb3e7b74ec1ae);
/// @custom:keccak lens.permission.SkipGate
uint256 constant PID__SKIP_GATE = uint256(0xeb7f30e4c97d5211e2534aa42375c26931bd55b57a8101e5eb7918daead714eb);

/// @custom:keccak lens.param.accessControl
bytes32 constant PARAM__ACCESS_CONTROL = 0xcf3b0fab90208e4185bf857e0f943f6672abffb7d0898e0750beeeb991ae35fa;
Expand All @@ -27,7 +27,7 @@ contract TokenGatedNamespaceRule is TokenGatedRule, INamespaceRule {
mapping(address => mapping(bytes32 => Configuration)) internal _configuration;

constructor(string memory metadataURI) TokenGatedRule(metadataURI) {
emit Events.Lens_PermissionId_Available(PID__SKIP_TOKEN_GATE, "lens.permission.SkipTokenGate");
emit Events.Lens_PermissionId_Available(PID__SKIP_GATE, "lens.permission.SkipGate");
}

function configure(bytes32 configSalt, KeyValue[] calldata ruleParams) external {
Expand Down Expand Up @@ -101,7 +101,7 @@ contract TokenGatedNamespaceRule is TokenGatedRule, INamespaceRule {
TokenGateConfiguration memory tokenGateConfiguration,
address account
) internal view {
if (!accessControl.hasAccess(account, PID__SKIP_TOKEN_GATE)) {
if (!accessControl.hasAccess(account, PID__SKIP_GATE)) {
_validateTokenBalance(tokenGateConfiguration, account);
}
}
Expand Down

0 comments on commit 738c509

Please sign in to comment.