Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

buyback-burner

A treasury-backed price floor with burn.

The operator funds a paymentToken reserve; holders can then always sell the projectToken to the contract at a fixed floor price, and every token bought is immediately forwarded to the burn address (0x…dEaD), removing it from circulation. This puts a hard, reserve-backed floor under the token — you can never get less than floorPrice for it while the reserve lasts — and every sale permanently shrinks the circulating supply.

Mechanics

  • constructor(projectToken, paymentToken, floorPrice, owner)floorPrice is paymentToken per 1e18 projectToken.
  • sell(amount) — sell project tokens at the floor: they are burned and you receive amount · floorPrice / 1e18 of paymentToken. Reverts if the reserve can't cover it.
  • fundReserve(amount) / withdrawReserve(amount) — operator tops up or reclaims the reserve.
  • Views: quote(amount), buyableAtFloor(), reserve(), totalBurned().

Safety

  • ReentrancyGuard + SafeERC20 + checks-effects-interactions; the project-token pull credits the actual amount received (fee-on-transfer safe).
  • Tokens are burned by forwarding to 0x…dEaD — portable across any ERC-20 (no burn() hook required) and provably out of circulation.
  • Fully tested: unit tests for floor payout, burning, reserve exhaustion, quote/buyable views, withdrawal, and every guard, plus two stateful invariants (fail_on_revert = true):
    • reserve conservation — the payment-token balance always equals the tracked reserve;
    • no project held / all burned — the contract never retains any project token, and the burn-address balance always equals lifetime totalBurned.

Test

forge test
FOUNDRY_INVARIANT_FAIL_ON_REVERT=true forge test --match-path "test/BuybackBurner.invariant.t.sol"

Deploy

PROJECT_TOKEN=0x... PAYMENT_TOKEN=0x... FLOOR_PRICE=2000000000000000000 \
  forge script script/Deploy.s.sol --rpc-url "$RPC_URL" --broadcast

Not audited. Reference implementation — review before any real deployment.

About

Treasury-backed price floor: operator funds a reserve, holders always sell the project token at a fixed floor price, and every token bought is burned (0xdEaD), shrinking supply. Reserve-conservation + all-burned invariants. Foundry, unit + invariant tested.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages