# The Buyback Bot

> **Code clarification:** this page retains the specification's rules. Current code ends the window at Day 1 + 7 days, or Day 8 by default, and can skip a slice rejected before signing. See [Implementation status](etat-implementation.md) for differences from the schedule and retries described below.

The Buyback Bot is a deterministic script without AI. It has two jobs: buying back the CTO token over 7 days, and buying back $VIVRA using CTO token fees. Each purchase and burn happen in the same transaction through a small execution contract.

## BuybackBurner contract

Solidity interface, skeleton, and expected tests: [Appendix D · Contracts](annexe-contrats.md).

A minimal, immutable contract deployed on Robinhood Chain:

- `buyAndBurn(token, route, amountIn, minOut)`: buys `token` using `amountIn` (ETH or USDG) through the Pons curve or v4 pool, then sends everything received to burn address `0x…dEaD` in the same transaction. Tokens never remain in a Vivra wallet.
- Only the Buyback Bot hot wallet can call it.
- Per-call and daily caps are fixed in the contract.
- A `BuybackBurn(token, amountIn, amountBurned, slice)` event is read by token tracking and displayed in the dapp.

## Buyback parameters

| Parameter | V1 value | Note |
| --- | --- | --- |
| Duration | 7 days, Day 1 to Day 7 in the specification | see code clarification above |
| Number of slices | about 23 | configurable |
| Timing | random, unannounced | selected when buyback starts, secret until execution |
| Slice size | at most 1% of pool liquidity at purchase time | recalculated for every slice |
| Maximum slippage | 2% | otherwise the specification postpones the slice |
| Cap per CTO token | its market cap at voting time | open decision, section 13 |
| Envelope | Buyback share of fees claimed since the previous cycle, plus unspent balances, capped at the token limit; cycle 1 starts with a small envelope | remaining funds move to the next CTO token |
| Early stop | Day 3 if average volume has not at least doubled compared with the 7 days before voting | remaining funds move to the next CTO token |
| Token still on the curve | buy on the curve until graduation, then stop | |

## Buying back $VIVRA with CTO token fees

Each week, creator fees received from CTO tokens (section 8) buy back $VIVRA using the same rules: randomly timed slices over 7 days, no more than 1% of liquidity per slice, and burn in the same transaction.

## Fund safety

- The Buyback Bot hot wallet never holds more than 24 h of slices. It is automatically refilled daily from the Buyback Reserve wallet within the daily cap.
- Slice times are stored encrypted on the server and published only after execution.
- Any error (slippage, revert, insufficient liquidity) suspends the slice and alerts the team. No automatic retry with a larger purchase.
- A back-office emergency stop blocks all new slices.

## Acceptance criteria

- [ ] On testnet, 23 slices execute over 7 days, none above 1% of liquidity, with every purchase burned in the same transaction.
- [ ] The Day 3 stop triggers in a test scenario where volume does not double.
- [ ] BuybackBurner rejects calls from any wallet other than the Buyback Bot and calls above the cap.
