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
    • React SDK
      • Deploy a Workflow
      • Operate a Workflow
      • Deploy a Contract
      • Query the Indexer
      • Subscribe to the Indexer
    • Graphql SDK
    • Workflow Guides
      • Grant/Revoke Roles
      • Bounty Manager
      • Bonding Curve
      • Deposit Vault
    • API
      • Inverter
      • getDeployWorkflowOptions
      • deployWorkflow
      • getModule
      • getWorkflow
      • deploy
  • 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
  1. SDK's
  2. API

deployWorkflow

The deployWorkflow method is used to deploy a fresh workflow.

Parameters:

{
    // the public client / provider to make RPC calls
    publicClient: PublicClient,
    // the wallet client to sign and submit transactions
    walletClient: WalletClient,
    requestedModules: {
        // name of the Funding Manager module used
        fundingManager: ModuleData | RequestedModule<'fundingManager'>
        // name of the Authorizer module used
        authorizer: ModuleData | RequestedModule<'authorizer'>
        // name of the Payment Processor module used
        paymentProcessor: ModuleData | RequestedModule<'paymentProcessor'>
        // names of the optional modules used
        optionalModules: (ModuleData | RequestedModule<'optionalModule'>)[]
    },
}

Returns: an object with the following properties

{
    // returns a schema of the inputs required for deploying, e.g. can be used to render input fields
    inputs: GetDeployWorkflowInputs
    
    // a function that takes in deployment parameters, submits a deployment
    run(args: GeDeployWorkflowArgs<RequestedModules>, options?: MethodOptions): Promise<{
        orchestratorAddress: `0x${string}`;
        transactionHash: `0x${string}`;
    }>
    
    // a function that takes in deployment parameters, simulates a deployment transaction and returns the orchestratorAddress
    simulate(args: GeDeployWorkflowArgs<RequestedModules>): Promise<{
        result: `0x${string}`;
        request: SimulateContractReturnType['request'];
    }>
    
    // a function that takes in deployment parameters, estimates the deployment gas and return value and formatted value
    estimateGas(args: GeDeployWorkflowArgs<RequestedModules>): Promise<{
        value: string;
        formatted: string;
    }>
}

Example:

import { deployWorkflow, type MixedRequestedModules, type FactoryType } from '@inverter-network/sdk'

// Define the configuration for the workflow modules that need to be deployed
const requestedModules = {
    fundingManager: 'FM_DepositVault_v1',      // Funding manager module
    paymentProcessor: 'PP_Simple_v1',          // Payment processor module
    authorizer: 'AUT_Roles_v1',                // Authorizer module
    optionalModules: [                         // List of optional logic modules
        'LM_PC_RecurringPayments_v1'
    ]
} as const satisfies MixedRequestedModules

// Retrieve the deployment functions by calling `getDeploy`
const { inputs, estimateGas, run, simulate } = deployWorkflow({
    publicClient,      // Public client interface for network interactions
    walletClient,      // Wallet client for managing blockchain transactions
    requestedModules,  // Modules to be deployed
})

// Args based on the requested modules
// Should either be `as const` or be passed dirrectly in the `estimateGas`, `run` or `simulate` function args
const args = {
    orchestrator: {
        independentUpdates: true,
        independentUpdatesAdmin: '0x5eb14c2e7D0cD925327d74ae4ce3fC692ff8ABEF',
    },
    fundingManager: {
        orchestratorTokenAddress: '0x5eb14c2e7D0cD925327d74ae4ce3fC692ff8ABEF',
    },
    authorizer: {
       initialAdmin: "0x5eb14c2e7D0cD925327d74ae4ce3fC692ff8ABEF",
    },
    optionalModules: {
        LM_PC_RecurringPayments_v1: {
            epochLength: '604800',
        },
    },
} as const satisfies GeDeployWorkflowArgs<typeof requestedModules>

// returns the gas in formatted and raw
const { value, formatted } = await estimateGas(args)

// returns the orchestrator address of the simulated deployment
const { result, request } = await simulate(args)

// returns the orchestrator address as well as the transaction hash
const { orchestratorAddress, transactionHash } await run(args, {
    confirmations: 1,
    onHash: (hash) => {console.log(hash)},
    onConfirmation: (receipt) => {console.log(receipt)},
    onApprove: (receipts) => {console.log(receipts)}
})
PreviousgetDeployWorkflowOptionsNextgetModule

Last updated 4 days ago