> For the complete documentation index, see [llms.txt](https://prediction-wtf.gitbook.io/prediction-wtf/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://prediction-wtf.gitbook.io/prediction-wtf/readme-1.md).

# Tech Specs

## Mainnet addresses

PGT: 0x817c201c4Bc769CCdE4f0a20BEA442b17913Ec83

Staking helper: 0x42d56F1147916067dfCff08FdBf83C2d8dEa0c8A

Staking (LP): 0xeE7CCd15c4ee726221BdF5279845372457a4A716

PGT-BNB LP: 0x3998B1Fe9F78EdD356DE28827733902E152031F7

Prediction game: 0x81EC13411D98CD674d75A691C273c43855C76A0D (bet BNB price)

Prediction game: 0xF76E10BBCa32D740367702665a6e8f770DD2F9b7 (bet BTC price)

Prediction game: 0x8dF2A4fDAeec8d74255A895546125d40e11D7eF4 (bet CAKE price)

Prediction game: 0x2dF7CfF13D74d1A596f37a6fba80982a01c81844 (bet ADA price)

PGT Escrow for prediction game: 0x7A5A951b686846B343FF89A66A4E388c4f585950

## Testnet addresses

PGT: 0x8e6176021aD9eea87C1eB9277270e7679062163B

Staking helper: 0xe061Fd0F826e261A8ede0a0f3cE413Af69f344ED

Staking (LP): 0x752Ad8c3316ed064B2a5313A03EeF79f69eAa535

PGT-BNB LP: 0x6E34041210F929E2cB0dDb9385eec73aEbCFD9aF

Prediction game: 0x6a5E9d59bC82dB38110e2eBaCF1F55C4FDD1BBfF (bet BNB price)

Prediction game: 0x39Ab86A95b9e50864700C9B7c96f2756DE22AA68 (bet BTC price)

Prediction game: 0xEfF936F12c1600B8Ce60F0e0575F520F82AEdce3 (bet CAKE price)

Prediction game: 0xa6174e047882A3c38Fd910dA64ed95D9Df9A98Ab (bet ADA price)

PGT Escrow for prediction game: 0x99AafEA8B38BC781684B5747a03BeEEc848bE960

## Integration

Refer `test/testWhole.js` for integration example.

### Get

Get amount in PGT (including multiplier)

API (temporarily): `https://siewchongche.space/predictionGame/getAmountInPGT/?amountInUSD=${amountInUSD}`

Get amount in BNB

API (temporarily): `https://siewchongche.space/predictionGame/getAmountInBNB/?amountInUSD=${amountInUSD}`

> Result might be different when actual claim

### Claim

```
await PGT.claim(userAddress, amountInBNB, amountInPGT, amountInPGTMin, signature, {value: amountInBNB})
```

Call API for parameters

API (temporarily): `https://siewchongche.space/predictionGame/getSignature/?account=${userAddress}&amountInUSD=${amountInUSD}`

Where

`userAddress` = address to claim, only whitelisted address able to claim

`amountInUSD` = amount in USD to claim, options include 50, 100 and 500.

Return `amountInBNB`, `amountInPGT`, `amountInPGTMin` and `signature`.

### Bet (from PGT escrow after claim)

```
await escrow.betBull(1, betAmount, 0, predictionGameAddr)
```

When call with escrow contract, contract will check first if `betAmount` < `escrowPGT`.

If `betAmount` > `escrowPGT`, contract will transfer remaining PGT from user, user need to approve PGT to escrow contract before transfer.

Check user escrow PGT

```
const escrowPGT = await escrow.escrowAmount(userAddress) // 18 decimals
```

### Staking (with BNB)

```
const amountOutMinForDeposit = stakingHelper.getAmountOutMinForDeposit(amountBNBToStake, 1000)
await stakingHelper.deposit(amountOutMinForDeposit, {value: amountBNBToStake})
```

### Claim stake rewards (in PGT)

```
await staking.claim()
```

Check current rewards which avalaible to claim

```
await staking.rewardsOf(userAddress) // In PGT, 18 decimals
```

### Unstake all

```
const amountOutMinForWithdraw = stakingHelper.getAmountOutMinForWithdraw(1000)
await stakingHelper.withdraw(amountOutMinForWithdraw)
```

## Deployment sequence

1. deployPGT.js
2. deployPredictionGame.js
3. deployEscrow\.js
4. deployStakingHelper.js
5. addLiquidity.js

## Repo

Smart contract: <https://github.com/daoventures/prediction-game-contracts>

API: <https://github.com/daoventures/prediction-game-api>

Bot: <https://github.com/daoventures/prediction-game-bot>
