February 27, 2026

TypescriptReactSolidity

G5: Give honor to a 10-year-old Solidity contract

An old client once sent me this link: https://bitcointalk.org/index.php?topic=2118576.0

It was a Bitcointalk member sharing their latest creation: G5, a Solidity smart contract implementing a token with two prices defined by the contract: floor price and ceiling price. You buy at ceiling and sell at floor. Floor price rises as people deposit, and ceiling price is always 5% higher than floor. You can only lose 5% of your investment, but you can gain much more if you are early.

I decided to bring this contract up to date: rewrite it in modern Solidity, use OpenZeppelin libraries, and build a frontend to interact with it.

G50 was born.

Why I built this

I wanted to touch Solidity for real. Until then, I was mostly reading contracts and building frontends around them. This was a good excuse to take an old idea, rewrite the contract properly, and build the product around it.

I built it in 2 evenings.

What the app does

The app has 3 main parts:

Contract stats

Basic stats like ETH in the contract, floor and ceiling price, price history, and a bonding curve simulator.

Trading panel

A simple interface to buy and sell tokens, with your position details when connected.

Analytics

List of holders, holder distribution, ETH balance time series for the contract, etc.

Frontend & UI

Frontend stack: Next.js, React, TypeScript, wagmi, viem, RainbowKit, Recharts, TanStack Table.

On the frontend side, the goal was to make contract data readable and understandable. The contract mechanics are unusual, so the interface had to explain the floor price, ceiling price, and the spread without making it feel academic.

The UI is built around three things:

  • a quick read of the current state of the contract
  • a trading panel that makes buy and sell actions obvious
  • analytics that help understand holder distribution and contract growth over time

The app is not deployed.

What changed in the new contract?

  • rely on OpenZeppelin libs. Less code, more security. Solidity 0.8 has built-in overflow protection, so there is no need for SafeMath.
  • observability: G5 emits Mint, Burn, and Transfer events but says nothing when the floor and ceiling refresh, arguably the most interesting state change in the whole contract. G50 emits PriceUpdate(newFloor, newCeiling, blockNumber) on every refresh and exposes buyPrice() and sellPrice() views, so frontends and analytics do not have to scrape storage.
  • price per ETH: G5 starts at 1 ether / 10000 / 1e8, about 10,000 tokens per ETH. G50 starts at 1 ether / 1e8, or 1 token per ETH. More intuitive.