Skip to content

Commit

Permalink
Pass getImplementationHook in context
Browse files Browse the repository at this point in the history
  • Loading branch information
ScreamingHawk committed Jan 10, 2025
1 parent 3e3ff7a commit e9c6931
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
5 changes: 3 additions & 2 deletions packages/account/src/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,8 @@ export class Account {
}

// On immutable chains, we add the WalletProxyHook
if (chainId === ChainId.IMMUTABLE_ZKEVM || chainId === ChainId.IMMUTABLE_ZKEVM_TESTNET) {
const { proxyImplementationHook } = this.contexts[status.config.version]
if (proxyImplementationHook && (chainId === ChainId.IMMUTABLE_ZKEVM || chainId === ChainId.IMMUTABLE_ZKEVM_TESTNET)) {
const provider = this.providerFor(chainId)
if (provider) {
const hook = new ethers.Contract(this.address, walletContracts.walletProxyHook.abi, provider)
Expand All @@ -431,7 +432,7 @@ export class Account {
to: this.address,
data: hooksInterface.encodeFunctionData(hooksInterface.getFunction('addHook')!, [
'0x90611127',
'0x1f56dbAD5e8319F0DE9a323E24A31b5077dEB1a4'
proxyImplementationHook,
]),
gasLimit: 50000, // Expected ~28k gas. Buffer added
delegateCall: false,
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/commons/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export type WalletContext = {
guestModule: string

walletCreationCode: string

proxyImplementationHook?: string;
}

export function addressOf(context: WalletContext, imageHash: ethers.BytesLike) {
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/v2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ export const DeployedWalletContext: WalletContext = {
guestModule: '0xfea230Ee243f88BC698dD8f1aE93F8301B6cdfaE',
mainModule: '0xfBf8f1A5E00034762D928f46d438B947f5d4065d',
mainModuleUpgradable: '0x4222dcA3974E39A8b41c411FeDDE9b09Ae14b911',
walletCreationCode: '0x603a600e3d39601a805130553df3363d3d373d3d3d363d30545af43d82803e903d91601857fd5bf3'
walletCreationCode: '0x603a600e3d39601a805130553df3363d3d373d3d3d363d30545af43d82803e903d91601857fd5bf3',
proxyImplementationHook: '0x1f56dbAD5e8319F0DE9a323E24A31b5077dEB1a4',
}
3 changes: 2 additions & 1 deletion packages/tests/src/context/v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export async function deployV2Context(signer: ethers.Signer): Promise<coreV2.con
guestModule: await guestModule.getAddress(),
universalSigValidator: await universalSigValidator.getAddress(),

walletCreationCode: '0x603a600e3d39601a805130553df3363d3d373d3d3d363d30545af43d82803e903d91601857fd5bf3'
walletCreationCode: '0x603a600e3d39601a805130553df3363d3d373d3d3d363d30545af43d82803e903d91601857fd5bf3',
proxyImplementationHook: '0x1f56dbAD5e8319F0DE9a323E24A31b5077dEB1a4'
}
}

0 comments on commit e9c6931

Please sign in to comment.