run

run(marketConfig: IMarketDeployConfig)

This functions executes the set of actions generated by the getActions method. It involves deploying the market contract on the blockchain, registering the asset, and then registering the market in the backend system.

Parameters

marketConfig: IMarketDeployConfig: An object that contains the configuration for the market deployment, including wrapped assets, fraction assets, funding assets, admin address, capitalisation kind, time boundaries kind, and metadata.

  • chainId: The blockchain chain ID where the market is deployed.
  • sectorId: The sector ID associated with the market.
  • paymentAssetIds: An array of asset IDs that are used for payment in the market.
  • adminAddress: The admin address of the market.
  • metadata: Metadata information about the market (title, description, logo, email).

Returns

Promise<IMarketDeployOutput<Traits>> - A promise that resolves to the result of the actions execution, including transaction details, market details, and contract address.

Usage Example

// 2. Prepare the config object
const market: IMarketDeployConfig = {
  // Allowed assets to be wrapped
  // Each additional option increases the final gas usage for the deployment
  // You can select all of them, partially or just one
  wrappedAssets: [AssetTypeEnum.ERC20, AssetTypeEnum.ERC721, AssetTypeEnum.ERC3643, AssetTypeEnum.ERC1155],
  // Allowed assets to be used as fractions (fungible tokens)
  fractionAssets: [AssetTypeEnum.ERC20, AssetTypeEnum.ERC1155],
  // Allowed funding assets
  // So far we're supporting just ERC20
  fundingAssets: [AssetTypeEnum.ERC20],
  // Select who owns the market and is able to perform setting
  // changes and manipulate the diamond contract
  adminAddress: "Address",
  // One of:
  // - SOFTCAP_HARDCAP
  // - SOFTCAP_ONLY
  // - HARDCAP_ONLY
  capitalisationKind: CapitalisationKind.SOFTCAP_HARDCAP,
  // One of:
  // - START_DATE_ONLY
  // - START_AND_END_DATE
  timeBoundariesKind: TimeBoundariesKinds.START_DATE_ONLY,
  // Provide additional meta for your market
  metadata: {
    title: "Your title",
    logo: "https://", // or ipfs,
    description: "Your description",
    email: "Your email",
  },
};
const result = await actions.run(market);
console.log(result);