diff --git a/src/pages/daos/[daoAddress]/treasury/index.tsx b/src/pages/daos/[daoAddress]/treasury/index.tsx
index 46c8dcbda7..ac0eb23088 100644
--- a/src/pages/daos/[daoAddress]/treasury/index.tsx
+++ b/src/pages/daos/[daoAddress]/treasury/index.tsx
@@ -17,7 +17,7 @@ export default function Treasury() {
const { t } = useTranslation('treasury');
const treasuryTotal = useTreasuryTotalBN();
const { canUserCreateProposal } = useCanUserCreateProposal();
- const showButton = canUserCreateProposal && !treasuryTotal.isZero();
+ const showButton = canUserCreateProposal && treasuryTotal !== 0n;
return (
diff --git a/src/providers/App/combinedReducer.ts b/src/providers/App/combinedReducer.ts
index 3e4aa5afc2..c0c6ce0df8 100644
--- a/src/providers/App/combinedReducer.ts
+++ b/src/providers/App/combinedReducer.ts
@@ -1,4 +1,3 @@
-import { BigNumber } from 'ethers';
import { Fractal, FractalActions, StoreAction } from '../../types';
import { FractalGovernanceActions } from './governance/action';
import { governanceReducer, initialGovernanceState } from './governance/reducer';
@@ -27,7 +26,7 @@ export const initialState = {
dao: null,
user: {
address: undefined,
- votingWeight: BigNumber.from(0),
+ votingWeight: 0n,
},
},
};
diff --git a/src/providers/App/governance/action.ts b/src/providers/App/governance/action.ts
index 0293593ea8..601f08b628 100644
--- a/src/providers/App/governance/action.ts
+++ b/src/providers/App/governance/action.ts
@@ -1,5 +1,4 @@
import { ERC20Claim } from '@fractal-framework/fractal-contracts';
-import { BigNumber } from 'ethers';
import {
FractalProposal,
ProposalVotesSummary,
@@ -48,7 +47,7 @@ type AzoriusVotePayload = {
votesSummary: ProposalVotesSummary;
};
-export type ERC20VotePayload = { weight: BigNumber } & AzoriusVotePayload;
+export type ERC20VotePayload = { weight: bigint } & AzoriusVotePayload;
export type ERC721VotePayload = {
tokenAddresses: string[];
tokenIds: string[];
@@ -85,19 +84,19 @@ export type FractalGovernanceActions =
}
| {
type: FractalGovernanceAction.UPDATE_VOTING_PERIOD;
- payload: BigNumber;
+ payload: bigint;
}
| {
type: FractalGovernanceAction.UPDATE_VOTING_QUORUM;
- payload: BigNumber;
+ payload: bigint;
}
| {
type: FractalGovernanceAction.UPDATE_VOTING_QUORUM_THRESHOLD;
- payload: BigNumber;
+ payload: bigint;
}
| {
type: FractalGovernanceAction.UPDATE_TIMELOCK_PERIOD;
- payload: BigNumber;
+ payload: bigint;
}
| { type: FractalGovernanceAction.SET_ERC721_TOKENS_DATA; payload: ERC721TokenData[] }
| {
diff --git a/src/providers/App/guard/action.ts b/src/providers/App/guard/action.ts
index 7ae99a90e4..c81f63c1be 100644
--- a/src/providers/App/guard/action.ts
+++ b/src/providers/App/guard/action.ts
@@ -1,4 +1,3 @@
-import { BigNumber } from 'ethers';
import { FreezeGuard } from '../../../types';
export enum FractalGuardAction {
SET_FREEZE_GUARD = 'SET_FREEZE_GUARD',
@@ -10,7 +9,7 @@ export type FractalGuardActions =
type: FractalGuardAction.UPDATE_FREEZE_VOTE;
payload: {
isVoter: boolean;
- freezeProposalCreatedTime: BigNumber;
- votesCast: BigNumber;
+ freezeProposalCreatedTime: bigint;
+ votesCast: bigint;
};
};
diff --git a/src/providers/App/guard/reducer.ts b/src/providers/App/guard/reducer.ts
index 017cd04250..12c36c3033 100644
--- a/src/providers/App/guard/reducer.ts
+++ b/src/providers/App/guard/reducer.ts
@@ -19,7 +19,7 @@ export function guardReducer(state: FreezeGuard, action: FractalGuardActions) {
}
case FractalGuardAction.UPDATE_FREEZE_VOTE: {
const { isVoter, votesCast, freezeProposalCreatedTime } = action.payload;
- const isFrozen = votesCast.gte(state.freezeVotesThreshold || 0);
+ const isFrozen = votesCast >= (state.freezeVotesThreshold || 0);
const userHasFreezeVoted = isVoter || state.userHasVotes;
const userHasVotes = !userHasFreezeVoted || state.userHasVotes;
return {
diff --git a/src/providers/App/useReadOnlyValues.ts b/src/providers/App/useReadOnlyValues.ts
index 40de2c8f53..468cb4db90 100644
--- a/src/providers/App/useReadOnlyValues.ts
+++ b/src/providers/App/useReadOnlyValues.ts
@@ -1,5 +1,5 @@
import { ERC721__factory } from '@fractal-framework/fractal-contracts';
-import { BigNumber, utils } from 'ethers';
+import { utils } from 'ethers';
import { useEffect, useState, useCallback } from 'react';
import useSignerOrProvider from '../../hooks/utils/useSignerOrProvider';
import {
@@ -13,7 +13,7 @@ import {
const INITIAL_READ_ONLY_VALUES: ReadOnlyState = {
user: {
address: undefined,
- votingWeight: BigNumber.from(0),
+ votingWeight: 0n,
},
dao: null,
};
@@ -33,27 +33,27 @@ export const useReadOnlyValues = ({ node, governance }: Fractal, _account?: stri
switch (governance.type) {
case GovernanceType.MULTISIG:
const isSigner = _account && node.safe?.owners.includes(_account);
- return isSigner ? BigNumber.from(1) : BigNumber.from(0);
+ return isSigner ? 1n : 0n;
case GovernanceType.AZORIUS_ERC20:
const lockedTokenWeight = (governance as DecentGovernance).lockedVotesToken?.votingWeight;
- const tokenWeight = azoriusGovernance.votesToken?.votingWeight || BigNumber.from(0);
+ const tokenWeight = azoriusGovernance.votesToken?.votingWeight || 0n;
return lockedTokenWeight || tokenWeight;
case GovernanceType.AZORIUS_ERC721:
if (!_account || !azoriusGovernance.erc721Tokens || !signerOrProvider) {
- return BigNumber.from(0);
+ return 0n;
}
const userVotingWeight = (
await Promise.all(
azoriusGovernance.erc721Tokens.map(async ({ address, votingWeight }) => {
const tokenContract = ERC721__factory.connect(address, signerOrProvider);
- const userBalance = await tokenContract.balanceOf(_account);
- return userBalance.mul(votingWeight);
+ const userBalance = (await tokenContract.balanceOf(_account)).toBigInt();
+ return userBalance * votingWeight;
}),
)
- ).reduce((prev, curr) => prev.add(curr), BigNumber.from(0));
+ ).reduce((prev, curr) => prev + curr, 0n);
return userVotingWeight;
default:
- return BigNumber.from(0);
+ return 0n;
}
};
diff --git a/src/providers/NetworkConfig/networks/index.ts b/src/providers/NetworkConfig/networks/index.ts
index 4a479a67d1..9d8615a893 100644
--- a/src/providers/NetworkConfig/networks/index.ts
+++ b/src/providers/NetworkConfig/networks/index.ts
@@ -3,3 +3,4 @@ export * from './mainnet';
export * from './polygon';
export * from './baseSepolia';
export * from './base';
+export * from './optimism';
diff --git a/src/providers/NetworkConfig/networks/optimism.ts b/src/providers/NetworkConfig/networks/optimism.ts
new file mode 100644
index 0000000000..af91cfc650
--- /dev/null
+++ b/src/providers/NetworkConfig/networks/optimism.ts
@@ -0,0 +1,79 @@
+import Azorius from '@fractal-framework/fractal-contracts/deployments/optimism/Azorius.json';
+import AzoriusFreezeGuard from '@fractal-framework/fractal-contracts/deployments/optimism/AzoriusFreezeGuard.json';
+import ERC20Claim from '@fractal-framework/fractal-contracts/deployments/optimism/ERC20Claim.json';
+import ERC20FreezeVoting from '@fractal-framework/fractal-contracts/deployments/optimism/ERC20FreezeVoting.json';
+import ERC721FreezeVoting from '@fractal-framework/fractal-contracts/deployments/optimism/ERC721FreezeVoting.json';
+import FractalModule from '@fractal-framework/fractal-contracts/deployments/optimism/FractalModule.json';
+import FractalRegistry from '@fractal-framework/fractal-contracts/deployments/optimism/FractalRegistry.json';
+import KeyValuePairs from '@fractal-framework/fractal-contracts/deployments/optimism/KeyValuePairs.json';
+import LinearERC20Voting from '@fractal-framework/fractal-contracts/deployments/optimism/LinearERC20Voting.json';
+import LinearVotingERC721 from '@fractal-framework/fractal-contracts/deployments/optimism/LinearERC721Voting.json';
+import ModuleProxyFactory from '@fractal-framework/fractal-contracts/deployments/optimism/ModuleProxyFactory.json';
+import MultisigFreezeGuard from '@fractal-framework/fractal-contracts/deployments/optimism/MultisigFreezeGuard.json';
+import MultisigFreezeVoting from '@fractal-framework/fractal-contracts/deployments/optimism/MultisigFreezeVoting.json';
+import VotesERC20 from '@fractal-framework/fractal-contracts/deployments/optimism/VotesERC20.json';
+import VotesERC20Wrapper from '@fractal-framework/fractal-contracts/deployments/optimism/VotesERC20Wrapper.json';
+import {
+ getProxyFactoryDeployment,
+ getMultiSendCallOnlyDeployment,
+ getSafeL2SingletonDeployment,
+ getCompatibilityFallbackHandlerDeployment,
+} from '@safe-global/safe-deployments';
+import { optimism } from 'wagmi/chains';
+import { GovernanceType } from '../../../types';
+import { NetworkConfig } from '../../../types/network';
+
+const SAFE_VERSION = '1.3.0';
+
+export const optimismConfig: NetworkConfig = {
+ order: 15,
+ chain: optimism,
+ rpcEndpoint: `https://opt-mainnet.g.alchemy.com/v2/${import.meta.env.VITE_APP_ALCHEMY_OPTIMISM_API_KEY}`,
+ safeBaseURL: 'https://safe-transaction-optimism.safe.global',
+ etherscanBaseURL: 'https://optimistic.etherscan.io/',
+ etherscanAPIUrl: `https://api-optimistic.etherscan.io/api?apikey=${import.meta.env.VITE_APP_ETHERSCAN_OPTIMISM_API_KEY}`,
+ addressPrefix: 'oeth',
+ nativeTokenIcon: '/images/coin-icon-eth.svg',
+ subgraph: {
+ space: 71032,
+ slug: 'fractal-optimism',
+ version: 'v0.0.1',
+ },
+ contracts: {
+ fractalAzoriusMasterCopy: Azorius.address,
+ fractalModuleMasterCopy: FractalModule.address,
+ fractalRegistry: FractalRegistry.address,
+ votesERC20MasterCopy: VotesERC20.address,
+ linearVotingERC721MasterCopy: LinearVotingERC721.address,
+ claimingMasterCopy: ERC20Claim.address,
+ azoriusFreezeGuardMasterCopy: AzoriusFreezeGuard.address,
+ multisigFreezeVotingMasterCopy: MultisigFreezeVoting.address,
+ erc20FreezeVotingMasterCopy: ERC20FreezeVoting.address,
+ erc721FreezeVotingMasterCopy: ERC721FreezeVoting.address,
+ multisigFreezeGuardMasterCopy: MultisigFreezeGuard.address,
+ fallbackHandler: getCompatibilityFallbackHandlerDeployment({
+ version: SAFE_VERSION,
+ network: optimism.id.toString(),
+ })?.networkAddresses[optimism.id.toString()]!,
+ safe: getSafeL2SingletonDeployment({ version: SAFE_VERSION, network: optimism.id.toString() })
+ ?.networkAddresses[optimism.id.toString()]!,
+ safeFactory: getProxyFactoryDeployment({
+ version: SAFE_VERSION,
+ network: optimism.id.toString(),
+ })?.networkAddresses[optimism.id.toString()]!,
+ zodiacModuleProxyFactory: ModuleProxyFactory.address,
+ linearVotingMasterCopy: LinearERC20Voting.address,
+ multisend: getMultiSendCallOnlyDeployment({
+ version: SAFE_VERSION,
+ network: optimism.id.toString(),
+ })?.networkAddresses[optimism.id.toString()]!,
+ votesERC20WrapperMasterCopy: VotesERC20Wrapper.address,
+ keyValuePairs: KeyValuePairs.address,
+ },
+ staking: {},
+ createOptions: [
+ GovernanceType.MULTISIG,
+ GovernanceType.AZORIUS_ERC20,
+ GovernanceType.AZORIUS_ERC721,
+ ],
+};
diff --git a/src/types/account.ts b/src/types/account.ts
index 1dbb7c448b..95e235ca6c 100644
--- a/src/types/account.ts
+++ b/src/types/account.ts
@@ -1,10 +1,8 @@
-import { BigNumber } from 'ethers';
-
export interface VotesTokenData extends VotesData, ERC20TokenData {}
export interface VotesData {
- balance: BigNumber | null;
+ balance: bigint | null;
delegatee: string | null;
- votingWeight: BigNumber | null;
+ votingWeight: bigint | null;
isDelegatesSet: boolean | null;
}
export type UnderlyingTokenData = Omit<
@@ -19,11 +17,11 @@ export interface BaseTokenData {
}
export interface ERC20TokenData extends BaseTokenData {
decimals: number;
- totalSupply: BigNumber;
+ totalSupply: bigint;
underlyingTokenData?: UnderlyingTokenData;
}
export interface ERC721TokenData extends BaseTokenData {
- totalSupply?: BigNumber;
- votingWeight: BigNumber;
+ totalSupply?: bigint;
+ votingWeight: bigint;
}
diff --git a/src/types/common.ts b/src/types/common.ts
index de450d9095..911e89e1fb 100644
--- a/src/types/common.ts
+++ b/src/types/common.ts
@@ -1,8 +1,6 @@
-import { BigNumber } from 'ethers';
-
-export interface BigNumberValuePair {
+export interface BigIntValuePair {
value: string;
- bigNumberValue?: BigNumber;
+ bigintValue?: bigint;
}
export type WithError = { error?: string };
diff --git a/src/types/createDAO.ts b/src/types/createDAO.ts
index 275cdfdc11..21cbf986b7 100644
--- a/src/types/createDAO.ts
+++ b/src/types/createDAO.ts
@@ -1,8 +1,7 @@
import { SafeBalanceUsdResponse, SafeCollectibleResponse } from '@safe-global/safe-service-client';
-import { BigNumber } from 'ethers';
import { FormikProps } from 'formik';
import { DAOCreateMode } from '../components/DaoCreator/formComponents/EstablishEssentials';
-import { BigNumberValuePair } from './common';
+import { BigIntValuePair } from './common';
import { GovernanceType, VotingStrategyType } from './fractal';
import { EthAddress } from './utils';
@@ -27,7 +26,7 @@ export interface ICreationStepProps extends Omit
,
mode: DAOCreateMode;
}
-export interface CreatorFormState {
+export interface CreatorFormState {
essentials: DAOEssentials;
multisig: SafeConfiguration;
azorius: DAOGovernorModuleConfig;
@@ -42,7 +41,7 @@ export type DAOEssentials = {
snapshotURL: string;
};
-export type DAOGovernorERC20Token = {
+export type DAOGovernorERC20Token = {
tokenCreationType: TokenCreationType;
tokenImportAddress?: string;
tokenName: string;
@@ -52,17 +51,17 @@ export type DAOGovernorERC20Token = {
parentAllocationAmount: T;
};
-export type ERC721TokenConfig = {
+export type ERC721TokenConfig = {
tokenAddress: string;
tokenWeight: T;
};
-export type DAOGovernorERC721Token = {
+export type DAOGovernorERC721Token = {
nfts: ERC721TokenConfig[];
quorumThreshold: T;
};
-export type DAOGovernorModuleConfig = {
+export type DAOGovernorModuleConfig = {
votingStrategyType: VotingStrategyType;
quorumPercentage: T;
timelock: T;
@@ -70,7 +69,7 @@ export type DAOGovernorModuleConfig = {
executionPeriod: T;
};
-export type DAOFreezeGuardConfig = {
+export type DAOFreezeGuardConfig = {
executionPeriod: T;
timelockPeriod: T;
freezeVotesThreshold: T;
@@ -85,23 +84,23 @@ export interface SafeConfiguration {
customNonce: number;
}
-export interface SubDAO
+export interface SubDAO
extends SafeConfiguration,
AzoriusGovernanceDAO,
DAOFreezeGuardConfig {}
-export interface AzoriusGovernanceDAO
+export interface AzoriusGovernanceDAO
extends DAOEssentials,
DAOGovernorModuleConfig {}
-export interface AzoriusERC20DAO
+export interface AzoriusERC20DAO
extends AzoriusGovernanceDAO,
DAOGovernorERC20Token {
isVotesToken?: boolean;
isTokenImported?: boolean;
}
-export interface AzoriusERC721DAO
+export interface AzoriusERC721DAO
extends AzoriusGovernanceDAO,
DAOGovernorERC721Token {}
@@ -120,14 +119,14 @@ export type AddressValidation = {
export type TokenToFund = {
asset: SafeBalanceUsdResponse;
- amount: BigNumberValuePair;
+ amount: BigIntValuePair;
};
export type NFTToFund = {
asset: SafeCollectibleResponse;
};
-export type TokenAllocation = {
+export type TokenAllocation = {
amount: T;
} & EthAddress;
diff --git a/src/types/createProposal.ts b/src/types/createProposal.ts
index dbb8522d44..5a62fbc7ef 100644
--- a/src/types/createProposal.ts
+++ b/src/types/createProposal.ts
@@ -1,11 +1,11 @@
-import { BigNumberValuePair } from './common';
+import { BigIntValuePair } from './common';
export enum CreateProposalState {
METADATA_FORM,
TRANSACTIONS_FORM,
}
-export interface CreateProposalTransaction {
+export interface CreateProposalTransaction {
targetAddress: string;
ethValue: T;
functionName: string;
diff --git a/src/types/createProposalTemplate.ts b/src/types/createProposalTemplate.ts
index bab428f939..2046a4655f 100644
--- a/src/types/createProposalTemplate.ts
+++ b/src/types/createProposalTemplate.ts
@@ -1,11 +1,11 @@
-import { BigNumberValuePair } from './common';
+import { BigIntValuePair } from './common';
export enum CreateProposalTemplateFormState {
METADATA_FORM,
TRANSACTIONS_FORM,
}
-export interface CreateProposalTemplateTransaction {
+export interface CreateProposalTemplateTransaction {
targetAddress: string;
ethValue: T;
functionName: string;
diff --git a/src/types/daoGuard.ts b/src/types/daoGuard.ts
index a14cac4611..85f358478c 100644
--- a/src/types/daoGuard.ts
+++ b/src/types/daoGuard.ts
@@ -4,7 +4,6 @@ import {
ERC20FreezeVoting,
MultisigFreezeVoting,
} from '@fractal-framework/fractal-contracts';
-import { BigNumber } from 'ethers';
import { ContractConnection } from './contract';
import { FreezeGuardType, FreezeVotingType } from './daoGovernance';
@@ -15,4 +14,4 @@ export interface IMultisigFreezeContract {
freezeVotingType: FreezeVotingType;
}
-export type FreezeVoteCastedListener = (voter: string, votesCast: BigNumber, _: any) => void;
+export type FreezeVoteCastedListener = (voter: string, votesCast: bigint, _: any) => void;
diff --git a/src/types/daoProposal.ts b/src/types/daoProposal.ts
index 3783e86e4f..80be7418d4 100644
--- a/src/types/daoProposal.ts
+++ b/src/types/daoProposal.ts
@@ -1,4 +1,3 @@
-import { BigNumber, BigNumberish } from 'ethers';
import { ProposalMetadata } from './createProposal';
import { GovernanceActivity } from './fractal';
import { SafeMultisigConfirmationResponse } from './safeGlobal';
@@ -10,7 +9,7 @@ export interface ProposalExecuteData extends ExecuteData {
export interface ExecuteData {
targets: string[];
- values: BigNumberish[];
+ values: bigint[];
calldatas: string[];
}
@@ -31,7 +30,7 @@ export interface AzoriusProposal extends GovernanceActivity {
votes: ProposalVote[] | ERC721ProposalVote[];
/** The deadline timestamp for the proposal, in milliseconds. */
deadlineMs: number;
- startBlock: BigNumber;
+ startBlock: bigint;
}
export interface AzoriusERC721Proposal extends AzoriusProposal {
@@ -114,16 +113,16 @@ export interface ExtendedSnapshotProposal extends SnapshotProposal {
}
export type ProposalVotesSummary = {
- yes: BigNumber;
- no: BigNumber;
- abstain: BigNumber;
- quorum: BigNumber;
+ yes: bigint;
+ no: bigint;
+ abstain: bigint;
+ quorum: bigint;
};
export type ProposalVote = {
voter: string;
choice: (typeof VOTE_CHOICES)[number];
- weight: BigNumber;
+ weight: bigint;
};
export type ERC721ProposalVote = {
diff --git a/src/types/daoTreasury.ts b/src/types/daoTreasury.ts
index eb14e6df7b..8a80770da6 100644
--- a/src/types/daoTreasury.ts
+++ b/src/types/daoTreasury.ts
@@ -3,7 +3,6 @@ import {
SafeCollectibleResponse,
TransferResponse,
} from '@safe-global/safe-service-client';
-import { BigNumber } from 'ethers';
import { ContractEvent } from './contract';
import { ActivityBase } from './fractal';
import { AllTransfersListResponse } from './safeGlobal';
@@ -21,21 +20,21 @@ export interface TokenEvent extends ContractEvent {
}
export interface TokenDepositEvent extends TokenEvent, EthAddress {
- amount: BigNumber;
+ amount: bigint;
}
export interface TokenWithdrawEvent extends TokenEvent {
addresses: string[];
- amount: BigNumber;
+ amount: bigint;
}
export interface ERC721TokenEvent extends TokenEvent {
contractAddresses: string[];
- tokenIds: BigNumber[];
+ tokenIds: bigint[];
}
export interface ERC20TokenEvent extends TokenEvent {
contractAddresses: string[];
addresses: string[];
- amounts: BigNumber[];
+ amounts: bigint[];
}
export type Transaction =
@@ -77,7 +76,7 @@ export interface AssetTransfer extends TransferResponse {
}
export type AssetTotals = {
- bn: BigNumber;
+ bi: bigint;
symbol: string;
decimals: number;
};
diff --git a/src/types/fractal.ts b/src/types/fractal.ts
index 94223dd398..78378d41c1 100644
--- a/src/types/fractal.ts
+++ b/src/types/fractal.ts
@@ -23,7 +23,6 @@ import {
SafeBalanceUsdResponse,
SafeCollectibleResponse,
} from '@safe-global/safe-service-client';
-import { BigNumber } from 'ethers';
import { Dispatch } from 'react';
import { MultiSend } from '../assets/typechain-types/usul';
import { GnosisSafeL2 } from '../assets/typechain-types/usul/@gnosis.pm/safe-contracts/contracts';
@@ -40,7 +39,7 @@ import { FreezeGuardType, FreezeVotingType } from './daoGovernance';
import { ProposalData, MultisigProposal, AzoriusProposal, SnapshotProposal } from './daoProposal';
import { TreasuryActivity } from './daoTreasury';
import { AllTransfersListResponse, SafeInfoResponseWithGuard } from './safeGlobal';
-import { BNFormattedPair } from './votingFungibleToken';
+import { BIFormattedPair } from './votingFungibleToken';
/**
* The possible states of a DAO proposal, for both Token Voting (Azorius) and Multisignature
* (Safe) governance, as well as Snapshot specific states.
@@ -178,10 +177,10 @@ export enum SafeTransferType {
}
export interface ITokenAccount {
- userBalance: BigNumber | undefined;
+ userBalance: bigint | undefined;
userBalanceString: string | undefined;
delegatee: string | undefined;
- votingWeight: BigNumber | undefined;
+ votingWeight: bigint | undefined;
votingWeightString: string | undefined;
isDelegatesSet: boolean | undefined;
}
@@ -266,11 +265,11 @@ export interface FractalGuardContracts {
}
export interface FreezeGuard {
- freezeVotesThreshold: BigNumber | null; // Number of freeze votes required to activate a freeze
- freezeProposalCreatedTime: BigNumber | null; // Block number the freeze proposal was created at
- freezeProposalVoteCount: BigNumber | null; // Number of accrued freeze votes
- freezeProposalPeriod: BigNumber | null; // Number of blocks a freeze proposal has to succeed
- freezePeriod: BigNumber | null; // Number of blocks a freeze lasts, from time of freeze proposal creation
+ freezeVotesThreshold: bigint | null; // Number of freeze votes required to activate a freeze
+ freezeProposalCreatedTime: bigint | null; // Block number the freeze proposal was created at
+ freezeProposalVoteCount: bigint | null; // Number of accrued freeze votes
+ freezeProposalPeriod: bigint | null; // Number of blocks a freeze proposal has to succeed
+ freezePeriod: bigint | null; // Number of blocks a freeze lasts, from time of freeze proposal creation
userHasFreezeVoted: boolean;
isFrozen: boolean;
userHasVotes: boolean;
@@ -311,7 +310,7 @@ export interface VotingStrategyAzorius extends VotingStrategy {
strategyType?: VotingStrategyType;
}
-export interface VotingStrategy {
+export interface VotingStrategy {
votingPeriod?: Type;
quorumPercentage?: Type;
quorumThreshold?: Type;
@@ -373,7 +372,7 @@ export interface ReadOnlyUser {
/** The user's wallet address, if connected. */
address?: string;
/** The number of delegated tokens for the connected Azorius DAO, 1 for a Multisig DAO signer */
- votingWeight: BigNumber;
+ votingWeight: bigint;
}
export interface ReadOnlyDAO {
diff --git a/src/types/transaction.ts b/src/types/transaction.ts
index a04de7e3a4..4702976d54 100644
--- a/src/types/transaction.ts
+++ b/src/types/transaction.ts
@@ -1,5 +1,3 @@
-import { BigNumber } from 'ethers';
-
export interface DecodedTransaction {
target: string;
value: string;
@@ -10,7 +8,7 @@ export interface DecodedTransaction {
}
export interface MetaTransaction {
to: string;
- value: string | number | BigNumber;
+ value: string | number | bigint;
data: string;
operation: number;
}
@@ -36,13 +34,13 @@ export type DecodedTxParam = {
export interface SafeAPITransaction {
to: string; //''
- value: BigNumber; // Value in wei
+ value: bigint; // Value in wei
data: string; // '<0x prefixed hex string>'
operation: number; // 0 CALL, 1 DELEGATE_CALL
gasToken: string; // Token address (hold by the Safe) to be used as a refund to the sender, if `null` is Ether
- safeTxGas: BigNumber; // Max gas to use in the transaction
- baseGas: BigNumber; // Gas costs not related to the transaction execution (signature check, refund payment...)
- gasPrice: BigNumber; // Gas price used for the refund calculation
+ safeTxGas: bigint; // Max gas to use in the transaction
+ baseGas: bigint; // Gas costs not related to the transaction execution (signature check, refund payment...)
+ gasPrice: bigint; // Gas price used for the refund calculation
refundReceiver: string; //Address of receiver of gas payment (or `null` if tx.origin)
nonce: number; // Nonce of the Safe, transaction cannot be executed until Safe's nonce is not equal to this nonce
}
diff --git a/src/types/votingFungibleToken.ts b/src/types/votingFungibleToken.ts
index 72e414fd6a..d8c3fcdbdd 100644
--- a/src/types/votingFungibleToken.ts
+++ b/src/types/votingFungibleToken.ts
@@ -1,7 +1,6 @@
-import { BigNumber } from 'ethers';
import { ITokenAccount } from './fractal';
-export type TransferListener = (from: string, to: string, value: BigNumber, _: any) => void;
+export type TransferListener = (from: string, to: string, value: bigint, _: any) => void;
export type DelegateChangedListener = (
delegator: string,
fromDelegate: string,
@@ -10,15 +9,15 @@ export type DelegateChangedListener = (
) => void;
export type DelegateVotesChangedListener = (
delegate: string,
- previousBalance: BigNumber,
- currentBalance: BigNumber,
+ previousBalance: bigint,
+ currentBalance: bigint,
_: any,
) => void;
export type ClaimListener = (
parentToken: string,
childToken: string,
claimer: string,
- amount: BigNumber,
+ amount: bigint,
_: any,
) => void;
@@ -27,21 +26,21 @@ export interface ITokenData {
symbol: string | undefined;
decimals: number | undefined;
address: string | undefined;
- totalSupply: BigNumber | undefined;
+ totalSupply: bigint | undefined;
}
export interface IGoveranceTokenData extends ITokenData, ITokenAccount, VotingTokenConfig {
isLoading?: boolean;
}
-export interface VotingTokenConfig {
+export interface VotingTokenConfig {
votingPeriod?: Type;
quorumPercentage?: Type;
timeLockPeriod?: Type;
}
-export interface BNFormattedPair {
- value: BigNumber;
+export interface BIFormattedPair {
+ value: bigint;
formatted?: string;
}
diff --git a/src/utils/api.spec.ts b/src/utils/api.spec.ts
index 67537c7929..d16c7f5a61 100644
--- a/src/utils/api.spec.ts
+++ b/src/utils/api.spec.ts
@@ -1,4 +1,4 @@
-import { constants } from 'ethers';
+import { zeroAddress } from 'viem';
import { buildSafeApiUrl } from './api';
describe('Safe URL builder tests', () => {
@@ -16,11 +16,11 @@ describe('Safe URL builder tests', () => {
test('Creates Safe Transaction Service URL, with params', async () => {
const safeTransactionURL = buildSafeApiUrl(
'https://safe-transaction-sepolia.safe.global',
- `/safes/${constants.AddressZero}/multisig-transactions`,
- { target: constants.AddressZero },
+ `/safes/${zeroAddress}/multisig-transactions`,
+ { target: zeroAddress },
'v1',
);
- const EXPECTED_URL = `https://safe-transaction-sepolia.safe.global/api/v1/safes/${constants.AddressZero}/multisig-transactions?target=${constants.AddressZero}`;
+ const EXPECTED_URL = `https://safe-transaction-sepolia.safe.global/api/v1/safes/${zeroAddress}/multisig-transactions?target=${zeroAddress}`;
expect(safeTransactionURL).toEqual(EXPECTED_URL);
});
});
diff --git a/src/utils/azorius.ts b/src/utils/azorius.ts
index 7ee1edfe92..6b3db3383a 100644
--- a/src/utils/azorius.ts
+++ b/src/utils/azorius.ts
@@ -7,7 +7,6 @@ import { ProposalExecutedEvent } from '@fractal-framework/fractal-contracts/dist
import { VotedEvent as ERC20VotedEvent } from '@fractal-framework/fractal-contracts/dist/typechain-types/contracts/azorius/LinearERC20Voting';
import { VotedEvent as ERC721VotedEvent } from '@fractal-framework/fractal-contracts/dist/typechain-types/contracts/azorius/LinearERC721Voting';
import { SafeMultisigTransactionWithTransfersResponse } from '@safe-global/safe-service-client';
-import { BigNumber } from 'ethers';
import { strategyFractalProposalStates } from '../constants/strategy';
import { logError } from '../helpers/errorLogging';
@@ -34,7 +33,7 @@ import { getTimeStamp } from './contract';
export const getAzoriusProposalState = async (
azoriusContract: Azorius,
- proposalId: BigNumber,
+ proposalId: bigint,
): Promise => {
const state = await azoriusContract.proposalState(proposalId);
return strategyFractalProposalStates[state];
@@ -44,16 +43,16 @@ const getQuorum = async (
erc20StrategyContract: LinearERC20Voting | undefined,
erc721StrategyContract: LinearERC721Voting | undefined,
strategyType: VotingStrategyType,
- proposalId: BigNumber,
+ proposalId: bigint,
) => {
let quorum;
if (strategyType === VotingStrategyType.LINEAR_ERC20 && erc20StrategyContract) {
- quorum = await erc20StrategyContract.quorumVotes(proposalId);
+ quorum = (await erc20StrategyContract.quorumVotes(proposalId)).toBigInt();
} else if (strategyType === VotingStrategyType.LINEAR_ERC721 && erc721StrategyContract) {
- quorum = await erc721StrategyContract.quorumThreshold();
+ quorum = (await erc721StrategyContract.quorumThreshold()).toBigInt();
} else {
- quorum = BigNumber.from(0);
+ quorum = 0n;
}
return quorum;
@@ -63,7 +62,7 @@ export const getProposalVotesSummary = async (
erc20Strategy: LinearERC20Voting | undefined,
erc721Strategy: LinearERC721Voting | undefined,
strategyType: VotingStrategyType,
- proposalId: BigNumber,
+ proposalId: bigint,
): Promise => {
try {
if (erc20Strategy !== undefined && erc721Strategy !== undefined) {
@@ -75,27 +74,26 @@ export const getProposalVotesSummary = async (
const { yesVotes, noVotes, abstainVotes } = await erc20Strategy.getProposalVotes(proposalId);
return {
- yes: yesVotes,
- no: noVotes,
- abstain: abstainVotes,
+ yes: yesVotes.toBigInt(),
+ no: noVotes.toBigInt(),
+ abstain: abstainVotes.toBigInt(),
quorum: await getQuorum(erc20Strategy, erc721Strategy, strategyType, proposalId),
};
} else if (erc721Strategy !== undefined) {
const { yesVotes, noVotes, abstainVotes } = await erc721Strategy.getProposalVotes(proposalId);
return {
- yes: yesVotes,
- no: noVotes,
- abstain: abstainVotes,
+ yes: yesVotes.toBigInt(),
+ no: noVotes.toBigInt(),
+ abstain: abstainVotes.toBigInt(),
quorum: await getQuorum(erc20Strategy, erc721Strategy, strategyType, proposalId),
};
} else {
- const zero = BigNumber.from(0);
return {
- yes: zero,
- no: zero,
- abstain: zero,
- quorum: zero,
+ yes: 0n,
+ no: 0n,
+ abstain: 0n,
+ quorum: 0n,
};
}
} catch (e) {
@@ -103,12 +101,11 @@ export const getProposalVotesSummary = async (
// Thus, calling `getProposalVotes` for such a proposal reverts with error
// This helps to prevent such case, while event listeners still should get proper data
logError('Error while retrieving Azorius proposal votes', e);
- const zero = BigNumber.from(0);
return {
- yes: zero,
- no: zero,
- abstain: zero,
- quorum: zero,
+ yes: 0n,
+ no: 0n,
+ abstain: 0n,
+ quorum: 0n,
};
}
};
@@ -116,7 +113,7 @@ export const getProposalVotesSummary = async (
const getProposalVotes = (
erc20VotedEvents: ERC20VotedEvent[] | undefined,
erc721VotedEvents: ERC721VotedEvent[] | undefined,
- proposalId: BigNumber,
+ proposalId: bigint,
): (ProposalVote | ERC721ProposalVote)[] => {
if (erc20VotedEvents !== undefined && erc721VotedEvents !== undefined) {
logError("two voting contracts? we don't support that.");
@@ -124,25 +121,26 @@ const getProposalVotes = (
}
if (erc20VotedEvents !== undefined) {
- const erc20ProposalVoteEvents = erc20VotedEvents.filter(voteEvent =>
- proposalId.eq(voteEvent.args.proposalId),
+ const erc20ProposalVoteEvents = erc20VotedEvents.filter(
+ voteEvent => proposalId === BigInt(voteEvent.args.proposalId),
);
- return erc20ProposalVoteEvents.map(({ args: { voter, voteType, ...rest } }) => ({
+ return erc20ProposalVoteEvents.map(({ args: { voter, voteType, weight, ...rest } }) => ({
...rest,
+ weight: weight.toBigInt(),
voter,
choice: VOTE_CHOICES[voteType],
}));
} else if (erc721VotedEvents !== undefined) {
- const erc721ProposalVoteEvents = erc721VotedEvents.filter(voteEvent =>
- proposalId.eq(voteEvent.args.proposalId),
+ const erc721ProposalVoteEvents = erc721VotedEvents.filter(
+ voteEvent => proposalId === BigInt(voteEvent.args.proposalId),
);
return erc721ProposalVoteEvents.map(({ args: { voter, voteType, tokenIds, ...rest } }) => ({
...rest,
voter,
choice: VOTE_CHOICES[voteType],
- weight: BigNumber.from(1),
+ weight: 1n,
tokenIds: tokenIds.map(id => id.toString()),
}));
}
@@ -154,7 +152,7 @@ export const mapProposalCreatedEventToProposal = async (
erc20StrategyContract: LinearERC20Voting | undefined,
erc721StrategyContract: LinearERC721Voting | undefined,
strategyType: VotingStrategyType,
- proposalId: BigNumber,
+ proposalId: bigint,
proposer: string,
azoriusContract: Azorius,
provider: Providers,
@@ -171,16 +169,25 @@ export const mapProposalCreatedEventToProposal = async (
let proposalVotes = {
startBlock: 0,
endBlock: 0,
- noVotes: BigNumber.from(0),
- yesVotes: BigNumber.from(0),
- abstainVotes: BigNumber.from(0),
+ noVotes: 0n,
+ yesVotes: 0n,
+ abstainVotes: 0n,
};
+ let stratProposalVotes;
if (erc20StrategyContract !== undefined) {
- proposalVotes = await erc20StrategyContract.getProposalVotes(proposalId);
+ stratProposalVotes = await erc20StrategyContract.getProposalVotes(proposalId);
} else if (erc721StrategyContract !== undefined) {
- proposalVotes = await erc721StrategyContract.getProposalVotes(proposalId);
+ stratProposalVotes = await erc721StrategyContract.getProposalVotes(proposalId);
+ } else {
+ logError('we need a strat!');
+ throw new Error('we need a strategy!');
}
+ proposalVotes.startBlock = stratProposalVotes.startBlock;
+ proposalVotes.endBlock = stratProposalVotes.endBlock;
+ proposalVotes.noVotes = stratProposalVotes.noVotes.toBigInt();
+ proposalVotes.yesVotes = stratProposalVotes.yesVotes.toBigInt();
+ proposalVotes.abstainVotes = stratProposalVotes.abstainVotes.toBigInt();
const quorum = await getQuorum(
erc20StrategyContract,
@@ -206,8 +213,8 @@ export const mapProposalCreatedEventToProposal = async (
let transactionHash: string | undefined;
if (state === FractalProposalState.EXECUTED) {
- const executedEvent = (await executedEvents)?.find(event =>
- BigNumber.from(event.args[0]).eq(proposalId),
+ const executedEvent = (await executedEvents)?.find(
+ event => BigInt(event.args[0]) === proposalId,
);
transactionHash = executedEvent?.transactionHash;
}
@@ -218,7 +225,7 @@ export const mapProposalCreatedEventToProposal = async (
proposalId: proposalId.toString(),
targets,
proposer,
- startBlock: BigNumber.from(proposalVotes.startBlock),
+ startBlock: BigInt(proposalVotes.startBlock),
transactionHash,
deadlineMs: deadlineSeconds * 1000,
state,
diff --git a/src/utils/contract.ts b/src/utils/contract.ts
index 4ca304b3d9..cdadc43df7 100644
--- a/src/utils/contract.ts
+++ b/src/utils/contract.ts
@@ -1,4 +1,3 @@
-import { BigNumber } from 'ethers';
import { logError } from '../helpers/errorLogging';
import { CacheExpiry } from '../hooks/utils/cache/cacheDefaults';
import { setValue, getValue } from '../hooks/utils/cache/useLocalStorage';
@@ -60,10 +59,10 @@ export const blocksToSeconds = async (
};
export const getEstimatedNumberOfBlocks = async (
- timeInMinutes: BigNumber,
+ timeInMinutes: bigint,
provider: Providers,
-): Promise => {
- const seconds = timeInMinutes.toNumber() * 60;
+): Promise => {
+ const seconds = Number(timeInMinutes) * 60;
const averageBlockTime = await getAverageBlockTime(provider);
- return BigNumber.from(Math.ceil(seconds / averageBlockTime));
+ return BigInt(Math.ceil(seconds / averageBlockTime));
};
diff --git a/src/utils/currency.ts b/src/utils/currency.ts
index 3770de4619..e505655768 100644
--- a/src/utils/currency.ts
+++ b/src/utils/currency.ts
@@ -1,7 +1,7 @@
-import { utils, BigNumber } from 'ethers';
+import { formatUnits } from 'viem';
-export const formatWeiToValue = (amountInWei: string | BigNumber, decimals: number) => {
- const value = Number(utils.formatUnits(amountInWei, decimals));
+export const formatWeiToValue = (amountInWei: string | bigint, decimals: number) => {
+ const value = Number(formatUnits(BigInt(amountInWei), decimals));
return new Intl.NumberFormat(undefined, {
minimumFractionDigits: 0,
maximumFractionDigits: decimals,
diff --git a/src/utils/numberFormats.ts b/src/utils/numberFormats.ts
index 14987105bc..e553be703e 100644
--- a/src/utils/numberFormats.ts
+++ b/src/utils/numberFormats.ts
@@ -1,16 +1,16 @@
import { SafeBalanceUsdResponse } from '@safe-global/safe-service-client';
-import { BigNumber, ethers } from 'ethers';
-import bigDecimal from 'js-big-decimal';
+import BigDecimal from 'js-big-decimal';
+import { formatEther, formatUnits } from 'viem';
export const DEFAULT_DATE_TIME_FORMAT = 'MMM dd, yyyy, h:mm aa O';
export const DEFAULT_DATE_FORMAT = 'yyyy-MM-dd';
export const formatPercentage = (
- numerator: BigNumber | number | string,
- denominator: BigNumber | number | string,
+ numerator: bigint | number | string,
+ denominator: bigint | number | string,
) => {
- const fraction = bigDecimal.divide(numerator.toString(), denominator.toString(), 18);
- const percent = parseFloat(bigDecimal.multiply(fraction, 100));
+ const fraction = BigDecimal.divide(numerator.toString(), denominator.toString(), 18);
+ const percent = parseFloat(BigDecimal.multiply(fraction, 100));
if (percent < 0.01) {
return '< 0.01%';
}
@@ -29,15 +29,15 @@ export const formatUSD = (rawUSD: number | string) => {
return decimalIndex != -1 && formatted.length - decimalIndex !== 3 ? formatted + '0' : formatted;
};
-export const formatCoinUnits = (
- rawBalance: BigNumber | string,
+const formatCoinUnits = (
+ rawBalance: bigint | string,
decimals?: number,
symbol?: string,
): number => {
- if (!rawBalance) rawBalance = '0';
- return symbol
- ? parseFloat(ethers.utils.formatUnits(rawBalance, decimals))
- : parseFloat(ethers.utils.formatEther(rawBalance));
+ if (!rawBalance) rawBalance = 0n;
+ return symbol && decimals
+ ? parseFloat(formatUnits(BigInt(rawBalance), decimals))
+ : parseFloat(formatEther(BigInt(rawBalance)));
};
export const formatCoinUnitsFromAsset = (asset: SafeBalanceUsdResponse): number => {
@@ -45,7 +45,7 @@ export const formatCoinUnitsFromAsset = (asset: SafeBalanceUsdResponse): number
};
export const formatCoin = (
- rawBalance: BigNumber | string,
+ rawBalance: bigint | string,
truncate: boolean,
decimals?: number,
symbol?: string,
@@ -78,6 +78,6 @@ function getNumberSeparator(type: 'group' | 'decimal'): string {
);
}
-export function formatBigNumberDisplay(num: BigNumber | string | number): string {
+export function formatBigIntDisplay(num: bigint | string | number): string {
return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, getNumberSeparator('group'));
}
diff --git a/src/utils/percentFormat.spec.ts b/src/utils/percentFormat.spec.ts
index 1d4a57db60..7373e83930 100644
--- a/src/utils/percentFormat.spec.ts
+++ b/src/utils/percentFormat.spec.ts
@@ -1,4 +1,3 @@
-import { BigNumber } from 'ethers';
import { formatPercentage } from './numberFormats';
describe('Percent formatting, number', () => {
@@ -61,38 +60,32 @@ describe('Percent formatting, string', () => {
});
});
-describe('Percent formatting, BigNumber', () => {
+describe('Percent formatting, Bigint', () => {
test('correct 100%, number', () => {
- expect(formatPercentage(BigNumber.from('1'), BigNumber.from('1'))).toBe('100%');
+ expect(formatPercentage(1n, 1n)).toBe('100%');
});
test('correct 10%, number', () => {
- expect(formatPercentage(BigNumber.from('1'), BigNumber.from('10'))).toBe('10%');
+ expect(formatPercentage(1n, 10n)).toBe('10%');
});
test('correct 1%, number', () => {
- expect(formatPercentage(BigNumber.from('1'), BigNumber.from('100'))).toBe('1%');
+ expect(formatPercentage(1n, 100n)).toBe('1%');
});
test('correct 0.1%, number', () => {
- expect(formatPercentage(BigNumber.from('1'), BigNumber.from('1000'))).toBe('0.1%');
+ expect(formatPercentage(1n, 1000n)).toBe('0.1%');
});
test('correct 0.01%, number', () => {
- expect(formatPercentage(BigNumber.from('1'), BigNumber.from('10000'))).toBe('0.01%');
+ expect(formatPercentage(1n, 10000n)).toBe('0.01%');
});
test('correct 0.001%, number', () => {
- expect(formatPercentage(BigNumber.from('1'), BigNumber.from('100000'))).toBe('< 0.01%');
+ expect(formatPercentage(1n, 100000n)).toBe('< 0.01%');
});
test('correct 1.1%, number', () => {
- expect(formatPercentage(BigNumber.from('10000000000'), BigNumber.from('909090909091'))).toBe(
- '1.1%',
- );
+ expect(formatPercentage(10000000000n, 909090909091n)).toBe('1.1%');
});
test('correct 1.01%, number', () => {
- expect(formatPercentage(BigNumber.from('10000000000'), BigNumber.from('990099009901'))).toBe(
- '1.01%',
- );
+ expect(formatPercentage(10000000000n, 990099009901n)).toBe('1.01%');
});
test('correct 1.001%, number', () => {
- expect(formatPercentage(BigNumber.from('10000000000'), BigNumber.from('999000999001'))).toBe(
- '1%',
- );
+ expect(formatPercentage(10000000000n, 999000999001n)).toBe('1%');
});
});
diff --git a/src/utils/safeData.ts b/src/utils/safeData.ts
index 266e174677..23bb603701 100644
--- a/src/utils/safeData.ts
+++ b/src/utils/safeData.ts
@@ -1,5 +1,5 @@
import { TransferWithTokenInfoResponse } from '@safe-global/safe-service-client';
-import { constants, BigNumber } from 'ethers';
+import { zeroAddress } from 'viem';
import { AssetTotals, SafeTransferType } from '../types';
/**
@@ -13,23 +13,23 @@ export const totalsReducer = (
cur: TransferWithTokenInfoResponse,
) => {
if (cur.type === SafeTransferType.ETHER && cur.value) {
- const prevValue = prev.get(constants.AddressZero)!;
+ const prevValue = prev.get(zeroAddress)!;
if (prevValue) {
- prev.set(constants.AddressZero, {
- bn: prevValue.bn.add(BigNumber.from(cur.value)),
+ prev.set(zeroAddress, {
+ bi: prevValue.bi + BigInt(cur.value),
symbol: 'ETHER',
decimals: 18,
});
}
- prev.set(constants.AddressZero, {
- bn: BigNumber.from(cur.value),
+ prev.set(zeroAddress, {
+ bi: BigInt(cur.value),
symbol: 'ETHER',
decimals: 18,
});
}
if (cur.type === SafeTransferType.ERC721 && cur.tokenInfo && cur.tokenId) {
prev.set(`${cur.tokenAddress}:${cur.tokenId}`, {
- bn: BigNumber.from(1),
+ bi: 1n,
symbol: cur.tokenInfo.symbol,
decimals: 0,
});
@@ -39,11 +39,11 @@ export const totalsReducer = (
if (prevValue) {
prev.set(cur.tokenInfo.address, {
...prevValue,
- bn: prevValue.bn.add(BigNumber.from(cur.value)),
+ bi: prevValue.bi + BigInt(cur.value),
});
} else {
prev.set(cur.tokenAddress!, {
- bn: BigNumber.from(cur.value),
+ bi: BigInt(cur.value),
symbol: cur.tokenInfo.symbol,
decimals: cur.tokenInfo.decimals,
});
diff --git a/src/utils/shutter.ts b/src/utils/shutter.ts
index 9c11f170ab..1b008bee6b 100644
--- a/src/utils/shutter.ts
+++ b/src/utils/shutter.ts
@@ -1,5 +1,5 @@
import { init, encrypt } from '@shutter-network/shutter-crypto';
-import { BigNumber, utils } from 'ethers';
+import { utils } from 'ethers';
export default async function encryptWithShutter(
choice: string,
@@ -17,7 +17,7 @@ export default async function encryptWithShutter(
const is32ByteString = id.substring(0, 2) === '0x';
const proposalId = arrayify(is32ByteString ? id : formatBytes32String(id));
- const sigma = arrayify(BigNumber.from(randomBytes(32)));
+ const sigma = randomBytes(32);
const encryptedMessage = await encrypt(message, eonPublicKey, proposalId, sigma);
diff --git a/src/utils/signatures.ts b/src/utils/signatures.ts
index 92368fe3f2..5c2fd50c8f 100644
--- a/src/utils/signatures.ts
+++ b/src/utils/signatures.ts
@@ -1,4 +1,4 @@
-import { BigNumberish, Signer, utils } from 'ethers';
+import { Signer, utils } from 'ethers';
import { logError } from '../helpers/errorLogging';
import { SafeAPITransaction } from '../types';
@@ -38,7 +38,7 @@ export interface SafeSignature {
export const calculateSafeTransactionHash = (
safeAddress: string,
safeTx: SafeAPITransaction,
- chainId: BigNumberish,
+ chainId: number,
): string => {
return utils._TypedDataEncoder.hash(
{ verifyingContract: safeAddress, chainId },
@@ -69,7 +69,7 @@ export const safeSignMessage = async (
signer: Signer,
safeAddress: string,
safeTx: SafeAPITransaction,
- chainId?: BigNumberish,
+ chainId?: number,
): Promise => {
const cid = chainId || (await signer.provider!.getNetwork()).chainId;
return signHash(signer, calculateSafeTransactionHash(safeAddress, safeTx, cid));
diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts
index 5b2ee37d88..8a63dcca2a 100644
--- a/src/vite-env.d.ts
+++ b/src/vite-env.d.ts
@@ -10,12 +10,14 @@ interface ImportMetaEnv {
readonly VITE_APP_ALCHEMY_SEPOLIA_API_KEY: string;
readonly VITE_APP_ALCHEMY_BASE_SEPOLIA_API_KEY: string;
readonly VITE_APP_ALCHEMY_BASE_API_KEY: string;
+ readonly VITE_APP_ALCHEMY_OPTIMISM_API_KEY: string;
readonly VITE_APP_ETHERSCAN_MAINNET_API_KEY: string;
readonly VITE_APP_ETHERSCAN_POLYGON_API_KEY: string;
readonly VITE_APP_ETHERSCAN_SEPOLIA_API_KEY: string;
readonly VITE_APP_ETHERSCAN_BASE_SEPOLIA_API_KEY: string;
readonly VITE_APP_ETHERSCAN_BASE_API_KEY: string;
+ readonly VITE_APP_ETHERSCAN_OPTIMISM_API_KEY: string;
readonly VITE_APP_INFURA_IPFS_API_KEY: string;
readonly VITE_APP_INFURA_IPFS_API_SECRET: string;