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

getModule

The getModule method is the most basic way to get the interact-able contract instance for a given module.

Parameters: an object with the following properties

{
  // the name of the module smart contract
  name: ModuleName
} | {
  // manually passed module data
  moduleData: ModuleData
} & {
    // the address of the deployed module
    address: `0x${string}`
    // the public client or provider to make RPC calls
    publicClient: PublicClient
    // the wallet client to sign and submit transactions
    walletClient: WalletClient
    tagConfig?: {
      // the wallet address of the user
      walletAddress?: `0x${string}`
      // the number of decimals of the funding token of the funding manager
      decimals?: number
      // the default token to use
      defaultToken?: `0x${string}`
      // the number of decimals of the issuance token
      issuanceTokenDecimals?: number
      // the issuance token to use
      issuanceToken?: `0x${string}`
    }
}

Returns: a Module object with the following properties

{
    // the name of the module smart contract
    name: ModuleName
    // the address of the deployed module
    address: `0x${string}`
    // the type of the module (e.g. authorizer)
    moduleType: ModuleType
    // short description of the module taken from the contract NatSpec documentation
    description: string
    write: {
        [functionName: string]: {
            // name of the function
            name: string
            // description of what the function does taken from NatSpec
            description: string
            inputs: ExtendedAbiParameter[]
            outputs: ExtendedAbiParameter[]
            // an asynchronous function that whose parameters are of type Primitive<`inputs`> and return values are of type Primitive<`outputs`>
            run: (args: GetMethodArgs, options?: MethodOptions) => Promise<GetMethodResponse>
        }
    }
    estimateGas: // same as write ...
    simulate: // same as write ...
    read: // same as write ...
}

Example:

import { getModule } from '@inverter-network/sdk'

const { 
    name,
    address,
    moduleType,
    description,
    estimateGas,
    read,
    simulate,
    write
} = getModule({
        name: 'LM_PC_Bounties_v1',
        address: '0xa23D85d8FE256a8a1eE92a6d5Ec156a8a21DCdaE',
        publicClient,
        walletClient,
        tagConfig: {
            decimals: 18,
        },
    })
    
const addBountyArgs = [
     '100',
     '1000',
     ['this is an inverter project'],
] as const
    
// estimateGas function estimates the gas and returns raw and formatted
const { value, formatted } = await estimateGas.addBounty.run(addBountyArgs)
    
// simulate function simulates the function and returns the outputs
const outputs = await simulate.addBounty.run(addBountyArgs)

// write function changes the state of the smart contract
const txHash = await write.addBounty.run(addBountyArgs, {
    confirmations: 1,
    onHash: (hash) => {console.log(hash)},
    onConfirmation: (receipt) => {console.log(receipt)},
})

// read function gets some value(s) from the smart contract
const bountyIds = await read.listBountyIds.run()
PreviousdeployWorkflowNextgetWorkflow

Last updated 4 days ago