Skip to content
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

Contract changes to support ERC1155 #381

Closed
wants to merge 21 commits into from

Conversation

clemire
Copy link
Contributor

@clemire clemire commented Jul 11, 2024

RuleEntitlement, EntitlementGated, and EntitlementDataQueryable are now deprecated for new spaces in favor of RuleEntitlementV2, EntitlementGatedV2, and EntitlementDataQueryableV2, all of which expose their respective V1 interfaces for legacy interoperability. Old contracts are left in code for reference and for the sake of generating bindings, but should no longer be deployed once these contract changes are deployed.

Since V1 contracts are deprecated, contract tests are updated to run against V2 contract versions.

I added a RuleDataUtil library that converts between V2 and V1 rule data so that v2 contracts can return RuleData in v1 format for stream and xchain nodes. Role creation and updating would have required creating creating V2 versions of entitlements manager, IEntitlements, and many other contracts, but this happens exclusively through the client, so we can just upgrade all role creation to use V2 rule data and force client upgrades once these contracts are deployed.

The client is updated entirely to use V2 rule data, but stream nodes and xchain nodes are still using V1 endpoints on the new contracts. There will be a follow-up PR that migrates core services to use V2 endpoints.

Tested locally on harmony with some staged changes ready for a follow-up PR and gating on spaces and channels works fine.

@clemire clemire marked this pull request as ready for review July 15, 2024 21:58
transaction.roleIds.push(roleId);

for (uint256 i = 0; i < selectedNodes.length; i++) {
transaction.nodeVotesArray[roleId].push(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use EnumerableSet not arrays

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a straight copy of previous implementation, do you think we could defer to a follow-up PR?

@@ -65,7 +67,8 @@ export type CheckOperation = {
checkType: CheckOperationType
chainId: bigint
contractAddress: Address
threshold: bigint
threshold?: bigint
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be params bytes, not specific data, so we never have to go through this again for new operation types.

@clemire clemire closed this Jul 26, 2024
@clemire clemire deleted the crystal/hnt-7898-river-support-for-erc1155-tokens branch August 2, 2024 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants