From 313cdf08299085accf2d7d8e262f123625636673 Mon Sep 17 00:00:00 2001 From: mehditorabiv Date: Wed, 4 Dec 2024 15:00:45 +0300 Subject: [PATCH] update community-settings --- src/lib/contracts/engagement/contracts.ts | 578 ++++++++++++++++++ .../reputation-score/index.tsx | 49 +- src/pages/reputation-score/index.tsx | 2 +- src/pages/reputation-score/mint.tsx | 4 +- src/rainbowKitConfig.ts | 8 +- 5 files changed, 634 insertions(+), 7 deletions(-) diff --git a/src/lib/contracts/engagement/contracts.ts b/src/lib/contracts/engagement/contracts.ts index 2df88e12..fc5fc4fe 100644 --- a/src/lib/contracts/engagement/contracts.ts +++ b/src/lib/contracts/engagement/contracts.ts @@ -577,4 +577,582 @@ export const engagementContracts = [ }, ], }, + { + chainId: 42_161, + address: '0x89aDc2E7561914884c47a2F5447ac5052e6770b1', + abi: [ + { + inputs: [{ internalType: 'string', name: 'tokenURI_', type: 'string' }], + stateMutability: 'nonpayable', + type: 'constructor', + }, + { inputs: [], name: 'AccessControlBadConfirmation', type: 'error' }, + { + inputs: [ + { internalType: 'address', name: 'account', type: 'address' }, + { internalType: 'bytes32', name: 'neededRole', type: 'bytes32' }, + ], + name: 'AccessControlUnauthorizedAccount', + type: 'error', + }, + { + inputs: [ + { internalType: 'address', name: 'sender', type: 'address' }, + { internalType: 'uint256', name: 'balance', type: 'uint256' }, + { internalType: 'uint256', name: 'needed', type: 'uint256' }, + { internalType: 'uint256', name: 'tokenId', type: 'uint256' }, + ], + name: 'ERC1155InsufficientBalance', + type: 'error', + }, + { + inputs: [ + { internalType: 'address', name: 'approver', type: 'address' }, + ], + name: 'ERC1155InvalidApprover', + type: 'error', + }, + { + inputs: [ + { internalType: 'uint256', name: 'idsLength', type: 'uint256' }, + { internalType: 'uint256', name: 'valuesLength', type: 'uint256' }, + ], + name: 'ERC1155InvalidArrayLength', + type: 'error', + }, + { + inputs: [ + { internalType: 'address', name: 'operator', type: 'address' }, + ], + name: 'ERC1155InvalidOperator', + type: 'error', + }, + { + inputs: [ + { internalType: 'address', name: 'receiver', type: 'address' }, + ], + name: 'ERC1155InvalidReceiver', + type: 'error', + }, + { + inputs: [{ internalType: 'address', name: 'sender', type: 'address' }], + name: 'ERC1155InvalidSender', + type: 'error', + }, + { + inputs: [ + { internalType: 'address', name: 'operator', type: 'address' }, + { internalType: 'address', name: 'owner', type: 'address' }, + ], + name: 'ERC1155MissingApprovalForAll', + type: 'error', + }, + { + inputs: [{ internalType: 'string', name: 'message', type: 'string' }], + name: 'EmptyAccountNotAllowed', + type: 'error', + }, + { + inputs: [ + { internalType: 'address', name: 'account', type: 'address' }, + { internalType: 'uint256', name: 'tokenId', type: 'uint256' }, + ], + name: 'MintLimit', + type: 'error', + }, + { + inputs: [ + { internalType: 'address', name: 'account', type: 'address' }, + { internalType: 'uint256', name: 'tokenId', type: 'uint256' }, + ], + name: 'NotAllowed', + type: 'error', + }, + { + inputs: [{ internalType: 'uint256', name: 'tokenId', type: 'uint256' }], + name: 'NotFound', + type: 'error', + }, + { + inputs: [{ internalType: 'string', name: 'message', type: 'string' }], + name: 'URIEmpty', + type: 'error', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'account', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'operator', + type: 'address', + }, + { + indexed: false, + internalType: 'bool', + name: 'approved', + type: 'bool', + }, + ], + name: 'ApprovalForAll', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'string', + name: 'oldURI', + type: 'string', + }, + { + indexed: false, + internalType: 'string', + name: 'newURI', + type: 'string', + }, + ], + name: 'BaseURIUpdated', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'account', + type: 'address', + }, + { + indexed: true, + internalType: 'uint256', + name: 'tokenId', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'Burn', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'account', + type: 'address', + }, + { + indexed: true, + internalType: 'uint256', + name: 'tokenId', + type: 'uint256', + }, + ], + name: 'Issue', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'account', + type: 'address', + }, + { + indexed: true, + internalType: 'uint256', + name: 'tokenId', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'Mint', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'bytes32', + name: 'role', + type: 'bytes32', + }, + { + indexed: true, + internalType: 'bytes32', + name: 'previousAdminRole', + type: 'bytes32', + }, + { + indexed: true, + internalType: 'bytes32', + name: 'newAdminRole', + type: 'bytes32', + }, + ], + name: 'RoleAdminChanged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'bytes32', + name: 'role', + type: 'bytes32', + }, + { + indexed: true, + internalType: 'address', + name: 'account', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'sender', + type: 'address', + }, + ], + name: 'RoleGranted', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'bytes32', + name: 'role', + type: 'bytes32', + }, + { + indexed: true, + internalType: 'address', + name: 'account', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'sender', + type: 'address', + }, + ], + name: 'RoleRevoked', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'operator', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'from', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'to', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256[]', + name: 'ids', + type: 'uint256[]', + }, + { + indexed: false, + internalType: 'uint256[]', + name: 'values', + type: 'uint256[]', + }, + ], + name: 'TransferBatch', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'operator', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'from', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'to', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'id', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'value', + type: 'uint256', + }, + ], + name: 'TransferSingle', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'string', + name: 'value', + type: 'string', + }, + { + indexed: true, + internalType: 'uint256', + name: 'id', + type: 'uint256', + }, + ], + name: 'URI', + type: 'event', + }, + { + inputs: [], + name: 'DEFAULT_ADMIN_ROLE', + outputs: [{ internalType: 'bytes32', name: '', type: 'bytes32' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { internalType: 'address', name: 'account', type: 'address' }, + { internalType: 'uint256', name: 'id', type: 'uint256' }, + ], + name: 'balanceOf', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { internalType: 'address[]', name: 'accounts', type: 'address[]' }, + { internalType: 'uint256[]', name: 'ids', type: 'uint256[]' }, + ], + name: 'balanceOfBatch', + outputs: [{ internalType: 'uint256[]', name: '', type: 'uint256[]' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { internalType: 'address', name: 'account', type: 'address' }, + { internalType: 'uint256', name: 'tokenId', type: 'uint256' }, + { internalType: 'uint256', name: 'amount', type: 'uint256' }, + ], + name: 'burn', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'counter', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [{ internalType: 'bytes32', name: 'role', type: 'bytes32' }], + name: 'getRoleAdmin', + outputs: [{ internalType: 'bytes32', name: '', type: 'bytes32' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { internalType: 'bytes32', name: 'role', type: 'bytes32' }, + { internalType: 'address', name: 'account', type: 'address' }, + ], + name: 'grantRole', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'bytes32', name: 'role', type: 'bytes32' }, + { internalType: 'address', name: 'account', type: 'address' }, + ], + name: 'hasRole', + outputs: [{ internalType: 'bool', name: '', type: 'bool' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { internalType: 'address', name: 'account', type: 'address' }, + { internalType: 'address', name: 'operator', type: 'address' }, + ], + name: 'isApprovedForAll', + outputs: [{ internalType: 'bool', name: '', type: 'bool' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'issue', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'address', name: 'account', type: 'address' }, + { internalType: 'uint256', name: 'tokenId', type: 'uint256' }, + { internalType: 'uint256', name: 'amount', type: 'uint256' }, + { internalType: 'bytes', name: 'data', type: 'bytes' }, + ], + name: 'mint', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'bytes32', name: 'role', type: 'bytes32' }, + { + internalType: 'address', + name: 'callerConfirmation', + type: 'address', + }, + ], + name: 'renounceRole', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'bytes32', name: 'role', type: 'bytes32' }, + { internalType: 'address', name: 'account', type: 'address' }, + ], + name: 'revokeRole', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'address', name: 'from', type: 'address' }, + { internalType: 'address', name: 'to', type: 'address' }, + { internalType: 'uint256[]', name: 'ids', type: 'uint256[]' }, + { internalType: 'uint256[]', name: 'values', type: 'uint256[]' }, + { internalType: 'bytes', name: 'data', type: 'bytes' }, + ], + name: 'safeBatchTransferFrom', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'address', name: 'from', type: 'address' }, + { internalType: 'address', name: 'to', type: 'address' }, + { internalType: 'uint256', name: 'id', type: 'uint256' }, + { internalType: 'uint256', name: 'value', type: 'uint256' }, + { internalType: 'bytes', name: 'data', type: 'bytes' }, + ], + name: 'safeTransferFrom', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'address', name: 'operator', type: 'address' }, + { internalType: 'bool', name: 'approved', type: 'bool' }, + ], + name: 'setApprovalForAll', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'bytes4', name: 'interfaceId', type: 'bytes4' }, + ], + name: 'supportsInterface', + outputs: [{ internalType: 'bool', name: '', type: 'bool' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [{ internalType: 'string', name: 'newURI', type: 'string' }], + name: 'updateBaseURI', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + name: 'uri', + outputs: [{ internalType: 'string', name: '', type: 'string' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { internalType: 'uint256', name: 'tokenId', type: 'uint256' }, + { internalType: 'string', name: 'account', type: 'string' }, + ], + name: 'uri', + outputs: [{ internalType: 'string', name: '', type: 'string' }], + stateMutability: 'view', + type: 'function', + }, + ], + }, ]; diff --git a/src/pages/community-settings/reputation-score/index.tsx b/src/pages/community-settings/reputation-score/index.tsx index 36c20bdb..2f2091e1 100644 --- a/src/pages/community-settings/reputation-score/index.tsx +++ b/src/pages/community-settings/reputation-score/index.tsx @@ -1,6 +1,7 @@ import { useEffect, useState } from 'react'; import { Alert, AlertTitle, Button, Stack, Typography } from '@mui/material'; import { ConnectButton } from '@rainbow-me/rainbowkit'; +import Link from 'next/link'; import { Abi } from 'viem'; import { useAccount, @@ -18,7 +19,6 @@ import useAppStore from '@/store/useStore'; import { useToken } from '@/context/TokenContext'; import { defaultLayout } from '@/layouts/defaultLayout'; -import Link from 'next/link'; function Index() { const [moduleId, setModuleId] = useState(null); @@ -127,12 +127,57 @@ function Index() { A member’s reputation score captures their involvement in your community. The score is stored onchain and updates weekly and combines a member’s activity and influence. No - identifiable information is stored onchain. + identifiable information is stored onchain.{' '} + + Read more + + + How it works + + + 1.You activate the reputation module for your community. + We will link your community with a specific community id + token. + + + 2.Any member who has{' '} + + view + {' '} + access to togethercrew.com can mint their reputation + score. + + + 3.Your members will log into togethercrew.com, connect + their wallet and link their discord handle to their + wallet. This attestation is encrypted. Personal + identifiers are not stored onchain. + + + 4.Your members can see their reputation score on + togethercrew.com and in their wallet. + + + + {isConnected ? (