Schlagonia / fantasy-pot

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tokenized Fantasy Pot

This repo contains the code and instructions to use deploy your own Fantasy Pot to use for the 2023-2024 Fantasy Football season.

This pot is built as a Yearn V3 "Tokenized Strategy". For more information on the Tokenized Strategy please visit the TokenizedStrategy Repo.

Deployment

The Factory is deployed on Polygon at : https://polygonscan.com/address/0xb19f410b95e2d263289443ee3b61f2c1550412d8

You can deploy your own Pot either on PolygonScan or through a script by calling

factory.newFantasyPot(_asset, "Name for your pot", _buyIn)

// NOTE: You can also specify start and stop times for your pot.
factory.newFantasyPot(_asset, "Name for your pot", _buyIn, _startTimestamp, _stopTimestamp)

Where asset is the ERC20 token to use for the buy in that has a corresponding Aave market. and _buyIn is the amount denominated in asset that is required to buy in to the pot.

  • start: The timestamp when deposits are locked and you can no longer activate new players. Defaults to start of regular season. September 7th, 2023 8:20 EST.
  • end: The timestamp that all funds are locked until. After the end the management can declare a winner. Defaults to the end of the regular season. January 7th, 2024 Midnight EST.

Setup

Once deployed the address that deployed will need to call newPot.acceptManagement() to take over the management role.

The manager will then need to active each players address who will take part in the league pot.

fantasyPot.acitvatePlayer(addressOfPlayer)

Once activated the player will need to call the ERC-4626 compliant 'Deposit' with the specified buyIn as the amount.

NOTE: Deposits are shut off after the start timestamp and are not possible to turn back on!!!

Games

Once the season starts the funds are locked till the end. But will earn yield the whole period.

During the season players are able to challenge each other to games of Tic Tac Toe. The winner earns the losers reward minus a 10% cut to increase the overall final pot.

Game Functions

  • startNewTicTacToeGame: Starts a new game of Tic Tac Toe.
  • acceptNewTicTacToeGame: Accepts a previously started game.
  • makeMove: Makes a move in the game of Tic Tac Toe.
  • getGameId: Returns the game id based on the players and the buy-in.
  • getBoard: Returns the current board of the game.
  • getNextPlayer: Returns the address of the next player.

Or if the manager is no longer trusted players can Stage a Coup to take over the management position before the end of the season.

Declaring a Winner

At the end of the season once end has passed the Pots management can call:

fantasyPot.winnerWinnerChickenDinner( winnersAddress )

This will declare the address passes in as the winner, burning all other players shares as well as recording the full profit accrued since the start of the season.

The 'winner' will now be able to withdraw the full amount of the pot.

Contract Verification

Once the Fantasy Pot is fully deployed, you will need to verify the TokenizedStrategy functions. To do this, navigate to the /#code page on Etherscan.

  1. Click on the More Options drop-down menu
  2. Click "is this a proxy?"
  3. Click the "Verify" button
  4. Click "Save"

This should add all of the external TokenizedStrategy functions to the contract interface on Etherscan.

About


Languages

Language:Solidity 98.9%Language:Makefile 1.1%