Skip to content

A gamified DeFi yield protocol on Ethereum Sepolia. Stake elemental NFTs to earn automated Uniswap V3 USDC rewards, powered by an algorithmic rebalancing engine.

Notifications You must be signed in to change notification settings

Tmalone1250/alchemy-guild

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

38 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Alchemy Guild Logo

โš—๏ธ Alchemy Guild

NFT Staking Meets Yield Alchemy

Ethereum Status License

Live Demo | Documentation | Report Bug


๐Ÿ“– Overview

Alchemy Guild is a DeFi yield generation platform that combines NFT staking with automated Uniswap V3 liquidity provision. Mint elemental NFTs, stake them in the Yield Vault, and earn USDC from trading fees.

๐ŸŽฏ Key Features

  • ๐Ÿ”ฎ Elemental NFTs: Three rarity tiers (Fire, Water, Earth) with different staking weights
  • ๐Ÿ’ฐ Automated Yield: Earn USDC from Uniswap V3 trading fees
  • โšก Instant Claims: 20% USDC reserve ensures immediate reward payouts
  • ๐ŸŽจ Beautiful UI: Alchemical-themed interface with stunning animations
  • ๐Ÿค– 24/7 Bot: Autonomous bot generates volume and manages liquidity

๐Ÿ“Š Current Stats

Metric Value
Status โœ… Production Ready
Efficiency ~60% (USDC fees only)
Network Ethereum Sepolia Testnet
Rebalance Success Rate 100%
Active Positions #223170

๐Ÿ—๏ธ Architecture

graph TD
    A[User] -->|Mint NFT| B[ElementNFT Contract]
    B -->|Stake| C[YieldVault Contract]
    C -->|Provide Liquidity| D[Uniswap V3 WETH/USDC Pool]
    D -->|Trading Fees| C
    C -->|Distribute USDC| A
    E[Volume Bot] -->|Rebalance| C
    E -->|Generate Volume| D
    C -->|10% Tax| F[Treasury]
Loading

Core Components

Component Description
ElementNFT ERC-721 collection with 3 tiers and evolution mechanics
YieldVault Automated Uniswap V3 LP manager & yield distributor
Alchemist NFT crafting & evolution system
Treasury Receives 10% protocol tax
Volume Bot Generates trading volume & triggers rebalances

๐Ÿš€ Quick Start

Prerequisites

  • Node.js 18+
  • Foundry (for contracts)
  • MetaMask wallet
  • Sepolia ETH & USDC

Installation

# Clone the repository
git clone https://github.com/tmalone1250/alchemy-guild.git
cd alchemy-guild

# Install dependencies
npm install

# Copy environment file
cp .env.example .env
# Add your PRIVATE_KEY and VITE_INFURA_RPC_URL

# Start development server
npm run dev

Running the Bot

# Ensure .env is configured
npx tsx volume-bot.ts

๐Ÿ“ Deployed Contracts (Sepolia)

Contract Address Verified
ElementNFT 0xF15e4954AE325d68BFF9c990F26269D9c024caF0 โœ…
YieldVault 0xFff8e4da589f15453e73004b65c61Da341B9075C โœ…
Alchemist 0x8f392ccee00369d6623e18E6DDF120E988f3a513 โœ…
Treasury 0x09b6E39f11C4c26022D10DE50d63C0541ad40227 โœ…

External Contracts

  • WETH: 0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14
  • USDC: 0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238
  • Uniswap V3 Pool: 0x6Ce0896eAE6D4BD668fDe41BB784548fb8F59b50

๐Ÿ’Ž The Elemental Hierarchy

Alchemy Guild features 18 unique elements across three tiers, each with distinct staking power and yield potential.

Tier Classification

Tier Classification Reward Weight Elements Border Color
Tier 1 ๏ฟฝ Lead (Base Elements) 10 6 elements Bronze
Tier 2 โšช Silver (Advanced Synthesis) 30 6 elements Silver
Tier 3 ๐ŸŸก Gold (Transcendent) 100 6 elements Gold

Complete Element Matrix

Tier 1 (Lead) Tier 2 (Silver) Tier 3 (Gold)

๐ŸŒ Earth
๐Ÿ’ง Water
๐Ÿ’จ Wind
๐Ÿ”ฅ Fire
โ„๏ธ Ice
โšก Lightning

