A blockchain-based game where players compete to be the last one to feed the cat and win the prize pool.
- 13 different items can be fed to the cat (priced $1-$13 in USDC)
- When you feed the cat, a 24-hour timer starts
- If the timer reaches 0, you win the entire prize pool
- Other players can feed the cat to reset the timer and become the new potential winner
- If the same player feeds multiple items, the timer is reduced (max 23 hours reduction)
- EIP-1967 upgradeable smart contract
- ERC-1155 NFT items that are minted and burned when fed
- Configurable admin fee percentage
- Pausable for emergency situations
- Automatic round management
- Install dependencies:
npm install
- Copy
.env.example
to.env
and fill in your values:
cp .env.example .env
- Compile contracts:
npm run compile
# Start local node
npm run chain
# Deploy in another terminal
npm run deploy:local
npm run deploy:baseSepolia
npm run verify:baseSepolia
npm run deploy:base
npm run verify:base
Run the test suite:
npm test
Generate coverage reports:
# Full coverage report
npm run coverage
# V1 contract only
npm run coverage:v1
# V2 contract only
npm run coverage:v2
Coverage reports are generated in multiple formats:
- HTML: Open
coverage/index.html
in your browser - LCOV: For CI/CD integration (
coverage/lcov.info
) - JSON: Machine-readable format (
coverage.json
)
Current coverage:
- Statements: 96.81%
- Branches: 69.57%
- Functions: 100%
- Lines: 96.06%
The contract supports safe upgrades using OpenZeppelin's UUPS pattern.
- Emergency Pause: Additional pause mechanism independent of regular pause/unpause
- Enhanced Safety: Owner can immediately halt all game operations if needed
- State Preservation: Emergency pause doesn't affect ongoing rounds, just blocks new actions
- Prepare the upgrade (validates compatibility):
# Check upgrade compatibility
npm run prepare-upgrade:baseSepolia 2
- Perform the upgrade:
# Upgrade to V2
npm run upgrade:baseSepolia 2
- Verify the upgrade:
npm run verify:baseSepolia
To add new versions, follow the pattern in scripts/upgrade.ts
and create new contracts like StopFeedingTheCatV3.sol
. The upgrade system is designed to handle multiple versions automatically.
After deployment, build the package:
npm run build
Then in another project:
import { StopFeedingTheCat } from '@trifle/stop-feeding-the-cat';
const contractAddress = StopFeedingTheCat.networks[chainId].address;
const abi = StopFeedingTheCat.abi;
- Base Sepolia: Chain ID 84532
- Base Mainnet: Chain ID 8453
- Base Sepolia:
0x036CbD53842c5426634e7929541eC2318f3dCF7e
- Base Mainnet:
0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913