Skip to content

Commit

Permalink
Add support of tx.origin worker in job resolvers
Browse files Browse the repository at this point in the history
  • Loading branch information
defi-dev committed Mar 26, 2024
1 parent a39f803 commit 7c1f29e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
6 changes: 3 additions & 3 deletions app/Network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ export class Network {
return;
}

const results = await this.queryPollResolvers(false, resolversToCall);
const results = await this.queryPollResolvers(false, resolversToCall, this.agents[0].getWorkerSignerAddress());
let jobsToExecute = 0;

for (let i = 0; i < results.length; i++) {
Expand Down Expand Up @@ -674,8 +674,8 @@ export class Network {
return (await this.provider.getNetwork()).chainId;
}

public async queryPollResolvers(bl: boolean, resolversToCall: any[]): Promise<any> {
return this.multicall.ethCallStatic('tryAggregate', [false, resolversToCall]);
public async queryPollResolvers(bl: boolean, resolversToCall: any[], from: string): Promise<any> {
return this.multicall.ethCallStatic('tryAggregate', [false, resolversToCall], { from });
}

public async queryLensJobsRawBytes32(agent: string, jobKey: string): Promise<string> {
Expand Down
2 changes: 2 additions & 0 deletions app/Types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,8 @@ export interface IAgent {

getKeyAddress(): string;

getWorkerSignerAddress(): string;

getKeeperId(): number;

getCfg(): number;
Expand Down
6 changes: 5 additions & 1 deletion app/agents/AbstractAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -565,9 +565,13 @@ export abstract class AbstractAgent implements IAgent {
return { baseFeePerGas, maxPriority };
}

public getWorkerSignerAddress() {
return this.workerSigner.address;
}

protected async populateTxExtraFields(tx: UnsignedTransaction) {
tx.chainId = this.network.getChainId();
tx['from'] = this.workerSigner.address;
tx['from'] = this.getWorkerSignerAddress();

const priorityFeeAddGwei = BigInt(this.executorConfig.gas_price_priority_add_gwei);
const { baseFeePerGas, maxPriority } = await this.getTxFeeData();
Expand Down

0 comments on commit 7c1f29e

Please sign in to comment.