Skip to content

Commit

Permalink
Remove unnecessary address parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
fvictorio committed Mar 2, 2024
1 parent a967c53 commit c4177d3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/factories/smock-contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export async function createFakeContract<Contract extends BaseContract>(
// 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);
});
Expand All @@ -50,7 +50,7 @@ function mockifyContractFactory<T extends ContractFactory>(
// 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);
});
Expand Down
3 changes: 1 addition & 2 deletions src/logic/programmable-function-logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/sandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class Sandbox {
private async overrideCall(address: Buffer, data: Buffer): ReturnType<CallOverrideCallback> {
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;
Expand Down

0 comments on commit c4177d3

Please sign in to comment.