โš›๏ธ Plasma
๐ŸŒช๏ธ Tornado
๐ŸŒจ๏ธ Blizzard
๐ŸŒŠ Tsunami
๐Ÿ”๏ธ Quake
๐ŸŒ‹ Inferno

โœจ Holy
๐ŸŒ‘ Dark
๐ŸŒ€ Gravity
โฐ Time
๐Ÿงฌ Bio
๐Ÿ‘ป Spirit


โš—๏ธ The Crafting Lab (Transmutation)

Transform lower-tier NFTs into higher-tier ones through alchemical fusion. All crafting requires a 0.002 ETH transmutation cost.

The Lead Synthesis (Tier 1 โ†’ Tier 2)

Combine 3 Tier 1 NFTs to create 1 Tier 2 NFT.

Example Recipes:

  • ๐Ÿ’ง๐Ÿ’ง๐Ÿ’จ Water + Water + Wind โ†’ ๐ŸŒŠ Tsunami
  • ๐Ÿ’จโ„๏ธโ„๏ธ Wind + Ice + Ice โ†’ ๐ŸŒจ๏ธ Blizzard
  • ๐ŸŒ๐ŸŒ๐Ÿ”ฅ Earth + Earth + Fire โ†’ ๐Ÿ”๏ธ Quake
  • ๐Ÿ’งโšกโšก Water + Lightning + Lightning โ†’ โš›๏ธ Plasma

The Golden Ritual (Tier 2 โ†’ Tier 3)

Combine 3 Tier 2 NFTs to create 1 Tier 3 NFT.

Example Recipes:

  • ๐ŸŒŠ๐ŸŒจ๏ธ๐ŸŒจ๏ธ Tsunami + Blizzard + Blizzard โ†’ โฐ Time
  • ๐ŸŒ‹๐ŸŒ‹๐Ÿ”ฅ Inferno + Inferno + Fire โ†’ ๐Ÿ‘ป Spirit
  • ๐ŸŒช๏ธ๐ŸŒช๏ธโšก Tornado + Tornado + Lightning โ†’ โœจ Holy

Crafting Mechanics

function craft(uint256[3] tokenIds) external payable {
    require(msg.value >= 0.002 ether, "Transmutation fee required");
    // Burns 3 NFTs โ†’ Mints 1 higher-tier NFT
}

Key Features:

  • โœ… 3-to-1 Ratio: Burn 3 lower-tier โ†’ Create 1 higher-tier
  • โœ… Deflationary: Reduces total supply with each craft
  • โœ… Specific Recipes: Each Tier 2/3 element requires exact ingredient combinations
  • โœ… Protocol Fee: 0.002 ETH per transmutation

๐Ÿ“ˆ Yield Dynamics & Weight Mathematics

How Rewards Are Calculated

Yields are distributed pro-rata based on each NFT's staking weight:

$$ Reward_{user} = \frac{Weight_{user}}{\sum Weight_{total}} \times Fees_{harvested} $$

Where:

  • $Weight_{user}$ = Sum of all staked NFT weights for the user
  • $\sum Weight_{total}$ = Total weight of all staked NFTs in the vault
  • $Fees_{harvested}$ = USDC fees collected from Uniswap trading

Weight Multipliers

Tier Weight Relative Earning Power
Tier 1 10 1x baseline
Tier 2 30 3x more than Tier 1
Tier 3 100 10x more than Tier 1

Example Scenario

Vault State:

  • User A: 1ร— Tier 3 (Gold) NFT = 100 weight
  • User B: 3ร— Tier 2 (Silver) NFTs = 90 weight
  • User C: 10ร— Tier 1 (Lead) NFTs = 100 weight
  • Total Weight: 290

Fees Collected: 100 USDC (after 10% tax to Treasury)

Distribution:

  • User A: $(100/290) \times 100 = 34.48$ USDC
  • User B: $(90/290) \times 100 = 31.03$ USDC
  • User C: $(100/290) \times 100 = 34.48$ USDC

Key Insight: User A earns the same as User C, but with 1 NFT vs 10 NFTs!

Deflationary Scarcity

Every crafting operation burns 3 NFTs to create 1:

  • Total supply decreases by 2 NFTs per craft
  • Higher-tier NFTs become increasingly scarce
  • Remaining stakers capture more yield per NFT over time

$$ Supply_{new} = Supply_{old} - 2 $$

