Automated currency protection for LATAM using Stellar and Reflector oracles.
Hedge protects your purchasing power by automatically converting a portion of your salary to USD and/or XML when your local currency weakens beyond a configurable threshold. Built on Stellar with real-time exchange rates from Reflector oracles, targeting LATAM workers and professionals facing currency devaluation.
- π¦π· ARS (Argentine Peso) - Testnet available
- π§π· BRL (Brazilian Real) - Mainnet ready
- π΅πͺ PEN (Peruvian Sol) - Mainnet ready
- π¨π± CLP (Chilean Peso) - Coming soon
- π²π½ MXN (Mexican Peso) - Coming soon
- π¨π΄ COP (Colombian Peso) - Coming soon
graph TB
User[LATAM User] --> Frontend[React Frontend]
Frontend --> Wallet[Stellar Account]
Frontend --> Contract[Hedge Smart Contract]
Contract --> Oracle[Reflector Oracle]
Contract --> Storage[User Configuration]
Oracle --> Prices[Real-time FX Rates]
Storage --> Triggers[Auto Conversion Logic]
Triggers --> Protection[USD Protection]
classDef primary fill:#3b82f6,stroke:#1d4ed8,color:#fff
classDef oracle fill:#10b981,stroke:#059669,color:#fff
classDef protection fill:#f59e0b,stroke:#d97706,color:#fff
class Frontend,Contract,Wallet primary
class Oracle,Prices oracle
class Storage,Triggers,Protection protection
Components:
- Smart Contract: Soroban contract with Reflector oracle integration
- Frontend: React + TypeScript with mobile-first, intuitive interface
- Oracle Integration: Reflector for real-time forex and crypto price feeds
- Storage: Persistent user configurations and conversion history
- Automatic Triggers: Conversions triggered by currency devaluation thresholds
- Real-time Rates: Live exchange rates via Reflector oracles
- Non-custodial: Users maintain control of their funds
- Mobile-first: Optimized for mobile usage patterns
- Historical Tracking: Complete protection and conversion metrics
- Node.js 18+
- Rust and Soroban CLI
- Stellar CLI configured with testnet account
-
Clone and setup
git clone https://github.com/yourusername/hedge.git cd hedge
-
Install dependencies
npm install cd frontend && npm install && cd ..
-
Configure environment
cp .env.example .env # Update .env with your configuration
-
Build and deploy contract
cd contracts/hedge cargo build --target wasm32-unknown-unknown --release stellar contract deploy --wasm target/wasm32-unknown-unknown/release/hedge_contract.wasm --source alice --network testnet
-
Start development server
cd ../../frontend npm run dev
For testing the application, use the following testnet configuration:
- Network: Stellar Testnet
- Test Account: Alice (configured via Stellar CLI)
- Contract Address:
CCQYSKW4OZRDB7WGHTMZLKBP3QZB32RLHZQQIZ235GZRAMUJTA63TXCV
- Oracle Address:
CAVLP5DH2GJPZMVO7IJY4CVOD5MWEFTJFVPD2YY2FQXOQHRGHK4D6HLP
To configure Alice account:
stellar keys generate alice --network testnet
stellar keys fund alice --network testnet
setup_protection(user, currency, percentage, threshold)
- Configure user protectionprocess_salary(user, amount)
- Process salary and trigger conversions if neededget_config(user)
- Retrieve user configurationget_metrics(user, days_back)
- Get protection metricsget_metrics_mock(user, days_back)
- Mock metrics for testnet testing
# Setup protection for ARS with 25% conversion at 2% devaluation
stellar contract invoke --id CCQYSKW4OZRDB7WGHTMZLKBP3QZB32RLHZQQIZ235GZRAMUJTA63TXCV \
--source alice --network testnet --send=yes \
-- setup_protection \
--user $(stellar keys address alice) \
--local_currency ARS \
--target_percentage 25 \
--threshold_bp 200
# Check configuration
stellar contract invoke --id CCQYSKW4OZRDB7WGHTMZLKBP3QZB32RLHZQQIZ235GZRAMUJTA63TXCV \
--source alice --network testnet \
-- get_config --user $(stellar keys address alice)
- Contract Address:
CCQYSKW4OZRDB7WGHTMZLKBP3QZB32RLHZQQIZ235GZRAMUJTA63TXCV
- Network: Stellar Testnet
- Oracle:
CAVLP5DH2GJPZMVO7IJY4CVOD5MWEFTJFVPD2YY2FQXOQHRGHK4D6HLP
- Explorer: Stellar Expert Testnet
- Status: Ready for deployment
- Oracle:
CALI2BYU2JE6WVRUFYTS6MSBNEHGJ35P4AVCZYF3B6QOE3QKOB2PLE6M
- Supported Assets: ARS, BRL, PEN tokens available
LATAM workers face significant purchasing power erosion due to currency devaluation. Traditional hedging solutions are either unavailable, expensive, or too complex for individual users.
- Stellar Blockchain: Lower transaction costs and better financial infrastructure for LATAM
- Reflector Oracles: Reliable, decentralized price feeds specifically designed for Stellar
- Automatic Triggers: Reduces manual intervention and emotional decision-making
- Mobile-first Design: Matches usage patterns of target demographic
- Threshold-based System: Balances protection with transaction costs
The contract uses a threshold-based system to minimize unnecessary conversions while providing protection:
- Configurable thresholds: Users set their own risk tolerance
- Time delays: Prevents over-trading during volatile periods
- Mock functions: Enables testing when oracle data unavailable
- Address-based tokens: Direct integration with Stellar asset contracts
hedge/
βββ contracts/hedge/ # Soroban smart contract
β βββ src/
β β βββ lib.rs # Main contract logic
β β βββ reflector.rs # Oracle integration
β β βββ storage.rs # Data persistence
β β βββ types.rs # Type definitions
β βββ Cargo.toml
βββ frontend/ # React frontend
β βββ src/
β β βββ App.tsx # Main application
β β βββ hooks/ # Custom hooks
β β βββ utils/ # Utilities
β βββ package.json
βββ docs/ # Documentation
# Test smart contract
cd contracts/hedge
cargo test
# Test frontend
cd frontend
npm test
# Integration testing on testnet
npm run test:integration
-
MVP β Target date: October 2024
Basic protection setup, manual conversions, testnet deployment -
Beta β Target date: December 2024
Automatic conversions, mainnet deployment, ARS/BRL/PEN support -
V1 β Target date: Q1 2025
Full LATAM currency support, advanced analytics, mobile app
Stellar Hacks: KALE x Reflector Composability Hackathon
Demonstrating real-world composability by building directly on Reflector's oracle infrastructure to solve actual problems faced by LATAM workers and professionals.
- Fork the repository
- Create a feature branch
- Implement changes with tests
- Submit a pull request
All contributions require code review and security assessment.
MIT License - see LICENSE for details.
Report security vulnerabilities to [email protected]. Do not create public issues for security concerns.
- Documentation: docs/
- Issues: GitHub Issues
- Discord: Hedge Community
Disclaimer: This is experimental software. Users should understand the risks involved in automated currency conversion and DeFi protocols. Always test with small amounts first.