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
- beaconAddress
- beaconChainId
- contractList
- drawBeaconContract
- drawBeaconMetadata
- drawBufferContract
- drawBufferMetadata
- prizeDistributors
- prizePools
- prizeTierHistoryContract
- prizeTierHistoryMetadata
- providers
Methods
- getBeaconChainDrawIds
- getBeaconChainDraws
- getDrawBeaconPeriod
- getPrizeDistributor
- getPrizePool
- getUpcomingPrizeTier
- getUsersPrizePoolBalances
- id
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
Name | Type | Description |
---|---|---|
providers | Providers | ethers Providers for each network in the Prize Pool Network, keyed by their chain id. |
prizePoolNetworkContractList | ContractList | a Contract List containing all of the relevant metadata for the Prize Pool Network. |
Defined in
Properties
beaconAddress
• Readonly
beaconAddress: string
Defined in
beaconChainId
• Readonly
beaconChainId: number
Defined in
contractList
• Readonly
contractList: ContractList
Defined in
drawBeaconContract
• Readonly
drawBeaconContract: Contract
Defined in
drawBeaconMetadata
• Readonly
drawBeaconMetadata: Contract
Defined in
drawBufferContract
• Readonly
drawBufferContract: Contract
Defined in
drawBufferMetadata
• Readonly
drawBufferMetadata: Contract
Defined in
prizeDistributors
• Readonly
prizeDistributors: PrizeDistributor
[]
Defined in
prizePools
• Readonly
prizePools: PrizePool
[]
Defined in
prizeTierHistoryContract
• Readonly
prizeTierHistoryContract: Contract
Defined in
prizeTierHistoryMetadata
• Readonly
prizeTierHistoryMetadata: Contract
Defined in
providers
• Readonly
providers: Providers
Defined in
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
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
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
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
Name | Type | Description |
---|---|---|
chainId | number | the chain id the requested prize distributor is on |
address | string | the address of the PrizeDistributor contract |
Returns
Defined in
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
Name | Type | Description |
---|---|---|
chainId | number | the chain id the requested prize pool is on |
address | string | the address of the YieldSourcePrizePool contract |
Returns
Defined in
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
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
Name | Type | Description |
---|---|---|
usersAddress | string | address 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
id
▸ id(): string
Returns a unique id string for this PrizePoolNetwork.
Returns
string
a unique id for the PrizePoolNetwork