Skip to content

Commit

Permalink
Add deploymentType to getInitCode
Browse files Browse the repository at this point in the history
  • Loading branch information
yagopv committed Sep 25, 2024
1 parent 855907c commit 421e5ea
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/protocol-kit/src/contracts/BaseContract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
Chain
} from 'viem'
import { estimateContractGas, getTransactionReceipt } from 'viem/actions'
import { SingletonDeployment } from '@safe-global/safe-deployments'
import { contractName, getContractDeployment } from '@safe-global/protocol-kit/contracts/config'
import { DeploymentType } from '@safe-global/protocol-kit/types'
import SafeProvider from '@safe-global/protocol-kit/SafeProvider'
Expand All @@ -26,7 +27,6 @@ import {
convertTransactionOptions
} from '@safe-global/protocol-kit/utils'
import { ExternalClient } from '../types'
import { SingletonDeployment } from '@safe-global/safe-deployments'

/**
* Abstract class BaseContract
Expand Down
12 changes: 8 additions & 4 deletions packages/protocol-kit/src/contracts/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,30 +259,34 @@ export async function getPredictedSafeAddressInitCode({

const {
safeVersion = DEFAULT_SAFE_VERSION,
saltNonce = getChainSpecificDefaultSaltNonce(chainId)
saltNonce = getChainSpecificDefaultSaltNonce(chainId),
deploymentType
} = safeDeploymentConfig

const safeProxyFactoryContract = await memoizedGetProxyFactoryContract({
safeProvider,
safeVersion,
customContracts,
chainId: chainId.toString()
chainId: chainId.toString(),
deploymentType
})

const safeContract = await memoizedGetSafeContract({
safeProvider,
safeVersion,
isL1SafeSingleton,
customContracts,
chainId: chainId.toString()
chainId: chainId.toString(),
deploymentType
})

const initializer = await encodeSetupCallData({
safeProvider,
safeAccountConfig,
safeContract,
customContracts,
customSafeVersion: safeVersion // it is more efficient if we provide the safeVersion manually
customSafeVersion: safeVersion, // it is more efficient if we provide the safeVersion manually
deploymentType
})

const encodedNonce = safeProvider.encodeParameters('uint256', [saltNonce])
Expand Down

0 comments on commit 421e5ea

Please sign in to comment.