Skip to content

Commit

Permalink
Merge pull request #1652 from decentdao/remove-fractalRegistryContrac…
Browse files Browse the repository at this point in the history
…t-from-BaseContracts

Remove fractal registry contract from base contracts
  • Loading branch information
adamgall authored May 7, 2024
2 parents c508a5e + 02ed6ce commit 3434909
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 14 deletions.
68 changes: 68 additions & 0 deletions src/assets/abi/FractalRegistry.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
const FractalRegistryAbi = [
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: 'address',
name: 'daoAddress',
type: 'address',
},
{
indexed: false,
internalType: 'string',
name: 'daoName',
type: 'string',
},
],
name: 'FractalNameUpdated',
type: 'event',
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: 'address',
name: 'parentDAOAddress',
type: 'address',
},
{
indexed: true,
internalType: 'address',
name: 'subDAOAddress',
type: 'address',
},
],
name: 'FractalSubDAODeclared',
type: 'event',
},
{
inputs: [
{
internalType: 'address',
name: '_subDAOAddress',
type: 'address',
},
],
name: 'declareSubDAO',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [
{
internalType: 'string',
name: '_name',
type: 'string',
},
],
name: 'updateDAOName',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
},
] as const;

export default FractalRegistryAbi;
9 changes: 5 additions & 4 deletions src/hooks/DAO/useBuildDAOTx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const useBuildDAOTx = () => {
votesERC20WrapperMasterCopy,
votesERC20MasterCopy,
keyValuePairs,
fractalRegistry,
},
} = useNetworkConfig();

Expand Down Expand Up @@ -54,7 +55,6 @@ const useBuildDAOTx = () => {
linearVotingERC721MasterCopyContract,
fractalAzoriusMasterCopyContract,
zodiacModuleProxyFactoryContract,
fractalRegistryContract,
fractalModuleMasterCopyContract,
multisigFreezeGuardMasterCopyContract,
azoriusFreezeGuardMasterCopyContract,
Expand Down Expand Up @@ -92,9 +92,8 @@ const useBuildDAOTx = () => {
};
}

const buildrerBaseContracts = {
const buildrerBaseContracts: BaseContracts = {
fractalModuleMasterCopyContract: fractalModuleMasterCopyContract.asSigner,
fractalRegistryContract: fractalRegistryContract.asSigner,
safeFactoryContract: safeFactoryContract.asSigner,
safeSingletonContract: safeSingletonContract.asSigner,
multisigFreezeGuardMasterCopyContract: multisigFreezeGuardMasterCopyContract.asSigner,
Expand All @@ -103,7 +102,7 @@ const useBuildDAOTx = () => {
freezeERC721VotingMasterCopyContract: freezeERC721VotingMasterCopyContract.asSigner,
freezeMultisigVotingMasterCopyContract: freezeMultisigVotingMasterCopyContract.asSigner,
zodiacModuleProxyFactoryContract: zodiacModuleProxyFactoryContract.asSigner,
} as BaseContracts;
};

const txBuilderFactory = new TxBuilderFactory(
signerOrProvider,
Expand All @@ -115,6 +114,7 @@ const useBuildDAOTx = () => {
votesERC20WrapperMasterCopy,
votesERC20MasterCopy,
keyValuePairs,
fractalRegistry,
parentAddress,
parentTokenAddress,
);
Expand Down Expand Up @@ -165,6 +165,7 @@ const useBuildDAOTx = () => {
votesERC20WrapperMasterCopy,
votesERC20MasterCopy,
keyValuePairs,
fractalRegistry,
],
);

Expand Down
17 changes: 11 additions & 6 deletions src/hooks/DAO/useDeployAzorius.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const useDeployAzorius = () => {
votesERC20WrapperMasterCopy,
votesERC20MasterCopy,
keyValuePairs,
fractalRegistry,
},
addressPrefix,
} = useNetworkConfig();
Expand Down Expand Up @@ -54,36 +55,38 @@ const useDeployAzorius = () => {
safeFactoryContract,
safeSingletonContract,
linearVotingMasterCopyContract,
linearVotingERC721MasterCopyContract,
fractalAzoriusMasterCopyContract,
zodiacModuleProxyFactoryContract,
fractalRegistryContract,
fractalModuleMasterCopyContract,
multisigFreezeGuardMasterCopyContract,
azoriusFreezeGuardMasterCopyContract,
freezeMultisigVotingMasterCopyContract,
freezeERC20VotingMasterCopyContract,
freezeERC721VotingMasterCopyContract,
claimingMasterCopyContract,
} = baseContracts;
let azoriusContracts;
let azoriusContracts: AzoriusContracts;

azoriusContracts = {
fractalAzoriusMasterCopyContract: fractalAzoriusMasterCopyContract.asProvider,
linearVotingMasterCopyContract: linearVotingMasterCopyContract.asProvider,
linearVotingERC721MasterCopyContract: linearVotingERC721MasterCopyContract.asProvider,
azoriusFreezeGuardMasterCopyContract: azoriusFreezeGuardMasterCopyContract.asProvider,
claimingMasterCopyContract: claimingMasterCopyContract.asProvider,
} as AzoriusContracts;
};

