Skip to content

Commit

Permalink
Merge pull request #36 from aragon/f/encryption-registry
Browse files Browse the repository at this point in the history
Supporting the encryption registry
  • Loading branch information
brickpop authored Nov 29, 2024
2 parents f66613f + eb51b09 commit f6b83f7
Show file tree
Hide file tree
Showing 66 changed files with 3,080 additions and 2,675 deletions.
17 changes: 10 additions & 7 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
# PUBLIC ENV VARS

# General
NEXT_PUBLIC_DAO_ADDRESS=0xcB10AB2E59Ac73e202adE31531462F7a75cfe74C
NEXT_PUBLIC_TOKEN_ADDRESS=0x6490E12d480549D333499236fF2Ba6676C296011
NEXT_PUBLIC_DEPLOYMENT_BLOCK=2764900

NEXT_PUBLIC_DAO_ADDRESS=0x8caD8b62769710233f319611d064462b633Bbb8C
NEXT_PUBLIC_TOKEN_ADDRESS=0x18EE0C13EC97a60fc190bABB348FD87421368920

# Plugin addresses
NEXT_PUBLIC_MULTISIG_PLUGIN_ADDRESS=0x9d2f62109CE2fDb3FaE58f14D2c1CedFdc7939f9
NEXT_PUBLIC_EMERGENCY_MULTISIG_PLUGIN_ADDRESS=0x2198F07F02b2D7365C7Df8C488741B43EE076f83
NEXT_PUBLIC_DUAL_GOVERNANCE_PLUGIN_ADDRESS=0x799A3D93DB762A838F41Dd956857463AC9D245d7
NEXT_PUBLIC_PUBLIC_KEY_REGISTRY_CONTRACT_ADDRESS=0x054098E107FCd07d1C3D0F97Ba8217CE85AaC3ca
NEXT_PUBLIC_DELEGATION_WALL_CONTRACT_ADDRESS=0x9A118b78dE4b3c91706f45Bb8686f678d5600500
NEXT_PUBLIC_MULTISIG_PLUGIN_ADDRESS=0xc880dB28A9105e6D69d30E93d99E38eFE84c54CB
NEXT_PUBLIC_EMERGENCY_MULTISIG_PLUGIN_ADDRESS=0x3bE6294EB67A3501bF091fD229282F2A51c532d2
NEXT_PUBLIC_DUAL_GOVERNANCE_PLUGIN_ADDRESS=0xBB249c027c5De908288104F665A605ceC88ad6CE
NEXT_PUBLIC_SIGNER_LIST_CONTRACT_ADDRESS=0x7716DcB9B83f5f9fB5266767841c3F29555cE2d5
NEXT_PUBLIC_ENCRYPTION_REGISTRY_CONTRACT_ADDRESS=0x94224B656D7D174B2Aa97FFCB188A847E6EA4511
NEXT_PUBLIC_DELEGATION_WALL_CONTRACT_ADDRESS=0xb8D78b40014D36F83dDc8219c0621d35E8043167

NEXT_PUBLIC_TAIKO_BRIDGE_ADDRESS=0xA098b76a3Dd499D3F6D58D8AcCaFC8efBFd06807

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull-request-build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
NEXT_PUBLIC_MULTISIG_PLUGIN_ADDRESS: "0x9695520e32F85eF403f6B18b8a94e44A90D5cBF0"
NEXT_PUBLIC_EMERGENCY_MULTISIG_PLUGIN_ADDRESS: "0x832d6339e26EF129cEd320f84d19034a3d3411e6"
NEXT_PUBLIC_DUAL_GOVERNANCE_PLUGIN_ADDRESS: "0xeB6e121d41B1C72Bb89cAd700de693e40af3A83e"
NEXT_PUBLIC_PUBLIC_KEY_REGISTRY_CONTRACT_ADDRESS: "0xBFE2bf3F192e87747d61824041a2A6e1b5a3a130"
NEXT_PUBLIC_ENCRYPTION_REGISTRY_CONTRACT_ADDRESS: "0xBFE2bf3F192e87747d61824041a2A6e1b5a3a130"
NEXT_PUBLIC_DELEGATION_WALL_CONTRACT_ADDRESS: "0xFdA7007A88CF56Ac0662E9500a06C736e51023eC"

