Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PoolFactory Abstract

Abstract class for pool factories.

The pool factory allows decentralization of pools creation and discoverability. Each pool type has a separate factory contract that deploys the pool. Every pool created by the pool factory can be trusted as a valid Pact pool.

The factory ensures pools uniqueness meaning you can't create two pools with the same parameters using a single factory contract.

Hierarchy

Index

Constructors

Properties

appId: number

Methods

  • Deploys a new pool to the network.

    Parameters

    • sender: string

      The address that is going to send the transactions.

    • poolBuildParams: PoolBuildParams
    • signer: Signer

      A callback that allows signing the transaction.

    Returns Promise<Pool>

    The created pool instance.

  • Deploys a new pool to the network if the pool with the specified params does not exist yet. Otherwise, it returns the existing pool.

    Parameters

    • sender: string

      The address that is going to send the transactions.

    • poolBuildParams: PoolBuildParams
    • signer: Signer

      A callback that allows signing the transaction.

    Returns Promise<[Pool, boolean]>

    The two items tuple. The first item is the created or existing pool. The second item is True if a new pool is created or False if an existing pool is returned.

  • Fetches the pool for the given params.

    Parameters

    • poolParams: PoolParams

      Parameters of the pool with are looking for.

    Returns Promise<null | Pool>

    A pool if pool with given parameters exists, None otherwise.

  • Lists all pools created by this factory. It works by reading the boxes created by this factory. The boxes serve as a hash map of unlimited size. The box name stores pool parameters and the box content stores pool id.

    This method returns only pool parameters without the application id. You have to call fetchPool to fetch the actual pool e.g.

    const poolParams = await factory.listPools() const pool = await factory.fetchPool(poolParams[0])

    Returns Promise<PoolParams[]>

    List of pool parameters.

Generated using TypeDoc