-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom entitlement factory to enable POAP gating #905
Conversation
Signed-off-by: Brian Meek <[email protected]>
|
||
import {ICustomEntitlement} from "contracts/src/spaces/entitlements/ICustomEntitlement.sol"; | ||
|
||
interface IPOAP { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this to a different file IPoapEntitlement.sol
) external view returns (uint256 eventId, uint256 tokenId); | ||
} | ||
|
||
IPOAP constant poapContract = IPOAP(0x22C1f6050E56d2876009903609a2cC3fEf83B415); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would move this inside the contract
uint256 public immutable eventId; | ||
|
||
constructor(uint256 _eventId) { | ||
require(_eventId > 0, "Invalid event ID"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use if
with custom error
function isEntitled( | ||
address[] calldata wallets | ||
) external view override returns (bool) { | ||
for (uint256 i = 0; i < wallets.length; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cache wallet length
// Check if the contract is already deployed | ||
uint32 size; | ||
assembly { | ||
size := extcodesize(predictedAddress) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use predictedAddress.code.length
instead of assembly
import {Factory} from "contracts/src/utils/Factory.sol"; | ||
import {PoapEntitlement} from "./PoapEntitlement.sol"; | ||
|
||
contract PoapEntitlementFactory is Factory { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
provide an interface for PoapEntitlementFactory in separate file
} | ||
} | ||
|
||
function getEntitlementAddress( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't think we need this function if we have predictEntitlementAddress
or replace with this one
return predictEntitlementAddress(eventId); | ||
} | ||
|
||
function getSalt(uint256 eventId) public pure returns (bytes32) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make internal
|
||
contract DeployPoapEntitlementFactory is Deployer { | ||
function versionName() public pure override returns (string memory) { | ||
return "DeployPoapEntitlementFactory"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the version name is the name of the contract you're deploying poapEntitlementFactory
address deployment = _deploy(initCode, salt); | ||
if (deployment != predictedAddress) { | ||
revert("Deployment failed"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add an event that emits the deployed address
we don’t use it any more and all telemetry is captured in app
…ssed (#767) #769 Moves the data inline where appropriate and marks it incompressible. Doesn't vacuum the miniblocks table because that will take a long time, need to revisit how/when to do that. --------- Signed-off-by: Brian Meek <[email protected]>
commit 11fd807 Author: GitHub Action Bot <[email protected]> Date: Wed Aug 28 00:20:14 2024 +0000 sdk-ebcdf9a-0.0.51
…#860) Integration tests for the stream-metadata service.
Previously, the Myself model was extending a Member model, which required some special treatment to avoid creating it twice. Now, the `Myself` model is wrapping a Member with some set actions, removing the cognitive overhead when changing the `Members` model, since we dont need to keep the special myself case in mind when doing changes.
Simple ICustomEntitlement deployer that enables creation of a Custom Entitlement per eventId that can be used to gate by POAP Event ID on Gnosis.
@giuseppecrj and I have discussed making it a BeaconProxy so we can change the implementation of isEntitled. I can see both sides of that given the simplicity of this contract and the use case.
Would be nice after using this in anger to improve the ICustomEntitlement interface to also return more information to make the UI in Towns better when people select this contract. @giuseppecrj has another PR to at least add support for detecting contracts claim to implement ICustomEntitlement instead of just evm_call isEntitled to see if the selector is handled. We should consider also a call to return some metadata so the UI can show what the custom entitlement claims, in this case it could have the POAP Event Name.
Still, this is a functional path forward to gating by POAP on Gnosis (and other chains)