const builderBaseContracts = {
const builderBaseContracts: BaseContracts = {
fractalModuleMasterCopyContract: fractalModuleMasterCopyContract.asProvider,
fractalRegistryContract: fractalRegistryContract.asProvider,
safeFactoryContract: safeFactoryContract.asProvider,
safeSingletonContract: safeSingletonContract.asProvider,
multisigFreezeGuardMasterCopyContract: multisigFreezeGuardMasterCopyContract.asProvider,
multiSendContract: multiSendContract.asProvider,
freezeERC20VotingMasterCopyContract: freezeERC20VotingMasterCopyContract.asProvider,
freezeERC721VotingMasterCopyContract: freezeERC721VotingMasterCopyContract.asProvider,
freezeMultisigVotingMasterCopyContract: freezeMultisigVotingMasterCopyContract.asProvider,
zodiacModuleProxyFactoryContract: zodiacModuleProxyFactoryContract.asProvider,
} as BaseContracts;
};

const txBuilderFactory = new TxBuilderFactory(
signerOrProvider,
Expand All @@ -95,6 +98,7 @@ const useDeployAzorius = () => {
votesERC20WrapperMasterCopy,
votesERC20MasterCopy,
keyValuePairs,
fractalRegistry,
undefined,
undefined,
);
Expand Down Expand Up @@ -156,6 +160,7 @@ const useDeployAzorius = () => {
votesERC20WrapperMasterCopy,
votesERC20MasterCopy,
keyValuePairs,
fractalRegistry,
],
);

Expand Down
9 changes: 7 additions & 2 deletions src/models/DaoTxBuilder.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ethers } from 'ethers';
import { PublicClient, getAddress, zeroAddress } from 'viem';
import FractalRegistryAbi from '../assets/abi/FractalRegistry';
import KeyValuePairsAbi from '../assets/abi/KeyValuePairs';
import { GnosisSafeL2 } from '../assets/typechain-types/usul/@gnosis.pm/safe-contracts/contracts';
import { buildContractCall, buildContractCallViem, encodeMultiSend } from '../helpers';
Expand Down Expand Up @@ -34,6 +35,7 @@ export class DaoTxBuilder extends BaseTxBuilder {
private internalTxs: SafeTransaction[] = [];

private readonly keyValuePairsAddress: string;
private readonly fractalRegistryAddress: string;

constructor(
signerOrProvider: ethers.Signer | any,
Expand All @@ -46,6 +48,7 @@ export class DaoTxBuilder extends BaseTxBuilder {
safeContract: GnosisSafeL2,
txBuilderFactory: TxBuilderFactory,
keyValuePairsAddress: string,
fractalRegistryAddress: string,
parentAddress?: string,
parentTokenAddress?: string,
parentStrategyType?: VotingStrategyType,
Expand All @@ -69,6 +72,7 @@ export class DaoTxBuilder extends BaseTxBuilder {
this.parentStrategyAddress = parentStrategyAddress;

this.keyValuePairsAddress = keyValuePairsAddress;
this.fractalRegistryAddress = fractalRegistryAddress;

// Prep fractal module txs for setting up subDAOs
this.setFractalModuleTxs();
Expand Down Expand Up @@ -227,8 +231,9 @@ export class DaoTxBuilder extends BaseTxBuilder {
//

private buildUpdateDAONameTx(): SafeTransaction {
return buildContractCall(
this.baseContracts.fractalRegistryContract,
return buildContractCallViem(
FractalRegistryAbi,
getAddress(this.fractalRegistryAddress),
'updateDAOName',
[this.daoData.daoName],
0,
Expand Down
4 changes: 4 additions & 0 deletions src/models/TxBuilderFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export class TxBuilderFactory extends BaseTxBuilder {
private votesERC20WrapperMasterCopyAddress: string;
private votesERC20MasterCopyAddress: string;
private keyValuePairsAddress: string;
private fractalRegistryAddress: string;

constructor(
signerOrProvider: ethers.Signer | any,
Expand All @@ -43,6 +44,7 @@ export class TxBuilderFactory extends BaseTxBuilder {
votesERC20WrapperMasterCopyAddress: string,
votesERC20MasterCopyAddress: string,
keyValuePairsAddress: string,
fractalRegistryAddress: string,
parentAddress?: string,
parentTokenAddress?: string,
) {
Expand All @@ -61,6 +63,7 @@ export class TxBuilderFactory extends BaseTxBuilder {
this.votesERC20WrapperMasterCopyAddress = votesERC20WrapperMasterCopyAddress;
this.votesERC20MasterCopyAddress = votesERC20MasterCopyAddress;
this.keyValuePairsAddress = keyValuePairsAddress;
this.fractalRegistryAddress = fractalRegistryAddress;
}

public setSafeContract(safeAddress: string) {
Expand Down Expand Up @@ -100,6 +103,7 @@ export class TxBuilderFactory extends BaseTxBuilder {
this.safeContract!,
this,
this.keyValuePairsAddress,
this.fractalRegistryAddress,
this.parentAddress,
this.parentTokenAddress,
parentStrategyType,
Expand Down
2 changes: 0 additions & 2 deletions src/types/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {
GnosisSafeProxyFactory,
ModuleProxyFactory,
FractalModule,
FractalRegistry,
MultisigFreezeGuard,
MultisigFreezeVoting,
ERC20FreezeVoting,
Expand All @@ -22,7 +21,6 @@ export type ContractConnection<T> = {

export interface BaseContracts {
fractalModuleMasterCopyContract: FractalModule;
fractalRegistryContract: FractalRegistry;
safeFactoryContract: GnosisSafeProxyFactory;
safeSingletonContract: GnosisSafeL2;
multisigFreezeGuardMasterCopyContract: MultisigFreezeGuard;
Expand Down

0 comments on commit 3434909

Please sign in to comment.