diff --git a/.changeset/thick-kangaroos-smoke.md b/.changeset/thick-kangaroos-smoke.md new file mode 100644 index 00000000000..c885e884774 --- /dev/null +++ b/.changeset/thick-kangaroos-smoke.md @@ -0,0 +1,5 @@ +--- +"thirdweb": patch +--- + +7702 delegation designator diff --git a/packages/thirdweb/src/utils/bytecode/extractMinimalProxyImplementationAddress.test.ts b/packages/thirdweb/src/utils/bytecode/extractMinimalProxyImplementationAddress.test.ts index 8efe9398594..50a9a4e9b3c 100644 --- a/packages/thirdweb/src/utils/bytecode/extractMinimalProxyImplementationAddress.test.ts +++ b/packages/thirdweb/src/utils/bytecode/extractMinimalProxyImplementationAddress.test.ts @@ -51,6 +51,12 @@ describe("extractMinimalProxyImplementationAddress", () => { expect(result).toBe("0xbebebebebebebebebebebebebebebebebebebebe"); }); + it("should extract address from EIP-7702 delegation designator", () => { + const bytecode = "0xef0100bebebebebebebebebebebebebebebebebebebebe"; + const result = extractMinimalProxyImplementationAddress(bytecode); + expect(result).toBe("0xbebebebebebebebebebebebebebebebebebebebe"); + }); + it("should return undefined for non-matching bytecode", () => { const bytecode = "0x60806040526000805534801561001457600080fd5b50610150806100246000396000f3fe"; diff --git a/packages/thirdweb/src/utils/bytecode/extractMinimalProxyImplementationAddress.ts b/packages/thirdweb/src/utils/bytecode/extractMinimalProxyImplementationAddress.ts index d1b3546e7a2..9c6b3646ca9 100644 --- a/packages/thirdweb/src/utils/bytecode/extractMinimalProxyImplementationAddress.ts +++ b/packages/thirdweb/src/utils/bytecode/extractMinimalProxyImplementationAddress.ts @@ -54,5 +54,11 @@ export function extractMinimalProxyImplementationAddress( return `0x${implementationAddress}`; } + // EIP-7702 - https://eips.ethereum.org/EIPS/eip-7702#abstract + if (bytecode.length === 48 && bytecode.startsWith("0xef0100")) { + const implementationAddress = bytecode.slice(8, 48); + return `0x${implementationAddress}`; + } + return undefined; }