Skip to content

kaankacar/fKALE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

fKALE Logo

fKALE

Trade your future $KALE

fKALE is a platform that allows users to leverage their future KALE token expectations without selling their XLM. Users can provide 1:1 XLM collateral to mint fKALE tokens at a 1000:1 ratio, trade them with KALE to be used their ongoing farming operations, maintaining exposure to XLM volatility while accessing liquidity from their anticipated KALE farming rewards.

Core Value Proposition

Trade your future $KALE - fKALE enables users to:

  • πŸ”’ Maintain XLM Exposure: Keep your XLM bags while accessing liquidity
  • πŸ’° 1:1 Collateral Efficiency: Provide 1 XLM, receive 1000 fKALE tokens
  • 🌾 Monetize Future Farming: Trade expected KALE rewards before you farm them
  • ⚑ Instant Liquidity: Get immediate access to capital without selling your XLM
  • πŸ”„ Volatility Participation: Stay exposed to XLM price movements while leveraging future yields

πŸš€ Project Status & Recent Improvements

Production-Ready Enhancements

This project has been finalized with the following improvements:

  • βœ… Security Fixes: Resolved critical npm vulnerabilities (sha.js, axios, vite, js-yaml)
  • βœ… Type Safety: Fixed 40+ TypeScript errors, improved type definitions throughout codebase
  • βœ… Code Quality: Enhanced ESLint configuration with proper type checking
  • βœ… Build Optimization: Added code splitting for better performance (vendor, stellar-sdk, debug chunks)
  • βœ… Bundle Size: Optimized build output with manual chunking strategy
  • βœ… Production Build: Fully tested and verified Vercel deployment-ready build
  • βœ… Clean Codebase: Removed unsafe any types, added proper error handling
  • βœ… Developer Experience: Fixed all build warnings and configuration issues

Build & Deploy

# Install dependencies
npm install

# Build for production
npm run build

# Preview production build
npm run preview

# Deploy to Vercel
vercel deploy --prod

Build Output:

  • Main bundle: ~805 KB gzipped (optimized with code splitting)
  • WASM module: ~736 KB gzipped (Stellar XDR processing)
  • Total assets: 4 files (HTML, CSS, JS chunks, WASM)
  • Build time: ~15 seconds

Live Application Features

🏠 Home Dashboard

  • Portfolio Overview: Real-time display of XLM, fKALE, and KALE balances
  • Interactive Feature Cards: Quick access to all platform functions
  • Educational Content: Clear explanations of how fKALE works
  • Theme Toggle: Dark/Light mode support for optimal user experience
  • Responsive Design: Works seamlessly on desktop and mobile devices

πŸ’° Mint fKALE Tokens

  • Smart Input Validation: Real-time balance checking and error handling
  • Live Rate Calculator: Automatic calculation of fKALE tokens to receive (1000:1 ratio)
  • Transaction Preview: Detailed breakdown of collateral, fees, and lock period
  • MAX Button: One-click option to use maximum available XLM (minus fees)
  • Progress Indicators: Loading states and transaction status updates
  • Position Tracking: Immediate balance updates after successful minting

🌾 Redeem KALE Tokens

  • Dual Functionality:
    • Deposit KALE tokens to enable redemptions for others
    • Redeem your fKALE tokens for KALE at 1:1 ratio
  • Pool Status: View available KALE in the redemption pool
  • Fee Earning: Earn fees by providing KALE liquidity
  • Instant Redemption: When KALE is available, redeem fKALE immediately

βš™οΈ Position Management

  • Comprehensive Overview: View all active positions and collateral
  • Lock Period Tracking: Monitor 30-day lock period countdown
  • Withdrawal Eligibility: Check when XLM can be withdrawn
  • Position Health: Monitor collateral ratios and position status
  • Transaction History: View all minting, redemption, and withdrawal activities

πŸ”§ Advanced Debug Interface

  • Contract Interaction: Direct interface to all contract functions
  • Real-time Validation: Input validation with immediate feedback
  • Transaction Simulation: Preview transactions before execution
  • Contract Metadata: View complete contract schemas and functions
  • Developer Tools: JSON viewers, XDR utilities, and error diagnostics

🎨 Modern UI/UX Features

  • Glass Morphism Design: Modern translucent cards with backdrop blur
  • Smooth Animations: Professional fade-in effects and hover transitions
  • Brand Identity: Cohesive fKALE branding with custom color palette
  • Error Boundaries: Graceful error handling with user-friendly messages
  • Accessibility: Keyboard navigation and screen reader support
  • Performance Optimized: Fast loading with skeleton states and lazy loading

Contract Addresses

Testnet Deployment

  • fKALE Token Contract: CC3A4X5YBD7YN2WFRECSQPA3N4JGGWOMSXF7ED5ZCQANMTRVHH6CRHJN
  • Forwards Contract: CDP2A3JLSFR4G3SQWKAYZMRUN7XN5K3AQZ2FY5QFZ3X2T32VLUDHW4ES
  • KALE SAC: CAAVU2UQJLMZ3GUZFM56KVNHLPA3ZSSNR4VP2U53YBXFD2GI3QLIVHZZ
  • XLM SAC: CDLZFC3SYJYDZT7K67VZ75HPJVIEUVNIXF47ZG2FB2RMQQVU2HHGCYSC

Smart Contract Architecture

