Skip to content

Commit 1992bc7

Browse files
committed
Use consistent ethers version and JsonFragment instead of abitype
1 parent 14683cb commit 1992bc7

File tree

12 files changed

+50
-41
lines changed

12 files changed

+50
-41
lines changed

package-lock.json

Lines changed: 22 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/compilers-types/src/CompilationTypes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Abi } from "abitype";
1+
import { JsonFragment } from "ethers";
22
import { SolidityOutputError, SoliditySettings } from "./SolidityTypes";
33
import { VyperOutputError } from "./VyperTypes";
44

@@ -75,7 +75,7 @@ export interface Userdoc {
7575
export type OutputError = SolidityOutputError | VyperOutputError;
7676

7777
export interface MetadataOutput {
78-
abi: Abi;
78+
abi: JsonFragment[];
7979
devdoc?: Devdoc;
8080
userdoc?: Userdoc;
8181
}

packages/compilers-types/src/SolidityTypes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Abi } from "abitype";
1+
import { JsonFragment } from "ethers";
22
import { Devdoc, Userdoc, LinkReferences } from "./CompilationTypes";
33

44
interface File {
@@ -158,7 +158,7 @@ export interface StorageLayout {
158158
};
159159
}
160160
export interface SolidityOutputContract {
161-
abi: Abi;
161+
abi: JsonFragment[];
162162
metadata: string;
163163
userdoc?: Userdoc;
164164
devdoc?: Devdoc;

packages/compilers-types/src/VyperTypes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Abi } from "abitype";
1+
import { JsonFragment } from "ethers";
22
import { Devdoc } from "./CompilationTypes";
33
import { Userdoc } from "./CompilationTypes";
44

@@ -63,7 +63,7 @@ export interface VyperOutputSources {
6363
}
6464

6565
export interface VyperOutputContract {
66-
abi: Abi;
66+
abi: JsonFragment[];
6767
userdoc: Userdoc;
6868
devdoc: Devdoc;
6969
ir: string;

packages/lib-sourcify/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,9 @@
4141
"@ethereumjs/statemanager": "2.4.0",
4242
"@ethereumjs/util": "9.1.0",
4343
"@ethereumjs/vm": "8.1.1",
44-
"@ethersproject/abi": "5.8.0",
4544
"@ethersproject/bignumber": "5.8.0",
4645
"@ethersproject/bytes": "5.8.0",
4746
"@fairdatasociety/bmt-js": "2.1.0",
48-
"abitype": "1.0.8",
4947
"bs58": "5.0.0",
5048
"ethers": "6.15.0",
5149
"jszip": "3.10.1",

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

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ import {
88
CompiledContractCborAuxdata,
99
StringMap,
1010
} from '../Compilation/CompilationTypes';
11-
import { AbiConstructor } from 'abitype';
12-
import { defaultAbiCoder as abiCoder, ParamType } from '@ethersproject/abi';
13-
import { id as keccak256Str } from 'ethers';
11+
import { AbiCoder, id as keccak256Str, Interface } from 'ethers';
1412
import { logError } from '../logger';
1513

14+
const abiCoder = AbiCoder.defaultAbiCoder();
15+
1616
export type Transformation = {
1717
type: 'insert' | 'replace';
1818
reason:
@@ -202,11 +202,8 @@ export function extractConstructorArgumentsTransformation(
202202
populatedRecompiledBytecode,
203203
onchainCreationBytecode,
204204
);
205-
const constructorAbiParamInputs = (
206-
metadata?.output?.abi?.find(
207-
(param) => param.type === 'constructor',
208-
) as AbiConstructor
209-
)?.inputs as ParamType[];
205+
const constructorAbiParamInputs = new Interface(metadata?.output?.abi).deploy
206+
.inputs;
210207
if (abiEncodedConstructorArguments) {
211208
if (!constructorAbiParamInputs) {
212209
throw new Error(

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Abi } from 'abitype';
1+
import { JsonFragment } from 'ethers';
22
import {
33
CompilationLanguage,
44
CompilationTarget,
@@ -109,7 +109,7 @@ export interface VerificationExport {
109109
>;
110110
};
111111
contractCompilerOutput: {
112-
abi?: Abi;
112+
abi?: JsonFragment[];
113113
userdoc?: Userdoc;
114114
devdoc?: Devdoc;
115115
storageLayout?: StorageLayout;

services/server/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
"@google-cloud/cloud-sql-connector": "1.8.2",
5757
"@shazow/whatsabi": "0.22.2",
5858
"@solidity-parser/parser": "0.20.2",
59-
"abitype": "1.0.8",
6059
"bunyan": "1.8.15",
6160
"chalk": "4.1.2",
6261
"config": "3.3.12",

services/server/src/server/apiv1/verification/verification.common.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
rearrangeSources,
1818
} from "@ethereum-sourcify/lib-sourcify";
1919
import { Session } from "express-session";
20-
import { AbiConstructor, AbiParameter } from "abitype";
20+
import { JsonFragmentType } from "ethers";
2121
import QueryString from "qs";
2222
import { VerificationService } from "../../services/VerificationService";
2323
import {
@@ -144,7 +144,7 @@ export type SendableContract = ContractMeta & {
144144
invalid: InvalidSources;
145145
};
146146
verificationId: string;
147-
constructorArgumentsArray?: Mutable<AbiParameter[]>;
147+
constructorArgumentsArray?: readonly JsonFragmentType[];
148148
// creationBytecode?: string; // Not needed without create2
149149
};
150150

@@ -156,11 +156,9 @@ function getSendableContract(
156156

157157
return {
158158
verificationId,
159-
constructorArgumentsArray: (
160-
contract?.metadata?.output?.abi?.find(
161-
(abi) => abi.type === "constructor",
162-
) as AbiConstructor
163-
)?.inputs as Mutable<AbiParameter[]>,
159+
constructorArgumentsArray: contract?.metadata?.output?.abi?.find(
160+
(abi) => abi.type === "constructor",
161+
)?.inputs,
164162
// : contract?.creationBytecode, // Not needed without create2
165163
compiledPath: contract.compiledPath,
166164
name: contract.name,

services/server/src/server/services/utils/database-util.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import {
2121
PreRunCompilation,
2222
splitFullyQualifiedName,
2323
} from "@ethereum-sourcify/lib-sourcify";
24-
import { Abi } from "abitype";
2524
import {
2625
VerifiedContract as VerifiedContractApiObject,
2726
Bytes,
@@ -30,7 +29,7 @@ import {
3029
BytesTypes,
3130
Nullable,
3231
} from "../../types";
33-
import { keccak256 } from "ethers";
32+
import { keccak256, JsonFragment } from "ethers";
3433
import { Database } from "./Database";
3534
import logger from "../../../common/logger";
3635

@@ -67,7 +66,7 @@ export namespace Tables {
6766
name: string;
6867
fully_qualified_name: string;
6968
compilation_artifacts: {
70-
abi: Nullable<Abi>;
69+
abi: Nullable<JsonFragment[]>;
7170
userdoc: Nullable<any>;
7271
devdoc: Nullable<any>;
7372
storageLayout: Nullable<StorageLayout>;

0 commit comments

Comments
 (0)