Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions packages/protocol-kit/src/contracts/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@

const ZKSYNC_MAINNET = 324n
const ZKSYNC_TESTNET = 300n
const ZKSYNC_LENS = 232n
// For bundle size efficiency we store SafeProxy.sol/GnosisSafeProxy.sol zksync bytecode hash in hex.
// To get the values below we need to:
// 1. Compile Safe smart contracts for zksync
Expand All @@ -62,6 +63,9 @@
} = {
'1.3.0': {
deployedBytecodeHash: '0x0100004124426fb9ebb25e27d670c068e52f9ba631bd383279a188be47e3f86d'
},
'1.4.1': {
deployedBytecodeHash: '0x0100003b6cfa15bd7d1cae1c9c022074524d7785d34859ad0576d8fab4305d4f'
}
}

Expand Down Expand Up @@ -369,10 +373,10 @@

const from = safeProxyFactoryContract.getAddress()

// On the zkSync Era chain, the counterfactual deployment address is calculated differently
const isZkSyncEraChain = [ZKSYNC_MAINNET, ZKSYNC_TESTNET].includes(chainId)
if (isZkSyncEraChain) {
const proxyAddress = zkSyncEraCreate2Address(from, safeVersion, salt, asHex(input))
// On the zkSync chains, the counterfactual deployment address is calculated differently
const isZkSyncChain = [ZKSYNC_MAINNET, ZKSYNC_TESTNET, ZKSYNC_LENS].includes(chainId)
if (isZkSyncChain) {
const proxyAddress = zkSyncCreate2Address(from, safeVersion, salt, asHex(input))

return safeProvider.getChecksummedAddress(proxyAddress)
}
Expand Down Expand Up @@ -472,9 +476,9 @@
* @param {`0x${string}`} salt - The salt used for address derivation.
* @param {`0x${string}`} input - Additional input data for the derivation.
*
* @returns {string} The derived zkSync Era address.
* @returns {string} The derived zkSync address.
*/
export function zkSyncEraCreate2Address(
export function zkSyncCreate2Address(
from: string,
safeVersion: SafeVersion,
salt: Hex,
Expand Down Expand Up @@ -504,7 +508,7 @@
}
}

export function isTypedDataSigner(signer: any): signer is Client {

Check warning on line 511 in packages/protocol-kit/src/contracts/utils.ts

View workflow job for this annotation

GitHub Actions / eslint

Unexpected any. Specify a different type
const isPasskeySigner = !!signer?.passkeyRawId
return (signer as unknown as WalletClient).signTypedData !== undefined || !isPasskeySigner
}
Expand Down
2 changes: 1 addition & 1 deletion packages/protocol-kit/tests/e2e/utilsContracts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ describe('Contract utils', () => {
)

itif(safeVersionDeployed === '1.3.0')(
'returns the predicted address for Safes deployed on zkSync Era',
'returns the predicted address for Safes deployed on zkSync EVM',
async () => {
const { contractNetworks } = await setupTests()

Expand Down
Loading