This creates a flywheel effect:

  1. Users craft to increase individual weight
  2. Total NFT supply decreases
  3. Yield per NFT increases for all stakers
  4. Higher-tier scarcity drives value

๐ŸŽฎ Usage

For Users

  1. Mint an NFT

    • Connect wallet
    • Approve USDC
    • Select tier (1/2/3)
    • Mint NFT
  2. Stake NFT

    • Navigate to Vault page
    • Click "Stake" on your NFT
    • Confirm transaction
  3. Claim Yields

    • Wait for rebalances (~5 min cycles)
    • View pending rewards
    • Click "Claim" to receive USDC

For Developers

Deploy Contracts

cd alchemy-vault
forge build
forge script script/DeployAlchemy.s.sol \
  --rpc-url $VITE_INFURA_RPC_URL \
  --broadcast \
  --private-key $PRIVATE_KEY

Seed Vault

npx tsx manual-seed.ts

Utility Scripts

Script Purpose
wrap-eth.ts Convert ETH โ†’ WETH
swap-weth-usdc.ts Swap WETH โ†’ USDC
check-rewards.ts View reward accumulation
test-rebalance.ts Test rebalance function
diagnose-rebalance.ts Full diagnostic

๐Ÿ› ๏ธ Tech Stack

Smart Contracts

  • Solidity 0.8.26
  • Foundry (Forge, Cast, Anvil)
  • OpenZeppelin Contracts
  • Uniswap V3 Core & Periphery

Frontend

  • React 18 + TypeScript
  • Vite 5.x
  • Ethers.js 6.x
  • RainbowKit + Wagmi
  • TailwindCSS
  • Lucide Icons

Infrastructure

  • Infura (RPC)
  • Etherscan (Verification)
  • IPFS (Metadata)

๐Ÿ› Known Issues & Solutions

Issue Impact Status Workaround
WETHโ†’USDC swap fails in rebalance 40% lower yield ๐Ÿ”„ Investigating Try-catch wrapper prevents crashes
WETH fees accumulate Not distributed โณ Planned Manual swap available
Testnet liquidity Low fees โ„น๏ธ Expected Normal for Sepolia

๐Ÿ† Major Bugs Fixed

Click to expand debugging history

1. Token Ordering Bug โœ…

  • Issue: WETH and USDC reversed in Uniswap calls
  • Fix: Corrected to USDC=token0, WETH=token1

2. Incorrect Uniswap Addresses โœ…

  • Issue: Wrong Sepolia addresses in deployment
  • Fix: Updated Position Manager and Swap Router

3. Fee Calculation Logic โœ…

  • Issue: Three bugs in fee distribution
  • Fix: Aligned all variables with token0/token1 ordering

4. WETH Swap Failures โœ… (Mitigated)

  • Issue: Swap reverts during rebalance
  • Fix: Try-catch wrapper, accumulates WETH safely

5. ClaimYield Balance Issue โœ…

  • Issue: USDC locked in Uniswap position
  • Fix: 20% USDC reserve + balance cap

6. Vault Address Mixup โœ…

  • Issue: Bot using wrong contract address
  • Fix: Updated to correct YieldVault address

๐Ÿ”ฎ Roadmap

Short Term

  • Fix WETH swap in rebalance context
  • Increase vault liquidity for higher yields
  • Gas optimization
  • Enhanced event logging

Long Term

  • Mainnet Deployment - Real USDC yields
  • Multi-Pool Support - ETH/DAI, WBTC/ETH
  • NFT Marketplace - Trade staked positions
  • Governance DAO - Community parameter control
  • Advanced Crafting - Complex evolution recipes

๐Ÿ“ธ Screenshots

Landing Page

Landing Page

Dashboard

Dashboard

Inventory

Inventory

The Vault (Staking)

The Vault

The Lab (Crafting)

The Lab

Analytics

Analytics


๐Ÿค Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


๐Ÿ™ Acknowledgments


๐Ÿ“ž Contact

Project Maintainer: @tmalone1250

Bot Wallet: 0xd83B5031506039893BF1C827b0A79aDDee71E1fE


Built with โš—๏ธ by Alchemy Guild

Transmuting Base Assets into Gold

โฌ† back to top

About

A gamified DeFi yield protocol on Ethereum Sepolia. Stake elemental NFTs to earn automated Uniswap V3 USDC rewards, powered by an algorithmic rebalancing engine.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published