Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Commit

Permalink
feat(studio): Add load to Multicall wrapper interface (#2825)
Browse files Browse the repository at this point in the history
  • Loading branch information
immasandwich committed Jul 13, 2023
1 parent 18379f2 commit ce4285b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/multicall/multicall.contract.ts
@@ -1,6 +1,6 @@
import { Fragment, FunctionFragment, JsonFragment } from '@ethersproject/abi';

import { ContractCall } from './multicall.ethers';
import { ContractCall } from './multicall.interface';

export class MulticallContract {
private _address: string;
Expand Down
11 changes: 1 addition & 10 deletions src/multicall/multicall.ethers.ts
Expand Up @@ -5,16 +5,7 @@ import { FunctionFragment, Interface } from 'ethers/lib/utils';
import { Multicall } from '~contract/contracts';

import { MulticallContract } from './multicall.contract';
import { IMulticallWrapper } from './multicall.interface';

export type ContractCall = {
fragment: FunctionFragment;
address: string;
params: any[];
stack?: string;
};

type TargetContract = Pick<Contract, 'functions' | 'interface' | 'callStatic' | 'address'>;
import { ContractCall, IMulticallWrapper, TargetContract } from './multicall.interface';

export const isMulticallUnderlyingError = (err: Error) => err.message.includes('Multicall call failed for');

Expand Down
13 changes: 11 additions & 2 deletions src/multicall/multicall.interface.ts
@@ -1,10 +1,19 @@
import { Contract } from 'ethers';
import { FunctionFragment } from '@ethersproject/abi';
import { Contract, ethers } from 'ethers';

import { Multicall } from '~contract/contracts';

type TargetContract = Pick<Contract, 'functions' | 'interface' | 'callStatic' | 'address'>;
export type ContractCall = {
fragment: FunctionFragment;
address: string;
params: any[];
stack?: string;
};

export type TargetContract = Pick<Contract, 'functions' | 'interface' | 'callStatic' | 'address'>;

export interface IMulticallWrapper {
get contract(): Multicall;
load(call: ContractCall): Promise<ethers.utils.Result>;
wrap<T extends TargetContract>(contract: T): T;
}

0 comments on commit ce4285b

Please sign in to comment.