fKALE Token Contract

The fKALE token contract is a Stellar Asset Contract (SAC) compliant fungible token that represents claims on future KALE tokens. Key features:

  • Mintable: New fKALE tokens are minted when users provide XLM collateral
  • Burnable: fKALE tokens are burned when redeemed for KALE
  • Transferable: Users can trade fKALE tokens freely
  • 1:1 KALE Backing: Each fKALE token represents a claim on 1 KALE token

Forwards Contract

The forwards contract manages the collateral system and forward positions. Core functions:

  • Position Management: Creates and tracks user positions with XLM collateral
  • Collateral Handling: Manages 1:1 XLM collateral for fKALE minting
  • Redemption Logic: Facilitates fKALE to KALE redemption when KALE is available
  • Liquidation System: Handles position liquidation and collateral distribution

Current Architecture (MVP)

⚠️ Note: The current implementation uses a shared pool system which is NOT production-ready. This is for demonstration purposes only.

Current MVP Features:

  • Shared collateral pool for all users
  • Simplified position tracking
  • Basic redemption mechanism
  • 30-day lock period for all positions
  • Fixed 1000:1 XLM to fKALE exchange rate

Production Roadmap

Phase 1: Advanced Features πŸš€

  • User-Specific Pools: Individual collateral management per user
  • Dynamic Pricing: Market-driven exchange rates for fKALE
  • Variable Lock Periods: User-selectable lock durations (7, 30, 90, 180 days)
  • Partial Withdrawals: Allow partial collateral withdrawal before maturity
  • Position Transfers: Enable trading of locked positions

Phase 2: Market Making & Liquidity πŸ’±

  • Automated Market Maker: XLM-fKALE trading pool with dynamic pricing
  • fKALE-KALE Pool: Direct redemption pool with liquidity incentives
  • Yield Farming: Liquidity provider rewards and staking mechanisms
  • Cross-Chain Integration: Bridge to other blockchain networks
  • Institutional Integration: API for institutional traders and market makers

Phase 3: Advanced Risk Management βš–οΈ

  • Dynamic Collateral Ratios: Risk-adjusted collateral requirements
  • Liquidation Engine: Automated position liquidation system
  • Insurance Fund: Protocol insurance for extreme market events
  • Reflector Integration: Real-time price feeds for accurate valuations
  • Stress Testing: Continuous monitoring and risk assessment

Phase 4: Advanced DeFi Integration πŸ”—

  • Lending Protocols: Use fKALE as collateral in lending platforms
  • Synthetic Assets: Create synthetic KALE derivatives
  • Options Trading: fKALE options and futures contracts
  • Perpetual Swaps: Leveraged trading of fKALE positions
  • Cross-Protocol Yield: Optimize yields across multiple DeFi protocols

Getting Started

Prerequisites

  • Node.js 18+
  • Rust with wasm32v1-none target
  • Stellar-compatible wallet (Freighter, Albedo, etc.)
  • Testnet XLM for transactions

Quick Start

  1. Clone the repository
   git clone https://github.com/kaankacar/fkale.git
   cd fkale
  1. Install dependencies
npm install
rustup target add wasm32v1-none
  1. Set up environment
   cp env.example .env
   # Edit .env with your configuration
  1. Start development server
   npm run dev
  1. Visit the application
    http://localhost:5173
    

For Developers

Build contracts

npm run build:contracts

Run tests

npm run test:contracts

Deploy to testnet

npm run deploy:fkale
npm run deploy:forwards
npm run setup:complete

User Workflows

Basic User Journey

  1. Connect Wallet β†’ Link your Stellar wallet to the platform
  2. Fund Account β†’ Ensure sufficient XLM for transactions and collateral
  3. Mint fKALE β†’ Lock XLM collateral and receive fKALE tokens
  4. Trade or Hold β†’ Use fKALE for immediate liquidity or hold for KALE redemption
  5. Redeem KALE β†’ Exchange fKALE for KALE when available (1:1 ratio)
  6. Withdraw Collateral β†’ Reclaim XLM after lock period and sufficient KALE delivery

Advanced Trading Scenarios

Liquidity Seeker

  • Lock XLM β†’ Mint fKALE β†’ Sell fKALE β†’ Maintain XLM exposure β†’ Profit from XLM appreciation

KALE Farmer

  • Buy fKALE β†’ Hold until KALE delivery β†’ Redeem fKALE for KALE β†’ Benefit from KALE value

Arbitrage Trader

  • Monitor fKALE prices β†’ Mint when premium exists β†’ Sell at higher prices β†’ Profit from spreads

Security & Risk Considerations

  • MVP Status: Current implementation is for demonstration only
  • Shared Pools: Not suitable for production use
  • Testnet Only: Do not use real funds without proper auditing

Contributing

We welcome contributions! Please:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Add tests for new functionality
  5. Commit your changes (git commit -m 'Add amazing feature')
  6. Push to the branch (git push origin feature/amazing-feature)
  7. Open a Pull Request

License

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

Disclaimer

⚠️ Important: This is an MVP (Minimum Viable Product) for demonstration purposes. Do not use in production without proper security audits and testing. The contracts have not been audited and may contain vulnerabilities. Use at your own risk.

Support & Community


Built with ❀️ on Stellar | fKALE Protocol | "Trade your future $KALE"

About

Trade your future KALE

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •