Skip to content

Commit

Permalink
Merge pull request #1651 from decentdao/network-config-exports-addres…
Browse files Browse the repository at this point in the history
…s-types

Make all contract addresses in NetworkConfig be Address type
  • Loading branch information
adamgall authored May 7, 2024
2 parents 5056272 + 725f375 commit c508a5e
Show file tree
Hide file tree
Showing 7 changed files with 227 additions and 179 deletions.
60 changes: 34 additions & 26 deletions src/providers/NetworkConfig/networks/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,33 +43,41 @@ export const baseConfig: NetworkConfig = {
version: 'v0.0.2',
},
contracts: {
fractalAzoriusMasterCopy: Azorius.address,
fractalModuleMasterCopy: FractalModule.address,
fractalRegistry: FractalRegistry.address,
fractalAzoriusMasterCopy: getAddress(Azorius.address),
fractalModuleMasterCopy: getAddress(FractalModule.address),
fractalRegistry: getAddress(FractalRegistry.address),
votesERC20MasterCopy: getAddress(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: chain.id.toString(),
})?.networkAddresses[chain.id.toString()]!,
safe: getSafeL2SingletonDeployment({ version: SAFE_VERSION, network: chain.id.toString() })
?.networkAddresses[chain.id.toString()]!,
safeFactory: getProxyFactoryDeployment({
version: SAFE_VERSION,
network: chain.id.toString(),
})?.networkAddresses[chain.id.toString()]!,
zodiacModuleProxyFactory: ModuleProxyFactory.address,
linearVotingMasterCopy: LinearERC20Voting.address,
multisend: getMultiSendCallOnlyDeployment({
version: SAFE_VERSION,
network: chain.id.toString(),
})?.networkAddresses[chain.id.toString()]!,
linearVotingERC721MasterCopy: getAddress(LinearVotingERC721.address),
claimingMasterCopy: getAddress(ERC20Claim.address),
azoriusFreezeGuardMasterCopy: getAddress(AzoriusFreezeGuard.address),
multisigFreezeVotingMasterCopy: getAddress(MultisigFreezeVoting.address),
erc20FreezeVotingMasterCopy: getAddress(ERC20FreezeVoting.address),
erc721FreezeVotingMasterCopy: getAddress(ERC721FreezeVoting.address),
multisigFreezeGuardMasterCopy: getAddress(MultisigFreezeGuard.address),
fallbackHandler: getAddress(
getCompatibilityFallbackHandlerDeployment({
version: SAFE_VERSION,
network: chain.id.toString(),
})?.networkAddresses[chain.id.toString()]!,
),
safe: getAddress(
getSafeL2SingletonDeployment({ version: SAFE_VERSION, network: chain.id.toString() })
?.networkAddresses[chain.id.toString()]!,
),
safeFactory: getAddress(
getProxyFactoryDeployment({
version: SAFE_VERSION,
network: chain.id.toString(),
})?.networkAddresses[chain.id.toString()]!,
),
zodiacModuleProxyFactory: getAddress(ModuleProxyFactory.address),
linearVotingMasterCopy: getAddress(LinearERC20Voting.address),
multisend: getAddress(
getMultiSendCallOnlyDeployment({
version: SAFE_VERSION,
network: chain.id.toString(),
})?.networkAddresses[chain.id.toString()]!,
),
votesERC20WrapperMasterCopy: getAddress(VotesERC20Wrapper.address),
keyValuePairs: getAddress(KeyValuePairs.address),
},
Expand Down
64 changes: 36 additions & 28 deletions src/providers/NetworkConfig/networks/baseSepolia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,35 +43,43 @@ export const baseSepoliaConfig: NetworkConfig = {
version: 'v0.0.2',
},
contracts: {
fractalAzoriusMasterCopy: Azorius.address,
fractalModuleMasterCopy: FractalModule.address,
fractalRegistry: FractalRegistry.address,
fractalAzoriusMasterCopy: getAddress(Azorius.address),
fractalModuleMasterCopy: getAddress(FractalModule.address),
fractalRegistry: getAddress(FractalRegistry.address),
votesERC20MasterCopy: getAddress(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: chain.id.toString(),
})?.networkAddresses[chain.id.toString()]!,
safe: getSafeL2SingletonDeployment({
version: SAFE_VERSION,
network: chain.id.toString(),
})?.networkAddresses[chain.id.toString()]!,
safeFactory: getProxyFactoryDeployment({
version: SAFE_VERSION,
network: chain.id.toString(),
})?.networkAddresses[chain.id.toString()]!,
zodiacModuleProxyFactory: ModuleProxyFactory.address,
linearVotingMasterCopy: LinearERC20Voting.address,
multisend: getMultiSendCallOnlyDeployment({
version: SAFE_VERSION,
network: chain.id.toString(),
})?.networkAddresses[chain.id.toString()]!,
linearVotingERC721MasterCopy: getAddress(LinearVotingERC721.address),
claimingMasterCopy: getAddress(ERC20Claim.address),
azoriusFreezeGuardMasterCopy: getAddress(AzoriusFreezeGuard.address),
multisigFreezeVotingMasterCopy: getAddress(MultisigFreezeVoting.address),
erc20FreezeVotingMasterCopy: getAddress(ERC20FreezeVoting.address),
erc721FreezeVotingMasterCopy: getAddress(ERC721FreezeVoting.address),
multisigFreezeGuardMasterCopy: getAddress(MultisigFreezeGuard.address),
fallbackHandler: getAddress(
getCompatibilityFallbackHandlerDeployment({
version: SAFE_VERSION,
network: chain.id.toString(),
})?.networkAddresses[chain.id.toString()]!,
),
safe: getAddress(
getSafeL2SingletonDeployment({
version: SAFE_VERSION,
network: chain.id.toString(),
})?.networkAddresses[chain.id.toString()]!,
),
safeFactory: getAddress(
getProxyFactoryDeployment({
version: SAFE_VERSION,
network: chain.id.toString(),
})?.networkAddresses[chain.id.toString()]!,
),
zodiacModuleProxyFactory: getAddress(ModuleProxyFactory.address),
linearVotingMasterCopy: getAddress(LinearERC20Voting.address),
multisend: getAddress(
getMultiSendCallOnlyDeployment({
version: SAFE_VERSION,
network: chain.id.toString(),
})?.networkAddresses[chain.id.toString()]!,
),
votesERC20WrapperMasterCopy: getAddress(VotesERC20Wrapper.address),
keyValuePairs: getAddress(KeyValuePairs.address),
},
Expand Down
62 changes: 35 additions & 27 deletions src/providers/NetworkConfig/networks/mainnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
getSafeL2SingletonDeployment,
getCompatibilityFallbackHandlerDeployment,
} from '@safe-global/safe-deployments';
import { getAddress } from 'viem';
import { getAddress, zeroAddress } from 'viem';
import { mainnet } from 'wagmi/chains';
import { GovernanceType } from '../../../types';
import { NetworkConfig } from '../../../types/network';
Expand All @@ -43,33 +43,41 @@ export const mainnetConfig: NetworkConfig = {
version: 'v0.0.2',
},
contracts: {
fractalAzoriusMasterCopy: Azorius.address,
fractalModuleMasterCopy: FractalModule.address,
fractalRegistry: FractalRegistry.address,
fractalAzoriusMasterCopy: getAddress(Azorius.address),
fractalModuleMasterCopy: getAddress(FractalModule.address),
fractalRegistry: getAddress(FractalRegistry.address),
votesERC20MasterCopy: getAddress(VotesERC20.address),
linearVotingERC721MasterCopy: '', // TODO - Add actual address once contract is deployed on mainnet
claimingMasterCopy: ERC20Claim.address,
azoriusFreezeGuardMasterCopy: AzoriusFreezeGuard.address,
multisigFreezeVotingMasterCopy: MultisigFreezeVoting.address,
erc20FreezeVotingMasterCopy: ERC20FreezeVoting.address,
erc721FreezeVotingMasterCopy: '', // TODO - Add actual address once contract is deployed on mainnet
multisigFreezeGuardMasterCopy: MultisigFreezeGuard.address,
fallbackHandler: getCompatibilityFallbackHandlerDeployment({
version: SAFE_VERSION,
network: chain.id.toString(),
})?.networkAddresses[chain.id.toString()]!,
safe: getSafeL2SingletonDeployment({ version: SAFE_VERSION, network: chain.id.toString() })
?.networkAddresses[chain.id.toString()]!,
safeFactory: getProxyFactoryDeployment({
version: SAFE_VERSION,
network: chain.id.toString(),
})?.networkAddresses[chain.id.toString()]!,
zodiacModuleProxyFactory: ModuleProxyFactory.address,
linearVotingMasterCopy: LinearERC20Voting.address,
multisend: getMultiSendCallOnlyDeployment({
version: SAFE_VERSION,
network: chain.id.toString(),
})?.networkAddresses[chain.id.toString()]!,
linearVotingERC721MasterCopy: zeroAddress, // TODO - Add actual address once contract is deployed on mainnet
claimingMasterCopy: getAddress(ERC20Claim.address),
azoriusFreezeGuardMasterCopy: getAddress(AzoriusFreezeGuard.address),
multisigFreezeVotingMasterCopy: getAddress(MultisigFreezeVoting.address),
erc20FreezeVotingMasterCopy: getAddress(ERC20FreezeVoting.address),
erc721FreezeVotingMasterCopy: zeroAddress, // TODO - Add actual address once contract is deployed on mainnet
multisigFreezeGuardMasterCopy: getAddress(MultisigFreezeGuard.address),
fallbackHandler: getAddress(
getCompatibilityFallbackHandlerDeployment({
version: SAFE_VERSION,
network: chain.id.toString(),
})?.networkAddresses[chain.id.toString()]!,
),
safe: getAddress(
getSafeL2SingletonDeployment({ version: SAFE_VERSION, network: chain.id.toString() })
?.networkAddresses[chain.id.toString()]!,
),
safeFactory: getAddress(
getProxyFactoryDeployment({
version: SAFE_VERSION,
network: chain.id.toString(),
})?.networkAddresses[chain.id.toString()]!,
),
zodiacModuleProxyFactory: getAddress(ModuleProxyFactory.address),
linearVotingMasterCopy: getAddress(LinearERC20Voting.address),
multisend: getAddress(
getMultiSendCallOnlyDeployment({
version: SAFE_VERSION,
network: chain.id.toString(),
})?.networkAddresses[chain.id.toString()]!,
),
votesERC20WrapperMasterCopy: getAddress(VotesERC20Wrapper.address),
keyValuePairs: getAddress(KeyValuePairs.address),
},
Expand Down
60 changes: 34 additions & 26 deletions src/providers/NetworkConfig/networks/optimism.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,33 +43,41 @@ export const optimismConfig: NetworkConfig = {
version: 'v0.0.2',
},
contracts: {
fractalAzoriusMasterCopy: Azorius.address,
fractalModuleMasterCopy: FractalModule.address,
fractalRegistry: FractalRegistry.address,
fractalAzoriusMasterCopy: getAddress(Azorius.address),
fractalModuleMasterCopy: getAddress(FractalModule.address),
fractalRegistry: getAddress(FractalRegistry.address),
votesERC20MasterCopy: getAddress(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: chain.id.toString(),
})?.networkAddresses[chain.id.toString()]!,
safe: getSafeL2SingletonDeployment({ version: SAFE_VERSION, network: chain.id.toString() })
?.networkAddresses[chain.id.toString()]!,
safeFactory: getProxyFactoryDeployment({
version: SAFE_VERSION,
network: chain.id.toString(),
})?.networkAddresses[chain.id.toString()]!,
zodiacModuleProxyFactory: ModuleProxyFactory.address,
linearVotingMasterCopy: LinearERC20Voting.address,
multisend: getMultiSendCallOnlyDeployment({
version: SAFE_VERSION,
network: chain.id.toString(),
})?.networkAddresses[chain.id.toString()]!,
linearVotingERC721MasterCopy: getAddress(LinearVotingERC721.address),
claimingMasterCopy: getAddress(ERC20Claim.address),
azoriusFreezeGuardMasterCopy: getAddress(AzoriusFreezeGuard.address),
multisigFreezeVotingMasterCopy: getAddress(MultisigFreezeVoting.address),
erc20FreezeVotingMasterCopy: getAddress(ERC20FreezeVoting.address),
erc721FreezeVotingMasterCopy: getAddress(ERC721FreezeVoting.address),
multisigFreezeGuardMasterCopy: getAddress(MultisigFreezeGuard.address),
fallbackHandler: getAddress(
getCompatibilityFallbackHandlerDeployment({
version: SAFE_VERSION,
network: chain.id.toString(),
})?.networkAddresses[chain.id.toString()]!,
),
safe: getAddress(
getSafeL2SingletonDeployment({ version: SAFE_VERSION, network: chain.id.toString() })
?.networkAddresses[chain.id.toString()]!,
),
safeFactory: getAddress(
getProxyFactoryDeployment({
version: SAFE_VERSION,
network: chain.id.toString(),
})?.networkAddresses[chain.id.toString()]!,
),
zodiacModuleProxyFactory: getAddress(ModuleProxyFactory.address),
linearVotingMasterCopy: getAddress(LinearERC20Voting.address),
multisend: getAddress(
getMultiSendCallOnlyDeployment({
version: SAFE_VERSION,
network: chain.id.toString(),
})?.networkAddresses[chain.id.toString()]!,
),
votesERC20WrapperMasterCopy: getAddress(VotesERC20Wrapper.address),
keyValuePairs: getAddress(KeyValuePairs.address),
},
Expand Down
62 changes: 35 additions & 27 deletions src/providers/NetworkConfig/networks/polygon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
getSafeL2SingletonDeployment,
getCompatibilityFallbackHandlerDeployment,
} from '@safe-global/safe-deployments';
import { getAddress } from 'viem';
import { getAddress, zeroAddress } from 'viem';
import { polygon } from 'wagmi/chains';
import { GovernanceType } from '../../../types';
import { NetworkConfig } from '../../../types/network';
Expand All @@ -43,33 +43,41 @@ export const polygonConfig: NetworkConfig = {
version: 'v0.0.2',
},
contracts: {
fractalAzoriusMasterCopy: Azorius.address,
fractalModuleMasterCopy: FractalModule.address,
fractalRegistry: FractalRegistry.address,
fractalAzoriusMasterCopy: getAddress(Azorius.address),
fractalModuleMasterCopy: getAddress(FractalModule.address),
fractalRegistry: getAddress(FractalRegistry.address),
votesERC20MasterCopy: getAddress(VotesERC20.address),
linearVotingERC721MasterCopy: '', // TODO - Add actual address once contract is deployed on polygon
claimingMasterCopy: ERC20Claim.address,
azoriusFreezeGuardMasterCopy: AzoriusFreezeGuard.address,
multisigFreezeVotingMasterCopy: MultisigFreezeVoting.address,
erc20FreezeVotingMasterCopy: ERC20FreezeVoting.address,
erc721FreezeVotingMasterCopy: '', // TODO - Add actual address once contract is deployed on polygon
multisigFreezeGuardMasterCopy: MultisigFreezeGuard.address,
fallbackHandler: getCompatibilityFallbackHandlerDeployment({
version: SAFE_VERSION,
network: chain.id.toString(),
})?.networkAddresses[chain.id.toString()]!,
safe: getSafeL2SingletonDeployment({ version: SAFE_VERSION, network: chain.id.toString() })
?.networkAddresses[chain.id.toString()]!,
safeFactory: getProxyFactoryDeployment({
version: SAFE_VERSION,
network: chain.id.toString(),
})?.networkAddresses[chain.id.toString()]!,
zodiacModuleProxyFactory: ModuleProxyFactory.address,
linearVotingMasterCopy: LinearERC20Voting.address,
multisend: getMultiSendCallOnlyDeployment({
version: SAFE_VERSION,
network: chain.id.toString(),
})?.networkAddresses[chain.id.toString()]!,
linearVotingERC721MasterCopy: zeroAddress, // TODO - Add actual address once contract is deployed on polygon
claimingMasterCopy: getAddress(ERC20Claim.address),
azoriusFreezeGuardMasterCopy: getAddress(AzoriusFreezeGuard.address),
multisigFreezeVotingMasterCopy: getAddress(MultisigFreezeVoting.address),
erc20FreezeVotingMasterCopy: getAddress(ERC20FreezeVoting.address),
erc721FreezeVotingMasterCopy: zeroAddress, // TODO - Add actual address once contract is deployed on polygon
multisigFreezeGuardMasterCopy: getAddress(MultisigFreezeGuard.address),
fallbackHandler: getAddress(
getCompatibilityFallbackHandlerDeployment({
version: SAFE_VERSION,
network: chain.id.toString(),
})?.networkAddresses[chain.id.toString()]!,
),
safe: getAddress(
getSafeL2SingletonDeployment({ version: SAFE_VERSION, network: chain.id.toString() })
?.networkAddresses[chain.id.toString()]!,
),
safeFactory: getAddress(
getProxyFactoryDeployment({
version: SAFE_VERSION,
network: chain.id.toString(),
})?.networkAddresses[chain.id.toString()]!,
),
zodiacModuleProxyFactory: getAddress(ModuleProxyFactory.address),
linearVotingMasterCopy: getAddress(LinearERC20Voting.address),
multisend: getAddress(
getMultiSendCallOnlyDeployment({
version: SAFE_VERSION,
network: chain.id.toString(),
})?.networkAddresses[chain.id.toString()]!,
),
votesERC20WrapperMasterCopy: getAddress(VotesERC20Wrapper.address),
keyValuePairs: getAddress(KeyValuePairs.address),
},
Expand Down
Loading

0 comments on commit c508a5e

Please sign in to comment.