From c4177d30174c731ad162148ce94a82221cbe0d22 Mon Sep 17 00:00:00 2001 From: Franco Victorio Date: Sat, 2 Mar 2024 23:20:16 +0100 Subject: [PATCH] Remove unnecessary address parameter --- src/factories/smock-contract.ts | 4 ++-- src/logic/programmable-function-logic.ts | 3 +-- src/sandbox.ts | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/factories/smock-contract.ts b/src/factories/smock-contract.ts index 65198ee..631d0eb 100644 --- a/src/factories/smock-contract.ts +++ b/src/factories/smock-contract.ts @@ -28,7 +28,7 @@ export async function createFakeContract( // attach to every contract function, all the programmable and watchable logic contractFunctions.forEach(([sighash, name]) => { const { encoder, calls$ } = getFunctionEventData(vm, contractInterface, fake.address, sighash); - const functionLogic = new SafeProgrammableContract(Address.fromString(fake.address), contractInterface, sighash, name, calls$, encoder); + const functionLogic = new SafeProgrammableContract(contractInterface, sighash, name, calls$, encoder); fillProgrammableContractFunction(fake[name], functionLogic); addFunctionToMap(fake.address, sighash, functionLogic); }); @@ -50,7 +50,7 @@ function mockifyContractFactory( // attach to every contract function, all the programmable and watchable logic contractFunctions.forEach(([sighash, name]) => { const { encoder, calls$ } = getFunctionEventData(vm, mock.interface, mock.address, sighash); - const functionLogic = new ProgrammableFunctionLogic(Address.fromString(mock.address), mock.interface, sighash, name, calls$, encoder); + const functionLogic = new ProgrammableFunctionLogic(mock.interface, sighash, name, calls$, encoder); fillProgrammableContractFunction(mock[name], functionLogic); addFunctionToMap(mock.address, sighash, functionLogic); }); diff --git a/src/logic/programmable-function-logic.ts b/src/logic/programmable-function-logic.ts index 5bcd23a..f652dfd 100644 --- a/src/logic/programmable-function-logic.ts +++ b/src/logic/programmable-function-logic.ts @@ -27,7 +27,6 @@ export class ProgrammableFunctionLogic extends WatchableFunctionLogic { protected answerByArgs: { answer: ProgrammedAnswer; args: unknown[] }[] = []; constructor( - private address: Address, private contractInterface: Interface, private sighash: string | null, name: string, @@ -79,7 +78,7 @@ export class ProgrammableFunctionLogic extends WatchableFunctionLogic { this.answerByArgs = []; } - async getEncodedCallAnswer(address: Address, data: Buffer): Promise<[result: Buffer, shouldRevert: boolean] | undefined> { + async getEncodedCallAnswer(data: Buffer): Promise<[result: Buffer, shouldRevert: boolean] | undefined> { this.callCount++; const answer = this.getCallAnswer(data); diff --git a/src/sandbox.ts b/src/sandbox.ts index b344c58..a390358 100644 --- a/src/sandbox.ts +++ b/src/sandbox.ts @@ -43,7 +43,7 @@ export class Sandbox { private async overrideCall(address: Buffer, data: Buffer): ReturnType { const calledFunction = this.getCalledFunction(address, data); - const encodedCallAnswer = await calledFunction?.getEncodedCallAnswer(new Address(address), data); + const encodedCallAnswer = await calledFunction?.getEncodedCallAnswer(data); if (encodedCallAnswer === undefined) { return undefined;