Inverter Documentation
GithubDiscordTwitterLinks
  • Getting Started
  • Concepts
    • What is Inverter Network
    • The Inverter Protocol
    • Protocol Concepts
      • Workflow Model
        • Factories
        • Orchestrator
        • Authorizer
        • Funding Manager
        • Payment Processor
        • Logic Module
      • Module Library
        • Authorizers
          • Role Authorizer
          • Single Vote Governance Module
          • Token Gated Role Authorizer
        • Funding Managers
          • PIMs
            • Bancor Based PIM: Virtual Supply
            • Bancor Based PIM: Virtual Supply Buy Restriction
          • Deposit Vault Funding Manager
        • Payment Processors
          • Streaming Payment Processor
          • Simple Payment Processor
        • Logic Modules
          • Bounty Manager
          • Recurring Payment Manager
          • KPI Rewarder
          • Staking Manager
      • Primary Issuance Markets (PIMs)
      • Governance
      • Security
        • Upgradeability
        • Emergency Protocol
        • Audits
        • Bug Bounties
      • Fees
  • SDK's
    • TypeScript SDK
      • Deploy a Workflow
      • Operate a Workflow
      • Deploy a Contract
      • Simulate a Workflow
      • Perform a Multicall
    • React SDK
      • Deploy a Workflow
      • Operate a Workflow
      • Deploy a Contract
      • Query the Indexer
      • Subscribe to the Indexer
      • Simulate a Workflow
      • Perform a Multicall
    • Graphql SDK
    • Workflow Guides
      • Grant/Revoke Roles
      • Bounty Manager
      • Bonding Curve
      • Deposit Vault
    • API
      • Inverter
      • getDeployWorkflowOptions
      • deployWorkflow
      • getModule
      • getWorkflow
      • deploy
      • getSimulatedWorkflow
      • moduleMulticall
  • Contracts
    • Technical Specification
    • Security Guidelines
    • Deployment Addresses
    • Technical Reference
      • Factories
        • Interfaces
          • IModuleFactory_v1.sol
          • IOrchestratorFactory_v1.sol
        • ModuleFactory_v1.sol
        • OrchestratorFactory_v1.sol
      • Orchestrator
        • Abstracts
          • ModuleManagerBase_v1.sol
        • Interfaces
          • IModuleManagerBase_v1.sol
          • IOrchestrator_v1.sol
        • Orchestrator_v1.sol
      • Modules
        • Authorizer
          • Role
            • Interfaces
              • IAUT_EXT_VotingRoles_v1.sol
              • IAUT_TokenGated_Roles_v1.sol
            • AUT_EXT_VotingRoles_v1.sol
            • AUT_Roles_v1.sol
            • AUT_TokenGated_Roles_v1.sol
          • IAuthorizer_v1.sol
        • Base
          • IModule_v1.sol
          • Module_v1.sol
        • Funding Manager
          • Deposit Vault
            • FM_DepositVault_v1
            • Interfaces
              • IFM_DepositVault_v1
          • Bonding Curve
            • Abstracts
              • BondingCurveBase_v1.sol
              • RedeemingBondingCurveBase_v1.sol
              • VirtualCollateralSupplyBase_v1.sol
              • VirtualIssuanceSupplyBase_v1.sol
            • Formulas
              • BancorFormula.sol
              • Utils.sol
            • Interfaces
              • IBancorFormula.sol
              • IBondingCurveBase_v1.sol
              • IFM_BC_Bancor_Redeeming_VirtualSupply_v1.sol
              • IRedeemingBondingCurveBase_v1.sol
              • IVirtualCollateralSupplyBase_v1.sol
              • IVirtualIssuanceSupplyBase_v1.sol
            • FM_BC_Bancor_Redeeming_VirtualSupply_v1.sol
            • FM_BC_Restricted_Bancor_Redeeming_VirtualSupply_v1.sol
            • FM_BC_Tools
          • IFundingManager_v1.sol
        • Logic Module
          • Abstracts
            • ERC20PaymentClientBase_v1.sol
            • Oracle Integrations
              • UMA Optimistic Oracle V3
                • Optimistic Oracle V3
                  • Interfaces
                    • OptimisticOracleV3CallbackRecipientInterface.sol
                    • OptimisticOracleV3Interface.sol
                  • AncillaryData.sol
                  • ClaimData.sol
                • IOptimisticOracleIntegrator.sol
                • OptimisticOracleIntegrator.sol
          • Interfaces
            • IERC20PaymentClientBase_v1.sol
            • ILM_PC_Bounties_v1.sol
            • ILM_PC_KPIRewarder_v1.sol
            • ILM_PC_PaymentRouter_v1.sol
            • ILM_PC_RecurringPayments_v1.sol
            • ILM_PC_Staking_v1.sol
          • LM_PC_Bounties_v1.sol
          • LM_PC_KPIRewarder_v1.sol
          • LM_PC_PaymentRouter_v1.sol
          • LM_PC_RecurringPayments_v1.sol
          • LM_PC_Staking_v1.sol
        • Payment Processor
          • Interfaces
            • IPP_Streaming_v1.sol
          • IPaymentProcessor_v1.sol
          • PP_Simple_v1.sol
          • PP_Streaming_v1.sol
        • Lib
          • LibMetadata.sol
          • LinkedIdList.sol
          • SafeMath.sol
      • External
        • Fees
          • Interfaces
            • IFeeManager_v1.sol
          • FeeManager_v1.sol
        • Forwarder
          • Interfaces
            • ITransactionForwarder_v1.sol
          • TransactionForwarder_v1
        • Governance
          • Interfaces
            • IGovernor_v1.sol
          • Governor_v1.sol
        • Reverter
          • InverterReverter_v1.sol
        • ERC20Issuance
          • Interfaces
            • IERC20Issuance_v1.sol
          • ERC20Issuance_v1.sol
        • Interfaces
          • IERC2771Context.sol
      • Proxies
        • Interfaces
          • IInverterBeacon_v1.sol
          • IInverterProxyAdmin_v1.sol
          • IInverterTransparentUpgradeableProxy_v1.sol
        • InverterBeacon_v1.sol
        • InverterBeaconProxy_v1.sol
        • InverterProxyAdmin_v1.sol
        • InverterTransparentUpgradeableProxy_v1.sol
  • Apps
  • Support
