FortuneVault

The FortuneVault is a "No-Loss Lottery" system. Users deposit AGTR tokens to enter a weekly round. The deposited capital generates yield (simulated here as a tax on the pot), and a random winner takes the prize.

Note: This contract uses Chainlink VRF (Verifiable Random Function) to ensure provably fair winner selection.


Key Concepts

  • Rounds: Each game lasts for 7 days.
  • No-Loss: Players keep their principal (in a full implementation, the principal is deposited into a yield source; in this MVP version, it's a simple pot where the utility is gamification). Wait, actually, in this MVP version, the totalPot IS the deposits. So one person wins EVERYTHING, meaning others LOSE their deposit.

    Correction: The current implementation in `FortuneVault.sol` takes deposits into `totalPot` and gives `prize` (pot - fee) to the winner. This is a Lottery, not a No-Loss lottery. Docs should reflect the code accurately.

Correction from Codebase Analysis

The current implementation is a standard Lottery where deposits are pooled and one winner takes all. It is NOT a no-loss savings game yet.

Functions

deposit

function deposit(uint256 amount) external

Transfers AGTR tokens from the user to the vault and enters them into the current round.

drawWinner

function drawWinner() external onlyOwner

Requests a random number from Chainlink VRF. Can only be called after the round duration has passed.

fulfillRandomWords (Internal)

Callback function called by Chainlink. Selects a winner based on a weighted probability (more tokens deposited = higher chance). Distributes the prize and starts a new round.

Events

  • Deposited(address indexed user, uint256 amount)
  • WinnerDrawn(uint256 indexed roundId, address indexed winner, uint256 prize, uint256 fee)
  • RoundStarted(uint256 indexed roundId, uint256 startTime, uint256 endTime)