Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SimulationInterface<T>

SimulationInterface allows the simulation of ethereum transactions using Tenderly's api. This allows us to know information before executing a transaction on mainnet. For example it can simulate how much slippage is likely to be experienced when withdrawing from a vault, or how many underlying tokens the user will receive upon withdrawing share tokens.

Type parameters

Hierarchy

  • ServiceInterface<T>
    • SimulationInterface

Index

Constructors

Properties

chainId: 1 | 10 | 250 | 1337 | 42161
ctx: Context
events: Emittery<Record<string, unknown>, Record<string, unknown> & OmnipresentEventData, never>
simulationExecutor: SimulationExecutor = ...
yearn: Yearn<T>

Methods

  • _deposit(vault: string, token: string, amount: string, account: string, options?: ZapOptions, overrides?: CallOverrides): Promise<TransactionOutcome>
  • _withdraw(vault: string, token: string, amount: string, account: string, options?: ZapOptions, overrides?: CallOverrides): Promise<TransactionOutcome>
  • approve(__namedParameters: DepositArgs): Promise<string>
  • depositNeedsApproving(__namedParameters: { depositArgs: DepositArgs; signer: JsonRpcSigner }): Promise<boolean>
  • Parameters

    • __namedParameters: { depositArgs: DepositArgs; signer: JsonRpcSigner }
      • depositArgs: DepositArgs
      • signer: JsonRpcSigner

    Returns Promise<boolean>

  • getActionableAddress(__namedParameters: { toVault: string }): Promise<string>
  • getApprovalData(__namedParameters: { depositArgs: DepositArgs; signer: JsonRpcSigner }): Promise<ApprovalData>
  • Parameters

    • __namedParameters: { depositArgs: DepositArgs; signer: JsonRpcSigner }
      • depositArgs: DepositArgs
      • signer: JsonRpcSigner

    Returns Promise<ApprovalData>

  • getEncodedInputData(__namedParameters: { amount: string; toVault: string; vaultContract: VaultContract }): Promise<undefined | string>
  • Parameters

    • __namedParameters: { amount: string; toVault: string; vaultContract: VaultContract }
      • amount: string
      • toVault: string
      • vaultContract: VaultContract

    Returns Promise<undefined | string>

  • getVaultContract(__namedParameters: { signer: JsonRpcSigner; toVault: string }): VaultContractType
  • Parameters

    • __namedParameters: { signer: JsonRpcSigner; toVault: string }
      • signer: JsonRpcSigner
      • toVault: string

    Returns VaultContractType

  • getWithdrawApprovalData(__namedParameters: WithdrawArgs): Promise<{ forkId: undefined; needsApproving: boolean; root: undefined } | { forkId: string; needsApproving: boolean; root: string }>
  • Parameters

    • __namedParameters: WithdrawArgs

    Returns Promise<{ forkId: undefined; needsApproving: boolean; root: undefined } | { forkId: string; needsApproving: boolean; root: string }>

  • getZapInApprovalData(__namedParameters: DepositArgs): Promise<{ needsApproving: boolean } & ApprovalData>
  • getZapInSimulationArgs(__namedParameters: { depositArgs: DepositArgs; vault: ZappableVault }): Promise<{ forkId?: string; simulateFn: any }>
  • getZapOutSimulationArgs(__namedParameters: { token: Token; withdrawArgs: WithdrawArgs }): Promise<{ forkId?: string; simulateFn: any }>
  • getZapProtocol(__namedParameters: { vaultAddress: string }): ZapProtocol
  • getZappableVault(__namedParameters: { vaultAddress: string; vaultContract: VaultContractType }): Promise<ZappableVault>
  • handleDirectSimulationDeposit(__namedParameters: DirectDepositSimulationArgs): Promise<TransactionOutcome>
  • handleZapInSimulationDeposit(__namedParameters: ZapInSimulationDepositArgs): Promise<TransactionOutcome>
  • handleZapOutSimulation(__namedParameters: ZapOutSimulationArgs): Promise<TransactionOutcome>
  • isUnderlyingToken(__namedParameters: { address: string; vault: string }): Promise<boolean>
  • parseDepositSimulationOutcome(vault: string, token: string, amount: string, account: string, simulationOutcome: SimulationResponse): Promise<TransactionOutcome>
  • parseSimulationTargetTokenAmount(targetToken: string, account: string, simulationOutcome: SimulationResponse): Promise<string>
  • parseWithdrawSimulationOutcome(vault: string, token: string, amount: string, account: string, simulationOutcome: SimulationResponse): Promise<TransactionOutcome>
  • shouldUsePartnerService(vault: string): boolean

Generated using TypeDoc