Skip to content

Commit eaa817c

Browse files
Refactor constructor arguments transformation to use ABI instead of Metadata (#2308)
1 parent 420c30e commit eaa817c

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

packages/lib-sourcify/src/Verification/Transformations.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@ import { AuxdataStyle } from '@ethereum-sourcify/bytecode-utils';
22
import {
33
ImmutableReferences,
44
LinkReferences,
5-
Metadata,
65
} from '@ethereum-sourcify/compilers-types';
76
import {
87
CompiledContractCborAuxdata,
98
StringMap,
109
} from '../Compilation/CompilationTypes';
11-
import { AbiCoder, id as keccak256Str, Interface } from 'ethers';
10+
import { AbiCoder, id as keccak256Str, Interface, InterfaceAbi } from 'ethers';
1211
import { logError } from '../logger';
1312

1413
const abiCoder = AbiCoder.defaultAbiCoder();
@@ -194,16 +193,15 @@ export function extractAbiEncodedConstructorArguments(
194193
export function extractConstructorArgumentsTransformation(
195194
populatedRecompiledBytecode: string,
196195
onchainCreationBytecode: string,
197-
metadata: Metadata,
196+
abi: InterfaceAbi,
198197
) {
199198
const transformations: Transformation[] = [];
200199
const transformationValues: TransformationValues = {};
201200
const abiEncodedConstructorArguments = extractAbiEncodedConstructorArguments(
202201
populatedRecompiledBytecode,
203202
onchainCreationBytecode,
204203
);
205-
const constructorAbiParamInputs = new Interface(metadata?.output?.abi).deploy
206-
.inputs;
204+
const constructorAbiParamInputs = new Interface(abi).deploy.inputs;
207205
if (abiEncodedConstructorArguments) {
208206
if (!constructorAbiParamInputs) {
209207
throw new Error(

packages/lib-sourcify/src/Verification/Verification.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ export class Verification {
492492
extractConstructorArgumentsTransformation(
493493
matchBytecodesResult.populatedRecompiledBytecode,
494494
this.onchainCreationBytecode,
495-
this.compilation.metadata,
495+
this.compilation.contractCompilerOutput?.abi || [],
496496
);
497497
this.creationTransformations = [
498498
...matchBytecodesResult.transformations,

0 commit comments

Comments
 (0)