Skip to content

Commit

Permalink
update app to use new Typechain types
Browse files Browse the repository at this point in the history
  • Loading branch information
Da-Colon committed Mar 25, 2024
1 parent d151ca5 commit 9686dda
Show file tree
Hide file tree
Showing 13 changed files with 34 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { MultisigFreezeGuard } from '@fractal-framework/fractal-contracts';
import { SafeMultisigTransactionWithTransfersResponse } from '@safe-global/safe-service-client';
import { Signer } from 'ethers';
import { useTranslation } from 'react-i18next';
import { GnosisSafeL2__factory } from '../../../assets/typechain-types/usul/factories/@gnosis.pm/safe-contracts/contracts';
import { SafeL2__factory } from '../../../assets/typechain-types/safe/factories/contracts';
import { BACKGROUND_SEMI_TRANSPARENT } from '../../../constants/common';
import { buildSafeTransaction, buildSignatureBytes, EIP712_SAFE_TX_TYPE } from '../../../helpers';
import { logError } from '../../../helpers/errorLogging';
Expand Down Expand Up @@ -122,7 +122,7 @@ export function TxActions({
if (!signerOrProvider || !safe?.address || !multisigTx.confirmations) {
return;
}
const safeContract = GnosisSafeL2__factory.connect(safe.address, signerOrProvider);
const safeContract = SafeL2__factory.connect(safe.address, signerOrProvider);
const safeTx = buildSafeTransaction({
...multisigTx,
});
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/DAO/loaders/useFractalFreeze.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export const useFractalFreeze = ({
await (freezeVotingContract!.asProvider as MultisigFreezeVoting).parentGnosisSafe(),
);
const owners = await safeContract.getOwners();
userHasVotes = owners.find(owner => owner === account) !== undefined;
userHasVotes = owners.find((owner: string) => owner === account) !== undefined;
} else if (freezeVotingType === FreezeVotingType.ERC20) {
const votesTokenContract = votesTokenMasterCopyContract!.asProvider.attach(
await (freezeVotingContract!.asProvider as ERC20FreezeVoting).votesERC20(),
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/DAO/proposal/useSubmitProposal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { BigNumber, Signer, utils } from 'ethers';
import { getAddress, isAddress } from 'ethers/lib/utils';
import { useCallback, useMemo, useState, useEffect } from 'react';
import { toast } from 'react-toastify';
import { GnosisSafeL2__factory } from '../../../assets/typechain-types/usul/factories/@gnosis.pm/safe-contracts/contracts';
import { SafeL2__factory } from '../../../assets/typechain-types/safe/factories/contracts';
import { ADDRESS_MULTISIG_METADATA } from '../../../constants/common';
import { buildSafeAPIPost, encodeMultiSend } from '../../../helpers';
import { logError } from '../../../helpers/errorLogging';
Expand Down Expand Up @@ -248,7 +248,7 @@ export default function useSubmitProposal() {
operation = 0;
}

const safeContract = GnosisSafeL2__factory.connect(safeAddress, signerOrProvider);
const safeContract = SafeL2__factory.connect(safeAddress, signerOrProvider);
await axios.post(
buildSafeApiUrl(safeBaseURL, `/safes/${safeAddress}/multisig-transactions/`),
await buildSafeAPIPost(
Expand Down
6 changes: 3 additions & 3 deletions src/hooks/safe/useSafeContracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import {
ERC721FreezeVoting__factory,
} from '@fractal-framework/fractal-contracts';
import { useMemo } from 'react';
import { SafeL2__factory } from '../../assets/typechain-types/safe/factories/contracts';
import { MultiSend__factory } from '../../assets/typechain-types/usul';
import { GnosisSafeL2__factory } from '../../assets/typechain-types/usul/factories/@gnosis.pm/safe-contracts/contracts';
import { useEthersProvider } from '../../providers/Ethers/hooks/useEthersProvider';
import { useNetworkConfig } from '../../providers/NetworkConfig/NetworkConfigProvider';
import useSignerOrProvider from '../utils/useSignerOrProvider';
Expand Down Expand Up @@ -79,8 +79,8 @@ export default function useSafeContracts() {
};

const safeSingletonContract = {
asSigner: GnosisSafeL2__factory.connect(safe, signerOrProvider),
asProvider: GnosisSafeL2__factory.connect(safe, provider),
asSigner: SafeL2__factory.connect(safe, signerOrProvider),
asProvider: SafeL2__factory.connect(safe, provider),
};

const zodiacModuleProxyFactoryContract = {
Expand Down
6 changes: 3 additions & 3 deletions src/models/AzoriusTxBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from '@fractal-framework/fractal-contracts';
import { BigNumber } from 'ethers';
import { defaultAbiCoder, getCreate2Address, solidityKeccak256 } from 'ethers/lib/utils';
import { GnosisSafeL2 } from '../assets/typechain-types/usul/@gnosis.pm/safe-contracts/contracts';
import { SafeL2 } from '../assets/typechain-types/safe/contracts';
import { buildContractCall, getRandomBytes } from '../helpers';
import {
BaseContracts,
Expand All @@ -25,7 +25,7 @@ import { BaseTxBuilder } from './BaseTxBuilder';
import { generateContractByteCodeLinear, generateSalt } from './helpers/utils';

export class AzoriusTxBuilder extends BaseTxBuilder {
private readonly safeContract: GnosisSafeL2;
private readonly safeContract: SafeL2;
private readonly predictedSafeAddress: string;

private encodedSetupTokenData: string | undefined;
Expand Down Expand Up @@ -54,7 +54,7 @@ export class AzoriusTxBuilder extends BaseTxBuilder {
baseContracts: BaseContracts,
azoriusContracts: AzoriusContracts,
daoData: AzoriusERC20DAO | AzoriusERC721DAO,
safeContract: GnosisSafeL2,
safeContract: SafeL2,
predictedSafeAddress: string,
parentAddress?: string,
parentTokenAddress?: string,
Expand Down
6 changes: 3 additions & 3 deletions src/models/DaoTxBuilder.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ethers } from 'ethers';
import { GnosisSafeL2 } from '../assets/typechain-types/usul/@gnosis.pm/safe-contracts/contracts';
import { SafeL2 } from '../assets/typechain-types/safe/contracts';
import { buildContractCall, encodeMultiSend } from '../helpers';
import {
BaseContracts,
Expand All @@ -24,7 +24,7 @@ export class DaoTxBuilder extends BaseTxBuilder {
// Safe Data
private predictedSafeAddress: string;
private readonly createSafeTx: SafeTransaction;
private readonly safeContract: GnosisSafeL2;
private readonly safeContract: SafeL2;
private readonly parentStrategyType?: VotingStrategyType;
private readonly parentStrategyAddress?: string;

Expand All @@ -42,7 +42,7 @@ export class DaoTxBuilder extends BaseTxBuilder {
saltNum: string,
predictedSafeAddress: string,
createSafeTx: SafeTransaction,
safeContract: GnosisSafeL2,
safeContract: SafeL2,
txBuilderFactory: TxBuilderFactory,
parentAddress?: string,
parentTokenAddress?: string,
Expand Down
8 changes: 4 additions & 4 deletions src/models/FreezeGuardTxBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from '@fractal-framework/fractal-contracts';
import { ethers } from 'ethers';
import { getCreate2Address, solidityKeccak256 } from 'ethers/lib/utils';
import { GnosisSafeL2 } from '../assets/typechain-types/usul/@gnosis.pm/safe-contracts/contracts';
import { SafeL2 } from '../assets/typechain-types/safe/contracts';
import { buildContractCall } from '../helpers';
import {
BaseContracts,
Expand All @@ -33,7 +33,7 @@ export class FreezeGuardTxBuilder extends BaseTxBuilder {
private readonly saltNum;

// Safe Data
private readonly safeContract: GnosisSafeL2;
private readonly safeContract: SafeL2;

// Freeze Voting Data
private freezeVotingType: any;
Expand All @@ -55,7 +55,7 @@ export class FreezeGuardTxBuilder extends BaseTxBuilder {
signerOrProvider: any,
baseContracts: BaseContracts,
daoData: SubDAO,
safeContract: GnosisSafeL2,
safeContract: SafeL2,
saltNum: string,
parentAddress: string,
parentTokenAddress?: string,
Expand Down Expand Up @@ -134,7 +134,7 @@ export class FreezeGuardTxBuilder extends BaseTxBuilder {
);
}

public buildSetGuardTx(contract: GnosisSafeL2 | Azorius): SafeTransaction {
public buildSetGuardTx(contract: SafeL2 | Azorius): SafeTransaction {
return buildContractCall(contract, 'setGuard', [this.freezeGuardAddress], 0, false);
}

Expand Down
6 changes: 3 additions & 3 deletions src/models/MultisigTxBuilder.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { GnosisSafeL2 } from '../assets/typechain-types/usul/@gnosis.pm/safe-contracts/contracts';
import { SafeL2 } from '../assets/typechain-types/safe/contracts';
import { buildContractCall } from '../helpers';
import { BaseContracts, SafeMultisigDAO, SafeTransaction } from '../types';

export class MultisigTxBuilder {
private baseContracts: BaseContracts;
private readonly daoData: SafeMultisigDAO;
private readonly safeContract: GnosisSafeL2;
private readonly safeContract: SafeL2;

constructor(baseContracts: BaseContracts, daoData: SafeMultisigDAO, safeContract: GnosisSafeL2) {
constructor(baseContracts: BaseContracts, daoData: SafeMultisigDAO, safeContract: SafeL2) {
this.baseContracts = baseContracts;
this.daoData = daoData;
this.safeContract = safeContract;
Expand Down
8 changes: 4 additions & 4 deletions src/models/TxBuilderFactory.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ethers } from 'ethers';
import { GnosisSafeL2 } from '../assets/typechain-types/usul/@gnosis.pm/safe-contracts/contracts';
import { GnosisSafeL2__factory } from '../assets/typechain-types/usul/factories/@gnosis.pm/safe-contracts/contracts';
import { SafeL2 } from '../assets/typechain-types/safe/contracts';
import { SafeL2__factory } from '../assets/typechain-types/safe/factories/contracts';
import { getRandomBytes } from '../helpers';
import {
BaseContracts,
Expand All @@ -25,7 +25,7 @@ export class TxBuilderFactory extends BaseTxBuilder {
// Safe Data
public predictedSafeAddress: string | undefined;
public createSafeTx: SafeTransaction | undefined;
private safeContract: GnosisSafeL2 | undefined;
private safeContract: SafeL2 | undefined;
public fallbackHandler: string;

constructor(
Expand All @@ -51,7 +51,7 @@ export class TxBuilderFactory extends BaseTxBuilder {
}

public setSafeContract(safeAddress: string) {
const safeContract = GnosisSafeL2__factory.connect(safeAddress, this.signerOrProvider);
const safeContract = SafeL2__factory.connect(safeAddress, this.signerOrProvider);
this.safeContract = safeContract;
}

Expand Down
4 changes: 2 additions & 2 deletions src/models/helpers/fractalModuleData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
ModuleProxyFactory,
} from '@fractal-framework/fractal-contracts';
import { ethers } from 'ethers';
import { GnosisSafeL2 } from '../../assets/typechain-types/usul/@gnosis.pm/safe-contracts/contracts';
import { SafeL2 } from '../../assets/typechain-types/safe/contracts';
import { buildContractCall } from '../../helpers/crypto';
import { SafeTransaction } from '../../types';
import {
Expand All @@ -23,7 +23,7 @@ export interface FractalModuleData {
export const fractalModuleData = (
fractalModuleMasterCopyContract: FractalModule,
zodiacModuleProxyFactoryContract: ModuleProxyFactory,
safeContract: GnosisSafeL2,
safeContract: SafeL2,
saltNum: string,
parentAddress?: string,
): FractalModuleData => {
Expand Down
4 changes: 2 additions & 2 deletions src/models/helpers/safeData.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { GnosisSafeProxyFactory } from '@fractal-framework/fractal-contracts';
import { ethers } from 'ethers';
import { getCreate2Address, solidityKeccak256 } from 'ethers/lib/utils';
import { SafeL2 } from '../../assets/typechain-types/safe/contracts';
import { MultiSend } from '../../assets/typechain-types/usul';
import { GnosisSafeL2 } from '../../assets/typechain-types/usul/@gnosis.pm/safe-contracts/contracts';
import { buildContractCall } from '../../helpers/crypto';
import { SafeMultisigDAO } from '../../types';
const { AddressZero, HashZero } = ethers.constants;

export const safeData = async (
multiSendContract: MultiSend,
safeFactoryContract: GnosisSafeProxyFactory,
safeSingletonContract: GnosisSafeL2,
safeSingletonContract: SafeL2,
daoData: SafeMultisigDAO,
saltNum: string,
fallbackHandler: string,
Expand Down
6 changes: 3 additions & 3 deletions src/types/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import {
KeyValuePairs,
ERC721FreezeVoting,
} from '@fractal-framework/fractal-contracts';
import { SafeL2 } from '../assets/typechain-types/safe/contracts';
import { MultiSend } from '../assets/typechain-types/usul';
import { GnosisSafeL2 } from '../assets/typechain-types/usul/@gnosis.pm/safe-contracts/contracts';

export interface ContractEvent {
blockTimestamp: number;
Expand All @@ -31,7 +31,7 @@ export interface DAOContracts {
safeFactoryContract: ContractConnection<GnosisSafeProxyFactory>;
fractalAzoriusMasterCopyContract: ContractConnection<Azorius>;
linearVotingMasterCopyContract: ContractConnection<LinearERC20Voting>;
safeSingletonContract: ContractConnection<GnosisSafeL2>;
safeSingletonContract: ContractConnection<SafeL2>;
zodiacModuleProxyFactoryContract: ContractConnection<ModuleProxyFactory>;
fractalModuleMasterCopyContract: ContractConnection<FractalModule>;
fractalRegistryContract: ContractConnection<FractalRegistry>;
Expand All @@ -48,7 +48,7 @@ export interface BaseContracts {
fractalModuleMasterCopyContract: FractalModule;
fractalRegistryContract: FractalRegistry;
safeFactoryContract: GnosisSafeProxyFactory;
safeSingletonContract: GnosisSafeL2;
safeSingletonContract: SafeL2;
multisigFreezeGuardMasterCopyContract: MultisigFreezeGuard;
multiSendContract: MultiSend;
freezeERC20VotingMasterCopyContract: ERC20FreezeVoting;
Expand Down
4 changes: 2 additions & 2 deletions src/types/fractal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import {
} from '@safe-global/safe-service-client';
import { BigNumber } from 'ethers';
import { Dispatch } from 'react';
import { SafeL2 } from '../assets/typechain-types/safe/contracts';
import { MultiSend } from '../assets/typechain-types/usul';
import { GnosisSafeL2 } from '../assets/typechain-types/usul/@gnosis.pm/safe-contracts/contracts';
import { FractalGovernanceActions } from '../providers/App/governance/action';
import { GovernanceContractActions } from '../providers/App/governanceContracts/action';
import { FractalGuardActions } from '../providers/App/guard/action';
Expand Down Expand Up @@ -346,7 +346,7 @@ export interface FractalContracts {
fractalAzoriusMasterCopyContract: ContractConnection<Azorius>;
linearVotingMasterCopyContract: ContractConnection<LinearERC20Voting>;
linearVotingERC721MasterCopyContract: ContractConnection<LinearERC721Voting>;
safeSingletonContract: ContractConnection<GnosisSafeL2>;
safeSingletonContract: ContractConnection<SafeL2>;
zodiacModuleProxyFactoryContract: ContractConnection<ModuleProxyFactory>;
fractalModuleMasterCopyContract: ContractConnection<FractalModule>;
fractalRegistryContract: ContractConnection<FractalRegistry>;
Expand Down

0 comments on commit 9686dda

Please sign in to comment.