---
# System prepended metadata

title: PoolTogether Docs Notes

---

# PoolTogether Docs Notes

## Guiding Star

Fork PoolTogether to allow users to deposit **unstable** cryptocurrencies in exchange for yield rewards as normal on PoolTogether. 

## Midan Background

* Side-path
* Hopped directly into solidity first instead of a more general tech background
* Here to pick shit up

### Achievements

* Courses
    * Started in January
    * Test deploys in March
    * Went back to trading
    * Intro to Web3
    * Ethereum and Solidity: The Complete Developer's Guide
* Deploys on testnet


## Black Box Modelling PoolTogether

### Inputs

USDC is deposited

### Outputs

Daily Winning Odds
Daily Network Winning Odds
USDC is returned to user


## Inner Workings

### Yield

When users deposit USDC, it is deployed to produce yield.

Where?
How?

USDC is taken in exchange for PT "Ticket" Tokens 1:1 by a PrizePool contract instance. The USDC is then deposited directly to a yield source contract (Aave, Yearn, etc).

When Yield is generated, it is distributed to stakers.

Where?
How?

How does the protocol stay profitable during high network usage/fees? paying out yield

IN prizepool.sol

Deposit is not hardcoded to be USDC 

Controlledtoken-ticket

## Call Notes 9/9/2022

Per docs
Starts at             PrizesplitStrategy->Prizepool->Ticket->Award

--
Prizesplitstrategy
--
     grabs token, spits out ticket/controlledtoken

Balance is the total 
`Turnary operator-javascript` 
`longvars keep them readable, but shortcuts will be needed to be used`

 CurrentawardBalance is a tracker for how much interest the contract has accrued, it doesn't get it, it just determines the amount

Splitamount will always return the correct proportion

PrizeTemp will result in dust
On line 145 is determined how much is going out with the remainder going to prizetemp, due to rounding in 

balance checks if currentbalance is greater than tickettotalsupply



prizepool is an interface not a struct

within prizepool it calls prizepool.award via function_awardTickets



Calling the withdraw function on tickets burns them for their USDC

Claim->Pulls Tickets Prizedistributor.sol

Withdraw->Burns and exchanges for USDC

--
Distribute in PrizesplitStrategy
--
reads total interest and calls awardplizesplitamuont and transfers tickets 

## Design Decisions

1) Depositing ETH
    - We can, before depositing tokens and minting tickets, swap the deposited eth for a stable at spot price and change very little underlying logic
    - or, we can, before minting tickets, modulate the amount of tickets returned (ie user deposits 1 eth for 10/100/1000 tickets, user deposits 0.1 eth for 1/10/100 tickets etc)

--
Call Notes 9/10/2022
--

v4 beacon
    no need to change anything 

requires we hold LINK for VRF - random number generator

design an algo

where person is doing WBTC
    if user deposits WBTC at 23000
    and price of WBTC drops to 19000, how to calculate prize distribution

-1 ticket value is recalculated before every draw based on token deposited



    