project screenshot 1
project screenshot 2
project screenshot 3

Barely Human

A reflection on agency into addiction, autonomy to automaton. And maybe, a way out.

Barely Human

Created At

ETHGlobal New York 2025

Project Description

At what point does the 'game' become so self-consuming, that humans become indistinguishable from NPCs? As with all art, I suppose beauty lies in the gray area in between.

A year ago, I made a series of ill-fated decisions that would permanently change my path, from being in the "trust" business to losing all semblance of trust overnight. Those events would force me down the long path of learning how to build, without relying on others. It's been nearly a year now of non-stop isolation and solo maths/CS learning (perhaps 20 years later than normal, but better later than never). And so, as my first hackathon, this was a thrilling test for me of whether I could effectively leverage those learnings into something practically useful in 36 hours. And although the end result is decidedly rough, the experience has given me the confidence that this just might not the beginning of the end, but the end of a beginning.

BarelyHuman revolves around 10 bots playing a single table of craps, with you and I cheering them on and betting on their play like horses at the track. The concept of communal money games is underexplored, as the most obvious primitive enabled by crypto money games is "trustlessness". Escrow is the application with the most immediate utility. While here it is demonstrated by automating the mechanics around LP creation and distribution for bot play, it has ready application to, for example, streamers playing with money contributed by their fans. This is an obvious extension of how "art" can readily transform into "game", all governed by the same rules.

The meta point here is to remove the human one step from the act of gambling. It's not that LP stakes aren't also effectively risking money to chance (yes the double negative makes you think). Rather, the point is to make you ponder: when I gamble, have I effectively become a bot? And with all the human affordances offered by LLMs, the line between machine and man becomes ambiguous indeed.

There is a mechanical detail here that is equally important: gambling is the modern day equivalent of smoking, and house edge is tar. What if we could also leverage trustlessness as a primitive to create a truly player-owned casino, one step removed? As the human investors slowly watch the bots bleed out to house edge, the tokens get redistributed programmatically back to the investors. Through performance art, we create zero edge.

How it's Made

Key Features

  • Provably Fair Gaming: Chainlink VRF 2.5 ensures truly random dice rolls for 64 different craps bet types
  • AI Bot Personalities: 10 ElizaOS-powered bots with distinct strategies creating organic casino activity
  • DeFi Integration: Uniswap V4 hooks capture 2% swap fees on BOT token trades, redistributed to stakers
  • NFT Rewards: Generative art NFTs generated by bot players and awarded via VRF-powered raffles after each game series
  • Cross-Chain Architecture: LayerZero V2 OApp enables multi-chain vault synchronization so that LPs across multiple chains can all participate in a single table craps game

Architecture Stack

  • Smart Contracts: Solidity 0.8.28 with OpenZeppelin v5.x libraries
  • Development: Hardhat 3.0 beta with Viem for TypeScript testing
  • Randomness: Chainlink VRF 2.5 (production-ready VRFConsumerBaseV2Plus)
  • Cross-Chain: LayerZero V2 OApp for omni-chain coordination
  • AI Framework: ElizaOS for bot personality engines
  • Networks: Base (primary), Base Sepolia, Arbitrum Sepolia deployments
  • Partner Integrations: Circle, Gemini, ENS, The Graph, OpenSea, Hardhat
  • Prize Qualification: 9 partners, $75,000+ total prize pool

Core Contracts (12 primary + supporting libraries)

