Skip to main content

PrizePoolNetwork

A Prize Pool Network. The network consists of one or more Prize Pools and Prize Distributors. PrizePoolNetwork provides read only functions for reading data from the contracts that make up the network. Initializes several PrizePools and PrizeDistributors on creation.

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new PrizePoolNetwork(providers, prizePoolNetworkContractList)

Create an instance of a PrizePoolNetwork by providing ethers Providers for each relevant network and a Contract List.

Parameters

NameTypeDescription
providersProvidersethers Providers for each network in the Prize Pool Network, keyed by their chain id.
prizePoolNetworkContractListContractLista Contract List containing all of the relevant metadata for the Prize Pool Network.

Defined in

src/PrizePoolNetwork.ts:41

Properties

beaconAddress

Readonly beaconAddress: string

Defined in

src/PrizePoolNetwork.ts:23


beaconChainId

Readonly beaconChainId: number

Defined in

src/PrizePoolNetwork.ts:22


contractList

Readonly contractList: ContractList

Defined in

src/PrizePoolNetwork.ts:19


drawBeaconContract

Readonly drawBeaconContract: Contract

Defined in

src/PrizePoolNetwork.ts:31


drawBeaconMetadata

Readonly drawBeaconMetadata: Contract

Defined in

src/PrizePoolNetwork.ts:26


drawBufferContract

Readonly drawBufferContract: Contract

Defined in

src/PrizePoolNetwork.ts:32


drawBufferMetadata

Readonly drawBufferMetadata: Contract

Defined in

src/PrizePoolNetwork.ts:27


prizeDistributors

Readonly prizeDistributors: PrizeDistributor[]

Defined in

src/PrizePoolNetwork.ts:18


prizePools

Readonly prizePools: PrizePool[]

Defined in

src/PrizePoolNetwork.ts:17


prizeTierHistoryContract

Readonly prizeTierHistoryContract: Contract

Defined in

src/PrizePoolNetwork.ts:33


prizeTierHistoryMetadata

Readonly prizeTierHistoryMetadata: Contract

Defined in

src/PrizePoolNetwork.ts:28


providers

Readonly providers: Providers

Defined in

src/PrizePoolNetwork.ts:16

Methods

getBeaconChainDrawIds

getBeaconChainDrawIds(): Promise<number[]>

Fetch the range of available draw ids in the Draw Buffer for the beacon Prize Pool.

Returns

Promise<number[]>

an array of draw ids

Defined in

src/PrizePoolNetwork.ts:143


getBeaconChainDraws

getBeaconChainDraws(): Promise<{ [drawId: number]: Draw; }>

Fetch all of the available Draws in the Draw Buffer for the beacon Prize Pool.

Returns

Promise<{ [drawId: number]: Draw; }>

an object of draws keyed by their draw id

Defined in

src/PrizePoolNetwork.ts:168


getDrawBeaconPeriod

getDrawBeaconPeriod(): Promise<{ drawId: number ; endsAtSeconds: BigNumber ; periodSeconds: number ; startedAtSeconds: BigNumber }>

Fetch the current Draw Beacon period data from the beacon Prize Pool.

Returns

Promise<{ drawId: number ; endsAtSeconds: BigNumber ; periodSeconds: number ; startedAtSeconds: BigNumber }>

the current draw beacon period.

Defined in

src/PrizePoolNetwork.ts:121


getPrizeDistributor

getPrizeDistributor(chainId, address): PrizeDistributor

Returns a PrizeDistributor from the list of Prize Distributors that was created on initialization by their primary key. The primary key of a Prize Disctributor is the chain id it is on and the address of the PrizeDistributor contract.

Parameters

NameTypeDescription
chainIdnumberthe chain id the requested prize distributor is on
addressstringthe address of the PrizeDistributor contract

Returns

PrizeDistributor

Defined in

src/PrizePoolNetwork.ts:218


getPrizePool

getPrizePool(chainId, address): PrizePool

Returns a PrizePool from the list of Prize Pools that was created on initialization by their primary key. The primary key of a Prize Pool is the chain id it is on and the address of the YieldSourcePrizePool contract.

Parameters

NameTypeDescription
chainIdnumberthe chain id the requested prize pool is on
addressstringthe address of the YieldSourcePrizePool contract

Returns

PrizePool

Defined in

src/PrizePoolNetwork.ts:206


getUpcomingPrizeTier

getUpcomingPrizeTier(): Promise<PrizeTier>

Fetches the upcoming prize tier data from the prize tier history contract. This data is used for the next prize distribution that will be added to the Prize Distribution Buffer for the beacon Prize Pool.

Returns

Promise<PrizeTier>

the upcoming prize tier

Defined in

src/PrizePoolNetwork.ts:188


getUsersPrizePoolBalances

getUsersPrizePoolBalances(usersAddress): Promise<{ address: string = prizePool.address; balances: PrizePoolTokenBalances ; chainId: number = prizePool.chainId }[]>

Fetch the users balances for all relevant tokens for all Prize Pools in the Prize Pool Network.

Parameters

NameTypeDescription
usersAddressstringaddress to get balances for.

Returns

Promise<{ address: string = prizePool.address; balances: PrizePoolTokenBalances ; chainId: number = prizePool.chainId }[]>

an array of objects containing the chain id & Prize Pool address and a balances object with the users balances for relevant tokens to the prize pool

Defined in

src/PrizePoolNetwork.ts:105


id

id(): string

Returns a unique id string for this PrizePoolNetwork.

Returns

string

a unique id for the PrizePoolNetwork

Defined in

src/PrizePoolNetwork.ts:94