Powered by GitBook
On this page
  • Setup Requirements
  • Simulating the Workflow
  1. SDK's
  2. React SDK

Simulate a Workflow

PreviousSubscribe to the IndexerNextPerform a Multicall

Last updated 3 days ago

Setup Requirements

  1. Set up Inverter Network SDK: Refer to the Guide for detailed instructions.

Simulating the Workflow

All we have to do is decide on the requestedModules and we can display or use the output of the simulation. This simulation lets us retrieve the preliminary addresses of a workflow before it is deployed.

'use client'

import { useGetSimulatedWorkflow } from '@inverter-network/react/client'
import type {
  MixedRequestedModules,
  GetDeployWorkflowArgs,
} from '@inverter-network/sdk'
import { useAccount } from 'wagmi'

import { Spinner } from '@/components/ui/spinner'

// Defined the modules to be deployed in typesafe manner
const requestedModules = {
  fundingManager: 'FM_DepositVault_v1',
  paymentProcessor: 'PP_Simple_v1',
  authorizer: 'AUT_Roles_v1',
  optionalModules: ['LM_PC_Bounties_v1'],
} as const satisfies MixedRequestedModules

export default function Page() {
  const { address } = useAccount()
  
  // Define the args for the modules in typesafe manner
  const args = {
    fundingManager: {
      orchestratorTokenAddress: '<your_funding_token_address>',
    },
    authorizer: {
      initialAdmin: address,
    },
  } as const satisfies GetDeployWorkflowArgs<typeof requestedModules>
  
  const { data, isPending } = useGetSimulatedWorkflow({ requestedModules, args })
  
  if (isPending) return (
    <div className="w-screen h-screen flex flex-col items-center justify-center">
      <Spinner />
    </div>
  )

  // Return a simple ui to display the results
  return (
    <div className="w-screen h-screen flex flex-col items-center justify-center gap-3">
      <h1>Orchestrator Address: {data?.orchestratorAddress}</h1>

      <h1>Authorizer Address: {data?.authorizerAddress}</h1>
      
      <h1>Funding Manager Address: {data?.fundingManagerAddress}</h1>
      
      <h1>Payment Processor Address: {data?.paymentProcessorAddress}</h1>
      
      <h1>Logic Module Addresses: {data?.logicModuleAddresses.join(', ')}</h1>
      
      <h1>Deployment Bytecode: {data?.bytecode.slice(0, 100)}...</h1>
      
      <h1>Trusted Forwared Address: {data?.trustedForwarderAddress}</h1>
      
      <h1>Factory Address: {data?.factoryAddress}</h1>
    </form>
  )
}

Quick Start

( 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