/* Autogenerated file. Do not edit manually. */ /* tslint:disable */ /* eslint-disable */ import { BigNumberish, Overrides } from "ethers"; import { HandlerOptions } from "@sentio/sdk"; import { addContractByABI, getContractByABI, addProcessor, getProcessor, getProvider, transformEtherError, BindOptions, BaseProcessor, BaseProcessorTemplate, BoundContractView, ContractContext, ContractView, DummyProvider, EthChainId, TypedCallTrace, EthContext, EthFetchConfig, PreprocessResult, encodeCallData, } from "@sentio/sdk/eth"; import { EthCallParam, EthCallContext, PreparedData } from "@sentio/protos"; import { WETH9__factory } from "./index.js"; import { WETH9, ApprovalEvent, ApprovalEventFilter, TransferEvent, TransferEventFilter, DepositEvent, DepositEventFilter, WithdrawalEvent, WithdrawalEventFilter, } from "./WETH9.js"; export interface NameCallObject {} export type NameCallTrace = TypedCallTrace<[], NameCallObject>; export interface ApproveCallObject { guy: string; wad: bigint; } export type ApproveCallTrace = TypedCallTrace< [string, bigint], ApproveCallObject >; export interface TotalSupplyCallObject {} export type TotalSupplyCallTrace = TypedCallTrace<[], TotalSupplyCallObject>; export interface TransferFromCallObject { src: string; dst: string; wad: bigint; } export type TransferFromCallTrace = TypedCallTrace< [string, string, bigint], TransferFromCallObject >; export interface WithdrawCallObject { wad: bigint; } export type WithdrawCallTrace = TypedCallTrace<[bigint], WithdrawCallObject>; export interface DecimalsCallObject {} export type DecimalsCallTrace = TypedCallTrace<[], DecimalsCallObject>; export interface BalanceOfCallObject {} export type BalanceOfCallTrace = TypedCallTrace<[string], BalanceOfCallObject>; export interface SymbolCallObject {} export type SymbolCallTrace = TypedCallTrace<[], SymbolCallObject>; export interface TransferCallObject { dst: string; wad: bigint; } export type TransferCallTrace = TypedCallTrace< [string, bigint], TransferCallObject >; export interface DepositCallObject {} export type DepositCallTrace = TypedCallTrace<[], DepositCallObject>; export interface AllowanceCallObject {} export type AllowanceCallTrace = TypedCallTrace< [string, string], AllowanceCallObject >; const templateContract = WETH9__factory.connect("0x0", DummyProvider); export class WETH9ContractView extends ContractView { constructor(contract: WETH9) { super(contract); this.callStatic.contract = contract; } async name( overrides?: Overrides, preparedData?: PreparedData, ethCallContext?: EthCallContext, ): Promise { try { return await this.contract.getFunction("name()")(overrides || {}); } catch (e) { const stack = new Error().stack; throw transformEtherError(e, undefined, stack); } } async totalSupply( overrides?: Overrides, preparedData?: PreparedData, ethCallContext?: EthCallContext, ): Promise { try { return await this.contract.getFunction("totalSupply()")(overrides || {}); } catch (e) { const stack = new Error().stack; throw transformEtherError(e, undefined, stack); } } async decimals( overrides?: Overrides, preparedData?: PreparedData, ethCallContext?: EthCallContext, ): Promise { try { return await this.contract.getFunction("decimals()")(overrides || {}); } catch (e) { const stack = new Error().stack; throw transformEtherError(e, undefined, stack); } } async balanceOf( arg0: string, overrides?: Overrides, preparedData?: PreparedData, ethCallContext?: EthCallContext, ): Promise { try { return await this.contract.getFunction("balanceOf(address)")( arg0, overrides || {}, ); } catch (e) { const stack = new Error().stack; throw transformEtherError(e, undefined, stack); } } async symbol( overrides?: Overrides, preparedData?: PreparedData, ethCallContext?: EthCallContext, ): Promise { try { return await this.contract.getFunction("symbol()")(overrides || {}); } catch (e) { const stack = new Error().stack; throw transformEtherError(e, undefined, stack); } } async allowance( arg0: string, arg1: string, overrides?: Overrides, preparedData?: PreparedData, ethCallContext?: EthCallContext, ): Promise { try { return await this.contract.getFunction("allowance(address,address)")( arg0, arg1, overrides || {}, ); } catch (e) { const stack = new Error().stack; throw transformEtherError(e, undefined, stack); } } callStatic = { contract: this.contract, async approve( guy: string, wad: BigNumberish, overrides?: Overrides, preparedData?: PreparedData, ethCallContext?: EthCallContext, ): Promise { try { return await this.contract .getFunction("approve(address,uint256)") .staticCall(guy, wad, overrides || {}); } catch (e) { const stack = new Error().stack; throw transformEtherError(e, undefined, stack); } }, async transferFrom( src: string, dst: string, wad: BigNumberish, overrides?: Overrides, preparedData?: PreparedData, ethCallContext?: EthCallContext, ): Promise { try { return await this.contract .getFunction("transferFrom(address,address,uint256)") .staticCall(src, dst, wad, overrides || {}); } catch (e) { const stack = new Error().stack; throw transformEtherError(e, undefined, stack); } }, async withdraw( wad: BigNumberish, overrides?: Overrides, preparedData?: PreparedData, ethCallContext?: EthCallContext, ): Promise { try { return await this.contract .getFunction("withdraw(uint256)") .staticCall(wad, overrides || {}); } catch (e) { const stack = new Error().stack; throw transformEtherError(e, undefined, stack); } }, async transfer( dst: string, wad: BigNumberish, overrides?: Overrides, preparedData?: PreparedData, ethCallContext?: EthCallContext, ): Promise { try { return await this.contract .getFunction("transfer(address,uint256)") .staticCall(dst, wad, overrides || {}); } catch (e) { const stack = new Error().stack; throw transformEtherError(e, undefined, stack); } }, async deposit( overrides?: Overrides, preparedData?: PreparedData, ethCallContext?: EthCallContext, ): Promise { try { return await this.contract .getFunction("deposit()") .staticCall(overrides || {}); } catch (e) { const stack = new Error().stack; throw transformEtherError(e, undefined, stack); } }, }; encodeCall = { name(callContext: EthCallContext): EthCallParam { return encodeCallData(callContext, "name", "function name()", []); }, approve( guy: string, wad: BigNumberish, callContext: EthCallContext, ): EthCallParam { return encodeCallData( callContext, "approve", "function approve(address,uint256)", [guy, wad], ); }, totalSupply(callContext: EthCallContext): EthCallParam { return encodeCallData( callContext, "totalSupply", "function totalSupply()", [], ); }, transferFrom( src: string, dst: string, wad: BigNumberish, callContext: EthCallContext, ): EthCallParam { return encodeCallData( callContext, "transferFrom", "function transferFrom(address,address,uint256)", [src, dst, wad], ); }, withdraw(wad: BigNumberish, callContext: EthCallContext): EthCallParam { return encodeCallData( callContext, "withdraw", "function withdraw(uint256)", [wad], ); }, decimals(callContext: EthCallContext): EthCallParam { return encodeCallData(callContext, "decimals", "function decimals()", []); }, balanceOf(arg0: string, callContext: EthCallContext): EthCallParam { return encodeCallData( callContext, "balanceOf", "function balanceOf(address)", [arg0], ); }, symbol(callContext: EthCallContext): EthCallParam { return encodeCallData(callContext, "symbol", "function symbol()", []); }, transfer( dst: string, wad: BigNumberish, callContext: EthCallContext, ): EthCallParam { return encodeCallData( callContext, "transfer", "function transfer(address,uint256)", [dst, wad], ); }, deposit(callContext: EthCallContext): EthCallParam { return encodeCallData(callContext, "deposit", "function deposit()", []); }, allowance( arg0: string, arg1: string, callContext: EthCallContext, ): EthCallParam { return encodeCallData( callContext, "allowance", "function allowance(address,address)", [arg0, arg1], ); }, }; } export class WETH9BoundContractView extends BoundContractView< WETH9, WETH9ContractView > { async name(overrides?: Overrides): Promise { return await this.view.name( { blockTag: this.context.blockNumber, ...overrides, }, this.context.preparedData, this.context.getEthCallContext(), ); } async totalSupply(overrides?: Overrides): Promise { return await this.view.totalSupply( { blockTag: this.context.blockNumber, ...overrides, }, this.context.preparedData, this.context.getEthCallContext(), ); } async decimals(overrides?: Overrides): Promise { return await this.view.decimals( { blockTag: this.context.blockNumber, ...overrides, }, this.context.preparedData, this.context.getEthCallContext(), ); } async balanceOf(arg0: string, overrides?: Overrides): Promise { return await this.view.balanceOf( arg0, { blockTag: this.context.blockNumber, ...overrides, }, this.context.preparedData, this.context.getEthCallContext(), ); } async symbol(overrides?: Overrides): Promise { return await this.view.symbol( { blockTag: this.context.blockNumber, ...overrides, }, this.context.preparedData, this.context.getEthCallContext(), ); } async allowance( arg0: string, arg1: string, overrides?: Overrides, ): Promise { return await this.view.allowance( arg0, arg1, { blockTag: this.context.blockNumber, ...overrides, }, this.context.preparedData, this.context.getEthCallContext(), ); } callStatic = { view: this.view, context: this.context, async approve( guy: string, wad: BigNumberish, overrides?: Overrides, ): Promise { return await this.view.callStatic.approve( guy, wad, { blockTag: this.context.blockNumber, ...overrides, }, this.context.preparedData, this.context.getEthCallContext(), ); }, async transferFrom( src: string, dst: string, wad: BigNumberish, overrides?: Overrides, ): Promise { return await this.view.callStatic.transferFrom( src, dst, wad, { blockTag: this.context.blockNumber, ...overrides, }, this.context.preparedData, this.context.getEthCallContext(), ); }, async withdraw(wad: BigNumberish, overrides?: Overrides): Promise { return await this.view.callStatic.withdraw( wad, { blockTag: this.context.blockNumber, ...overrides, }, this.context.preparedData, this.context.getEthCallContext(), ); }, async transfer( dst: string, wad: BigNumberish, overrides?: Overrides, ): Promise { return await this.view.callStatic.transfer( dst, wad, { blockTag: this.context.blockNumber, ...overrides, }, this.context.preparedData, this.context.getEthCallContext(), ); }, async deposit(overrides?: Overrides): Promise { return await this.view.callStatic.deposit( { blockTag: this.context.blockNumber, ...overrides, }, this.context.preparedData, this.context.getEthCallContext(), ); }, }; encodeCall = { view: this.view, context: this.context, name(overrides?: Overrides): EthCallParam { return this.view.encodeCall.name({ chainId: this.context.chainId.toString(), address: this.context.address, blockTag: this.context.getBlockTag(overrides), }); }, approve( guy: string, wad: BigNumberish, overrides?: Overrides, ): EthCallParam { return this.view.encodeCall.approve(guy, wad, { chainId: this.context.chainId.toString(), address: this.context.address, blockTag: this.context.getBlockTag(overrides), }); }, totalSupply(overrides?: Overrides): EthCallParam { return this.view.encodeCall.totalSupply({ chainId: this.context.chainId.toString(), address: this.context.address, blockTag: this.context.getBlockTag(overrides), }); }, transferFrom( src: string, dst: string, wad: BigNumberish, overrides?: Overrides, ): EthCallParam { return this.view.encodeCall.transferFrom(src, dst, wad, { chainId: this.context.chainId.toString(), address: this.context.address, blockTag: this.context.getBlockTag(overrides), }); }, withdraw(wad: BigNumberish, overrides?: Overrides): EthCallParam { return this.view.encodeCall.withdraw(wad, { chainId: this.context.chainId.toString(), address: this.context.address, blockTag: this.context.getBlockTag(overrides), }); }, decimals(overrides?: Overrides): EthCallParam { return this.view.encodeCall.decimals({ chainId: this.context.chainId.toString(), address: this.context.address, blockTag: this.context.getBlockTag(overrides), }); }, balanceOf(arg0: string, overrides?: Overrides): EthCallParam { return this.view.encodeCall.balanceOf(arg0, { chainId: this.context.chainId.toString(), address: this.context.address, blockTag: this.context.getBlockTag(overrides), }); }, symbol(overrides?: Overrides): EthCallParam { return this.view.encodeCall.symbol({ chainId: this.context.chainId.toString(), address: this.context.address, blockTag: this.context.getBlockTag(overrides), }); }, transfer( dst: string, wad: BigNumberish, overrides?: Overrides, ): EthCallParam { return this.view.encodeCall.transfer(dst, wad, { chainId: this.context.chainId.toString(), address: this.context.address, blockTag: this.context.getBlockTag(overrides), }); }, deposit(overrides?: Overrides): EthCallParam { return this.view.encodeCall.deposit({ chainId: this.context.chainId.toString(), address: this.context.address, blockTag: this.context.getBlockTag(overrides), }); }, allowance(arg0: string, arg1: string, overrides?: Overrides): EthCallParam { return this.view.encodeCall.allowance(arg0, arg1, { chainId: this.context.chainId.toString(), address: this.context.address, blockTag: this.context.getBlockTag(overrides), }); }, }; } export type WETH9Context = ContractContext; export class WETH9Processor extends BaseProcessor< WETH9, WETH9BoundContractView > { onEventApproval( handler: (event: ApprovalEvent, ctx: WETH9Context) => void, filter?: ApprovalEventFilter | ApprovalEventFilter[], handlerOptions?: HandlerOptions, preprocessHandler?: ( event: ApprovalEvent, ctx: WETH9Context, preprocessStore: { [k: string]: any }, ) => Promise, ): this { if (!filter) { filter = templateContract.filters["Approval(address,address,uint256)"]( null, null, null, ); } return super.onEthEvent( handler, filter!, handlerOptions, preprocessHandler, ); } onEventTransfer( handler: (event: TransferEvent, ctx: WETH9Context) => void, filter?: TransferEventFilter | TransferEventFilter[], handlerOptions?: HandlerOptions, preprocessHandler?: ( event: TransferEvent, ctx: WETH9Context, preprocessStore: { [k: string]: any }, ) => Promise, ): this { if (!filter) { filter = templateContract.filters["Transfer(address,address,uint256)"]( null, null, null, ); } return super.onEthEvent( handler, filter!, handlerOptions, preprocessHandler, ); } onEventDeposit( handler: (event: DepositEvent, ctx: WETH9Context) => void, filter?: DepositEventFilter | DepositEventFilter[], handlerOptions?: HandlerOptions, preprocessHandler?: ( event: DepositEvent, ctx: WETH9Context, preprocessStore: { [k: string]: any }, ) => Promise, ): this { if (!filter) { filter = templateContract.filters["Deposit(address,uint256)"](null, null); } return super.onEthEvent( handler, filter!, handlerOptions, preprocessHandler, ); } onEventWithdrawal( handler: (event: WithdrawalEvent, ctx: WETH9Context) => void, filter?: WithdrawalEventFilter | WithdrawalEventFilter[], handlerOptions?: HandlerOptions, preprocessHandler?: ( event: WithdrawalEvent, ctx: WETH9Context, preprocessStore: { [k: string]: any }, ) => Promise, ): this { if (!filter) { filter = templateContract.filters["Withdrawal(address,uint256)"]( null, null, ); } return super.onEthEvent( handler, filter!, handlerOptions, preprocessHandler, ); } onCallName( handler: (call: NameCallTrace, ctx: WETH9Context) => void, handlerOptions?: HandlerOptions, preprocessHandler?: ( call: NameCallTrace, ctx: WETH9Context, ) => Promise, ): this { return super.onEthTrace( "0x06fdde03", handler as any, handlerOptions, preprocessHandler, ); } onCallApprove( handler: (call: ApproveCallTrace, ctx: WETH9Context) => void, handlerOptions?: HandlerOptions, preprocessHandler?: ( call: ApproveCallTrace, ctx: WETH9Context, ) => Promise, ): this { return super.onEthTrace( "0x095ea7b3", handler as any, handlerOptions, preprocessHandler, ); } onCallTotalSupply( handler: (call: TotalSupplyCallTrace, ctx: WETH9Context) => void, handlerOptions?: HandlerOptions, preprocessHandler?: ( call: TotalSupplyCallTrace, ctx: WETH9Context, ) => Promise, ): this { return super.onEthTrace( "0x18160ddd", handler as any, handlerOptions, preprocessHandler, ); } onCallTransferFrom( handler: (call: TransferFromCallTrace, ctx: WETH9Context) => void, handlerOptions?: HandlerOptions, preprocessHandler?: ( call: TransferFromCallTrace, ctx: WETH9Context, ) => Promise, ): this { return super.onEthTrace( "0x23b872dd", handler as any, handlerOptions, preprocessHandler, ); } onCallWithdraw( handler: (call: WithdrawCallTrace, ctx: WETH9Context) => void, handlerOptions?: HandlerOptions, preprocessHandler?: ( call: WithdrawCallTrace, ctx: WETH9Context, ) => Promise, ): this { return super.onEthTrace( "0x2e1a7d4d", handler as any, handlerOptions, preprocessHandler, ); } onCallDecimals( handler: (call: DecimalsCallTrace, ctx: WETH9Context) => void, handlerOptions?: HandlerOptions, preprocessHandler?: ( call: DecimalsCallTrace, ctx: WETH9Context, ) => Promise, ): this { return super.onEthTrace( "0x313ce567", handler as any, handlerOptions, preprocessHandler, ); } onCallBalanceOf( handler: (call: BalanceOfCallTrace, ctx: WETH9Context) => void, handlerOptions?: HandlerOptions, preprocessHandler?: ( call: BalanceOfCallTrace, ctx: WETH9Context, ) => Promise, ): this { return super.onEthTrace( "0x70a08231", handler as any, handlerOptions, preprocessHandler, ); } onCallSymbol( handler: (call: SymbolCallTrace, ctx: WETH9Context) => void, handlerOptions?: HandlerOptions, preprocessHandler?: ( call: SymbolCallTrace, ctx: WETH9Context, ) => Promise, ): this { return super.onEthTrace( "0x95d89b41", handler as any, handlerOptions, preprocessHandler, ); } onCallTransfer( handler: (call: TransferCallTrace, ctx: WETH9Context) => void, handlerOptions?: HandlerOptions, preprocessHandler?: ( call: TransferCallTrace, ctx: WETH9Context, ) => Promise, ): this { return super.onEthTrace( "0xa9059cbb", handler as any, handlerOptions, preprocessHandler, ); } onCallDeposit( handler: (call: DepositCallTrace, ctx: WETH9Context) => void, handlerOptions?: HandlerOptions, preprocessHandler?: ( call: DepositCallTrace, ctx: WETH9Context, ) => Promise, ): this { return super.onEthTrace( "0xd0e30db0", handler as any, handlerOptions, preprocessHandler, ); } onCallAllowance( handler: (call: AllowanceCallTrace, ctx: WETH9Context) => void, handlerOptions?: HandlerOptions, preprocessHandler?: ( call: AllowanceCallTrace, ctx: WETH9Context, ) => Promise, ): this { return super.onEthTrace( "0xdd62ed3e", handler as any, handlerOptions, preprocessHandler, ); } public static filters = { Approval( src?: string | null, guy?: string | null, wad?: null, ): ApprovalEventFilter { return templateContract.filters["Approval(address,address,uint256)"]( src, guy, wad, ); }, Transfer( src?: string | null, dst?: string | null, wad?: null, ): TransferEventFilter { return templateContract.filters["Transfer(address,address,uint256)"]( src, dst, wad, ); }, Deposit(dst?: string | null, wad?: null): DepositEventFilter { return templateContract.filters["Deposit(address,uint256)"](dst, wad); }, Withdrawal(src?: string | null, wad?: null): WithdrawalEventFilter { return templateContract.filters["Withdrawal(address,uint256)"](src, wad); }, }; protected CreateBoundContractView(): WETH9BoundContractView { const view = getWETH9Contract(this.config.network, this.config.address); return new WETH9BoundContractView(this.config.address, view); } public static bind(options: BindOptions): WETH9Processor { if (!options.name) { options.name = "WETH9"; } let processor = getProcessor(options) as WETH9Processor; if (!processor) { processor = new WETH9Processor(options); addProcessor(options, processor); } return processor; } } export class WETH9ProcessorTemplate extends BaseProcessorTemplate< WETH9, WETH9BoundContractView > { bindInternal(options: BindOptions) { if (!options.name) { options.name = "WETH9"; } let processor = getProcessor(options) as WETH9Processor; if (!processor) { processor = new WETH9Processor(options); addProcessor(options, processor); } return processor; } onEventApproval( handler: (event: ApprovalEvent, ctx: WETH9Context) => void, filter?: ApprovalEventFilter | ApprovalEventFilter[], handlerOptions?: HandlerOptions, preprocessHandler?: ( event: ApprovalEvent, ctx: WETH9Context, preprocessStore: { [k: string]: any }, ) => Promise, ): this { if (!filter) { filter = templateContract.filters["Approval(address,address,uint256)"]( null, null, null, ); } return super.onEthEvent( handler, filter!, handlerOptions, preprocessHandler, ); } onEventTransfer( handler: (event: TransferEvent, ctx: WETH9Context) => void, filter?: TransferEventFilter | TransferEventFilter[], handlerOptions?: HandlerOptions, preprocessHandler?: ( event: TransferEvent, ctx: WETH9Context, preprocessStore: { [k: string]: any }, ) => Promise, ): this { if (!filter) { filter = templateContract.filters["Transfer(address,address,uint256)"]( null, null, null, ); } return super.onEthEvent( handler, filter!, handlerOptions, preprocessHandler, ); } onEventDeposit( handler: (event: DepositEvent, ctx: WETH9Context) => void, filter?: DepositEventFilter | DepositEventFilter[], handlerOptions?: HandlerOptions, preprocessHandler?: ( event: DepositEvent, ctx: WETH9Context, preprocessStore: { [k: string]: any }, ) => Promise, ): this { if (!filter) { filter = templateContract.filters["Deposit(address,uint256)"](null, null); } return super.onEthEvent( handler, filter!, handlerOptions, preprocessHandler, ); } onEventWithdrawal( handler: (event: WithdrawalEvent, ctx: WETH9Context) => void, filter?: WithdrawalEventFilter | WithdrawalEventFilter[], handlerOptions?: HandlerOptions, preprocessHandler?: ( event: WithdrawalEvent, ctx: WETH9Context, preprocessStore: { [k: string]: any }, ) => Promise, ): this { if (!filter) { filter = templateContract.filters["Withdrawal(address,uint256)"]( null, null, ); } return super.onEthEvent( handler, filter!, handlerOptions, preprocessHandler, ); } } export function getWETH9Contract( chainId: EthChainId, address: string, ): WETH9ContractView { let contract = getContractByABI( "WETH9", address, chainId, ) as WETH9ContractView; if (!contract) { const rawContract = WETH9__factory.connect(address, getProvider(chainId)); contract = new WETH9ContractView(rawContract); addContractByABI("WETH9", address, chainId, contract); } return contract; } export function getWETH9ContractOnContext( context: EthContext, address: string, ): WETH9BoundContractView { const view = getWETH9Contract(context.getChainId(), address); const boundView = new WETH9BoundContractView(address, view); boundView.context = context; if (boundView.callStatic) { boundView.callStatic.context = context; } return boundView; }