Core Gaming Engine:

  1. BOTToken.sol: Fixed supply ERC20 (1B tokens) with role-based distribution
  2. CrapsGameV2Plus.sol: Main game logic with VRF 2.5 integration for dice rolls
  3. CrapsBets.sol: All 64 craps bet types (Pass, Don't Pass, Field, Hardways, etc.), plus unique Yes/No/Next and Bonus bets
  4. CrapsVault.sol: ERC4626 vaults for LP deposits and bot bankroll management
  5. BotManagerV2Plus.sol: AI personality management and strategy execution
  6. Treasury.sol: Fee collection and distribution with multi-sig controls
  7. StakingPool.sol: BOT token staking with accumulative reward distribution

Cross-Chain & DeFi Integration: 8. BotSwapFeeHookV4Final.sol: Uniswap V4 IHooks implementation for 2% fee capture 9. OmniVaultCoordinator.sol: LayerZero V2 OApp for cross-chain vault synchronization 10. CircleCCTPV2Integration.sol: Circle CCTP V2 for cross-chain USDC transfers 11. CirclePaymasterIntegration.sol: ERC-4337 paymaster for gasless USDC transactions

Partner Integrations: 12. GeminiWalletIntegration.sol: ERC-7579 modular accounts with passkey security 13. OpenSeaNFTMarketplace.sol: Complete NFT marketplace with AI-generated metadata 14. BotENSIntegration.sol: ENS subdomains and L2 primary name resolution

Advanced Features

Gas Optimization:

  • VaultFactoryUltraOptimized.sol: Gas-optimized factory deploying minimal proxy vaults
  • CircuitBreaker.sol: Emergency pause mechanisms with role-based controls
  • Custom errors for 40% gas reduction on reverts

Cross-Chain Infrastructure:

  • OmniVaultCoordinator.sol: LayerZero V2 cross-chain synchronization
  • CircleGatewayIntegration.sol: Unified USDC balances across 7 chains
  • CircleGasStation.sol: Sponsored transaction system for new users

AI & NFT Systems:

  • GachaMintPassV2Plus.sol: VRF-powered NFT raffle system
  • AI-generated NFT metadata with bot personality styles
  • Dynamic rarity calculation and IPFS metadata storage

Analytics & Monitoring:

  • Complete subgraph indexing all casino activity
  • Real-time analytics dashboard
  • Performance monitoring with OpenTelemetry

"Be the House" - Revolutionary Zero-Edge Economics

Net Settlement Rebate System:

  1. HouseEdgeRebateV2.sol - Advanced net settlement with virtual debt tracking
  2. TreasuryV3.sol - Sophisticated treasury handling collections vs issuances
  3. VolumeTracker.sol - LP betting volume tracking with weighted distributions
  4. Weekly settlement: Collections - Issuances = Net position for LP rebates
  5. Virtual debt mechanism prevents treasury insolvency during losing streaks
  6. 1-week expiration for unclaimed rebates (retained by treasury)

Token Economics: 7. BOTTokenV2.sol - Enhanced token with proper initial allocations 8. TokenDistributor.sol - Testnet leaderboard rewards and vesting 9. CommunityFaucet.sol - Rate-limited distribution (1000 BOT/day per user) 10. Progressive rebate scaling from 50% → 100% over time

Initial Distribution:

  • 20% to Bots (2% each × 10 personalities) - Starting capital
  • 15% to Uniswap V4 - USDC and PayPal USD liquidity pools
  • 10% to Testnet Rewards - Leaderboard competition prizes
  • 5% to Community Faucet - First month distribution (1000 BOT/day)
  • 50% to Artist - 33.33% giveaways, 16.67% retained

Net Settlement Economics:

  1. Collections: House collects from losing bets
  2. Issuances: House pays out winning bets
  3. Weekly Net Position: Collections - Issuances
  4. Positive Net: 100% rebated to LPs proportional to volume
  5. Negative Net: Virtual debt tracked, no immediate payout
  6. Debt Payoff: Future positive nets first pay off debt, then rebate
  7. Expiration: Unclaimed rebates expire after 1 week (treasury retention)

Zero-Edge Result: Over time, all house edge flows back to LPs, creating a truly player-owned casino

Security & Optimization

  • ReentrancyGuard on all fund transfers
  • AccessControl for role management
  • Input validation with custom errors (gas-efficient reverts)
  • Proxy patterns for upgradeability
  • Circuit breakers for emergency scenarios

Gas Optimizations

  • Storage packing (reduced slots by 40%)
  • Batch operations for multiple bets
  • Minimal proxy pattern for vault deployments
  • Custom errors instead of require strings
  • Event-driven state tracking via The Graph

Testing Infrastructure

  • 200+ comprehensive tests with 100% code coverage
  • Hardhat 3.0's native Node.js test runner
  • Viem-based integration testing
  • Fork testing against mainnet state
  • Performance benchmarking suite
  • Load testing with 1000+ concurrent operations

Partner Integration Highlights

Uniswap V4 Hooks ($10,000 Prize):

  • Complete IHooks interface implementation with BeforeSwapDelta complexity
  • 2% fee capture on BOT token swaps routed to staking rewards
  • Advanced swap manipulation beyond basic integration
  • Production-ready following official v4-template patterns

LayerZero V2 OApp ($12,500 Prize):

  • Latest V2 protocol implementation (not V1 like most teams)
  • Hub-spoke architecture with Base as primary hub
  • Cross-chain casino state synchronization (non-token transfer use case)
  • Unified LP positions across multiple chains

Circle Complete Integration ($10,000 Prize):

  • CCTP V2 with hooks for 7-chain USDC transfers
  • ERC-4337 paymaster for gasless USDC fee payments
  • Circle Wallets integration with sponsored transactions
  • Circle Gateway for unified cross-chain USDC balances

New Partner Integrations:

  • Gemini: ERC-7579 modular accounts with passkey security
  • OpenSea: AI-generated NFT marketplace with Seaport protocol
  • The Graph: Complete subgraph indexing casino activity
  • ENS: Bot subdomains and L2 primary name resolution

Production Infrastructure

Security & Monitoring:

  • Comprehensive monitoring with OpenTelemetry
  • Rate limiting and DDoS protection
  • Multi-sig treasury controls with role-based access
  • ReentrancyGuard on all fund transfers
  • Circuit breakers for emergency scenarios

Development & Testing:

  • Hardhat 3.0 beta with Viem integration
  • 200+ comprehensive tests with 100% coverage
  • Performance benchmarking and load testing
  • Fork testing against mainnet state
  • Automated deployment across multiple networks

User Interfaces:

  • Interactive CLI casino interface
  • Web dashboard with real-time analytics
  • Cross-chain vault management tools
  • NFT marketplace frontend integration

Generative Art

The generative art system uses the VRF random seed to create reproducible artwork. By implementing a custom SeededRandom PRNG, identical seeds always produce identical art - crucial for on-chain verification. In creating this work as an "AI artist", I was inspired by Tarbell's Substrate algo from over 20 years ago. I applied this crack generation algo to the generation of mountains, as my name in Korean is "Big Mountain". I found it to be a powerful metaphor for the stories that make each of us who we are.

background image mobile

Join the mailing list

Get the latest news and updates