NEXT_PUBLIC_CHAIN_NAME: holesky
Expand Down
Binary file modified bun.lockb
Binary file not shown.
8 changes: 5 additions & 3 deletions components/nav/mobileNavDialog.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Dialog, type IDialogRootProps } from "@aragon/ods";
import Link from "next/link";
import { NavLink, type INavLink } from "./navLink";
import { useMultisigMembers } from "@/plugins/members/hooks/useMultisigMembers";
import { useApproverWalletList, useSignerList } from "@/plugins/members/hooks/useSignerList";
import { useAccount } from "wagmi";

interface IMobileNavDialogProps extends IDialogRootProps {
Expand All @@ -11,8 +11,10 @@ interface IMobileNavDialogProps extends IDialogRootProps {
export const MobileNavDialog: React.FC<IMobileNavDialogProps> = (props) => {
const { navLinks, ...dialogRootProps } = props;
const { address } = useAccount();
const { members } = useMultisigMembers();
const showAllLinks = address && members.includes(address);
const { data: listedSigners } = useSignerList();
const { data: listedOrAppointedSigners } = useApproverWalletList();
// If the address is a listed signer (by being an owner or by being appointed by an owner)
const showAllLinks = address && (listedSigners?.includes(address) || listedOrAppointedSigners?.includes(address));

return (
<Dialog.Root {...dialogRootProps}>
Expand Down
8 changes: 5 additions & 3 deletions components/nav/navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ import { NavLink, type INavLink } from "./navLink";
import { AvatarIcon, IconType } from "@aragon/ods";
import { PUB_APP_NAME, PUB_PROJECT_LOGO } from "@/constants";
import { useAccount } from "wagmi";
import { useMultisigMembers } from "@/plugins/members/hooks/useMultisigMembers";
import { useSignerList, useApproverWalletList } from "@/plugins/members/hooks/useSignerList";

export const Navbar: React.FC = () => {
const [showMenu, setShowMenu] = useState(false);
const { address } = useAccount();
const { members } = useMultisigMembers();
const showAllLinks = address && members.includes(address);
const { data: listedSigners } = useSignerList();
const { data: listedOrAppointedSigners } = useApproverWalletList();
// If the address is a listed signer (by being an owner or by being appointed by an owner)
const showAllLinks = address && (listedSigners?.includes(address) || listedOrAppointedSigners?.includes(address));

const navLinks: INavLink[] = [
// { path: "/", id: "dashboard", name: "Dashboard" /*, icon: IconType.APP_DASHBOARD*/ },
Expand Down
4 changes: 3 additions & 1 deletion constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Address } from "viem";
import { ChainName, getChain } from "./utils/chains";

// Contract Addresses
export const PUB_DEPLOYMENT_BLOCK = BigInt(process.env.NEXT_PUBLIC_DEPLOYMENT_BLOCK ?? "0");
export const PUB_DAO_ADDRESS = (process.env.NEXT_PUBLIC_DAO_ADDRESS ?? "") as Address;
export const PUB_TOKEN_ADDRESS = (process.env.NEXT_PUBLIC_TOKEN_ADDRESS ?? "") as Address;

Expand All @@ -10,7 +11,8 @@ export const PUB_EMERGENCY_MULTISIG_PLUGIN_ADDRESS = (process.env.NEXT_PUBLIC_EM
"") as Address;
export const PUB_DUAL_GOVERNANCE_PLUGIN_ADDRESS = (process.env.NEXT_PUBLIC_DUAL_GOVERNANCE_PLUGIN_ADDRESS ??
"") as Address;
export const PUB_PUBLIC_KEY_REGISTRY_CONTRACT_ADDRESS = (process.env.NEXT_PUBLIC_PUBLIC_KEY_REGISTRY_CONTRACT_ADDRESS ??
export const PUB_SIGNER_LIST_CONTRACT_ADDRESS = (process.env.NEXT_PUBLIC_SIGNER_LIST_CONTRACT_ADDRESS ?? "") as Address;
export const PUB_ENCRYPTION_REGISTRY_CONTRACT_ADDRESS = (process.env.NEXT_PUBLIC_ENCRYPTION_REGISTRY_CONTRACT_ADDRESS ??
"") as Address;
export const PUB_DELEGATION_WALL_CONTRACT_ADDRESS = (process.env.NEXT_PUBLIC_DELEGATION_WALL_CONTRACT_ADDRESS ??
"") as Address;
Expand Down
5 changes: 2 additions & 3 deletions .eslintrc.cjs → eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/* eslint-env node */
module.exports = {
export default {
extends: ["next/core-web-vitals", "eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"],
parser: "@typescript-eslint/parser",
parserOptions: {
project: "./tsconfig.json",
tsconfigRootDir: __dirname,
tsconfigRootDir: import.meta.dir,
ecmaFeatures: {
jsx: true,
},
Expand All @@ -14,7 +14,6 @@ module.exports = {
"react/jsx-boolean-value": ["warn", "always"],
"no-console": "warn",
"prefer-template": "warn",
"@typescript-eslint/consistent-type-imports": ["warn", { fixStyle: "inline-type-imports" }],
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": ["warn", { ignoreRestSiblings: true }],
"@typescript-eslint/prefer-nullish-coalescing": "warn",
Expand Down
68 changes: 68 additions & 0 deletions hooks/useTransactionManager.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import { useEffect } from "react";
import { useAlerts } from "@/context/Alerts";
import { useWaitForTransactionReceipt, useWriteContract } from "wagmi";

export type TxLifecycleParams = {
onSuccessMessage?: string;
onSuccessDescription?: string;
onSuccess?: () => any;
onErrorMessage?: string;
onErrorDescription?: string;
onError?: () => any;
};

export function useTransactionManager(params: TxLifecycleParams) {
const { onSuccess, onError } = params;
const { writeContract, data: hash, error, status } = useWriteContract();
const { isLoading: isConfirming, isSuccess: isConfirmed } = useWaitForTransactionReceipt({ hash });
const { addAlert } = useAlerts();

useEffect(() => {
if (status === "idle" || status === "pending") {
return;
} else if (status === "error") {
if (error?.message?.startsWith("User rejected the request")) {
addAlert("The transaction signature was declined", {
description: "Nothing has been sent to the network",
timeout: 4 * 1000,
});
} else {
console.error(error);
addAlert(params.onErrorMessage || "Could not fulfill the transaction", {
type: "error",
description: params.onErrorDescription,
});
}

if (typeof onError === "function") {
onError();
}
return;
}

// TX submitted
if (!hash) {
return;
} else if (isConfirming) {
addAlert("Transaction submitted", {
description: "Waiting for the transaction to be validated",
txHash: hash,
});
return;
} else if (!isConfirmed) {
return;
}

addAlert(params.onSuccessMessage ?? "Transaction fulfilled", {
description: params.onSuccessDescription ?? "The transaction has been validated on the network",
type: "success",
txHash: hash,
});

if (typeof onSuccess === "function") {
onSuccess();
}
}, [status, hash, isConfirming, isConfirmed]);

return { writeContract, hash, status, isConfirming, isConfirmed };
}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@tanstack/query-sync-storage-persister": "^5.40.0",
"@tanstack/react-query": "^5.51.11",
"@tanstack/react-query-persist-client": "^5.51.11",
"@typescript-eslint/eslint-plugin": "latest",
"@typescript-eslint/eslint-plugin": "^8.15.0",
"@web3modal/wagmi": "^4.1.9",
"classnames": "^2.5.1",
"dayjs": "^1.11.10",
Expand All @@ -57,8 +57,8 @@
"@types/react-dom": "^18.2.22",
"autoprefixer": "^10.4.19",
"dotenv": "^16.4.5",
"eslint": "^8.57.0",
"eslint-config-next": "14.1.4",
"eslint": "^9.15.0",
"eslint-config-next": "^15.0.3",
"eslint-config-prettier": "^9.1.0",
"husky": "^9.0.11",
"lint-staged": "^15.2.2",
Expand Down
111 changes: 37 additions & 74 deletions plugins/emergency-multisig/artifacts/EmergencyMultisigPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,35 +337,21 @@ export const EmergencyMultisigPluginAbi = [
internalType: "uint16",
},
{
name: "addresslistSource",
name: "signerList",
type: "address",
internalType: "contract Addresslist",
internalType: "contract SignerList",
},
{
name: "proposalExpirationPeriod",
type: "uint32",
internalType: "uint32",
},
],
},
],
outputs: [],
stateMutability: "nonpayable",
},
{
type: "function",
name: "isMember",
inputs: [
{
name: "_account",
type: "address",
internalType: "address",
},
],
outputs: [
{
name: "",
type: "bool",
internalType: "bool",
},
],
stateMutability: "view",
},
{
type: "function",
name: "lastMultisigSettingsChange",
Expand Down Expand Up @@ -395,9 +381,14 @@ export const EmergencyMultisigPluginAbi = [
internalType: "uint16",
},
{
name: "addresslistSource",
name: "signerList",
type: "address",
internalType: "contract Addresslist",
internalType: "contract SignerList",
},
{
name: "proposalExpirationPeriod",
type: "uint32",
internalType: "uint32",
},
],
stateMutability: "view",
Expand Down Expand Up @@ -480,9 +471,14 @@ export const EmergencyMultisigPluginAbi = [
internalType: "uint16",
},
{
name: "addresslistSource",
name: "signerList",
type: "address",
internalType: "contract Addresslist",
internalType: "contract SignerList",
},
{
name: "proposalExpirationPeriod",
type: "uint32",
internalType: "uint32",
},
],
},
Expand Down Expand Up @@ -623,45 +619,6 @@ export const EmergencyMultisigPluginAbi = [
],
anonymous: false,
},
{
type: "event",
name: "MembersAdded",
inputs: [
{
name: "members",
type: "address[]",
indexed: false,
internalType: "address[]",
},
],
anonymous: false,
},
{
type: "event",
name: "MembersRemoved",
inputs: [
{
name: "members",
type: "address[]",
indexed: false,
internalType: "address[]",
},
],
anonymous: false,
},
{
type: "event",
name: "MembershipContractAnnounced",
inputs: [
{
name: "definingContract",
type: "address",
indexed: true,
internalType: "address",
},
],
anonymous: false,
},
{
type: "event",
name: "MultisigSettingsUpdated",
Expand All @@ -679,10 +636,16 @@ export const EmergencyMultisigPluginAbi = [
internalType: "uint16",
},
{
name: "addresslistSource",
name: "signerList",
type: "address",
indexed: false,
internalType: "contract Addresslist",
internalType: "contract SignerList",
},
{
name: "proposalExpirationPeriod",
type: "uint32",
indexed: false,
internalType: "uint32",
},
],
anonymous: false,
Expand Down Expand Up @@ -834,23 +797,23 @@ export const EmergencyMultisigPluginAbi = [
},
{
type: "error",
name: "InvalidAddressListSource",
name: "InvalidMetadataUri",
inputs: [
{
name: "givenContract",
type: "address",
internalType: "address",
name: "proposalId",
type: "uint256",
internalType: "uint256",
},
],
},
{
type: "error",
name: "InvalidMetadataUri",
name: "InvalidSignerList",
inputs: [
{
name: "proposalId",
type: "uint256",
internalType: "uint256",
name: "signerList",
type: "address",
internalType: "contract SignerList",
},
],
},
Expand Down
Loading

0 comments on commit f6b83f7

Please sign in to comment.