Simulate a Workflow

Setup Requirements

  • Set up Inverter Network SDK: Refer to the Quick Start guide for detailed instructions.

As we support multicall functionality there is a case for simulating a workflow deployment which enables us to retreive certain addresses before they exist.

( optional ) You can pass in a ModuleData typed object into the requestedModules constant's fields, this makes it so that you can work with your self managed inverter modules

// EXEMPLE MixedRequestedModules USAGE
import type { ModuleData, MixedRequestedModules } from '@inverter-network/sdk'

const AUT_Roles_v1 = {'<your_module_data>'} as const satisifies ModuleData

const requestedModules = {
    fundingManager: 'FM_DepositVault_v1',
    paymentProcessor: 'PP_Simple_v1',
    authorizer: AUT_Roles_v1,
} as const satisfies MixedRequestedModules

Simulating the Workflow Deployment

Parameters

  • requestedModules (required): This parameter defines the modules which will be simulated.

  • args (required): This parameter is used to tell the simulations what the modules arguments are.

  • tagConfig (optional): This parameter is to tell the arg's parser how to parse the arguments.

import { sdk } from '<your_sdk_export>'
import type { GetDeployWorkflowArgs } from '@inverter-network/sdk'

const { getSimulatedWorkflow } = sdk

// Should either be `as const` or be passed dirrectly in the `requestedModules`
const requestedModules = {
    fundingManager: 'FM_DepositVault_v1',
    paymentProcessor: 'PP_Simple_v1',
    authorizer: 'AUT_Roles_v1'
} as const satisfies MixedRequestedModules

// Should either be `as const` or be passed dirrectly in to `args`
const args = {
    fundingManager: {
        orchestratorTokenAddress: "0x5eb14c2e7D0cD925327d74ae4ce3fC692ff8ABEF",
    },
    authorizer: {
        initialAdmin: "0x7AcaF5360474b8E40f619770c7e8803cf3ED1053",
    }
} as const satisfies GetDeployWorkflowArgs<typeof requestedModules>

const {
      orchestratorAddress,
      logicModuleAddresses,
      fundingManagerAddress,
      authorizerAddress,
      paymentProcessorAddress,
      bytecode,
      factoryAddress,
      trustedForwarderAddress,
    } = await sdk.getSimulatedWorkflow({
      requestedModules,
      args,
      tagConfig: {
        decimals: 18,
        issuanceTokenDecimals: 18,
      }
    })

Last updated