Production-ready DeFi platform for automated systematic investments on OneChain blockchain
Revolutionizing systematic investments with AI-powered yield optimization and emergency fund protection on OneChain's lightning-fast blockchain
- Overview
- Features
- Architecture
- Quick Start
- Deployment
- Smart Contracts
- API Documentation
- Contributing
Sphira is a comprehensive DeFi investment platform built on OneChain blockchain that enables:
- Automated SIPs: Systematic Investment Plans with customizable schedules
- AI Yield Optimization: Smart fund allocation across DeFi pools
- Emergency Vault: Multi-sig protected fund locking system
- Real-time Analytics: Portfolio tracking and performance metrics
- Conversational UX: Chat-based investment management
- ⚡ Lightning Fast: Sub-5 second transaction finality
- 💰 Ultra-Low Fees: ~$0.00001 average transaction cost
- 🔒 Secure: Move smart contract language with resource-oriented programming
- 🌍 Scalable: 1,000+ TPS capacity
- Daily, weekly, monthly investment schedules
- Multi-token support (OCT, USDC, etc.)
- Flexible parameters and early exit options
- Pause/resume capabilities
- Dynamic fund allocation across 20+ DeFi pools
- Risk-adjusted returns with auto-rebalancing
- Predictive analytics for optimal yields
- Real-time performance tracking
- Multi-sig security (3-of-5 governance)
- Time-lock mechanisms with configurable penalties
- Community governance for emergency unlocks
- Complete audit trail transparency
- Portfolio overview with live balance
- Active SIPs tracking
- Yield performance charts
- Recent activity feed
graph TB
subgraph "Frontend Layer"
A[Next.js 15 App]
B[React Components]
C[Tailwind CSS]
end
subgraph "Integration Layer"
D[Sui dApp Kit]
E[OneChain SDK]
F[Move Client]
end
subgraph "OneChain Blockchain"
G[SIP Manager Contract]
H[Yield Router Contract]
I[Lock Vault Contract]
end
subgraph "Data Layer"
J[Local Storage]
K[Blockchain State]
end
A --> D
B --> E
D --> G
E --> H
F --> I
G --> K
H --> K
I --> K
B --> J
sequenceDiagram
participant U as User
participant W as Wallet
participant F as Frontend
participant B as Blockchain
participant C as Smart Contract
U->>W: Connect Wallet
W->>F: Wallet Connected
F->>B: Request Balance
B->>F: Return Balance
U->>F: Create SIP
F->>W: Request Signature
W->>U: Confirm Transaction
U->>W: Approve
W->>C: Execute create_sip()
C->>B: Store SIP Object
B->>F: Transaction Success
F->>U: SIP Created ✅
flowchart LR
A[SIP Created] --> B{Time Check}
B -->|Not Due| C[Wait]
C --> B
B -->|Due| D[Execute Deposit]
D --> E[Split Coins]
E --> F[Transfer to Pool]
F --> G[Update SIP State]
G --> H[Emit Event]
H --> I[Next Execution Scheduled]
I --> B
graph LR
subgraph "SIP Manager"
A[create_sip]
B[execute_sip]
C[pause_sip]
D[cancel_sip]
end
subgraph "Yield Router"
E[deposit]
F[rebalance]
G[harvest_yield]
end
subgraph "Lock Vault"
H[lock_funds]
I[unlock_vault]
J[emergency_proposal]
end
A --> E
B --> E
E --> F
F --> G
H --> I
I --> J
- Node.js 18+ and npm
- OneChain CLI (
one) - Git
- Clone the repository
git clone https://github.com/yourusername/sphira-defi.git
cd sphira-defi- Install dependencies
npm install- Set up environment variables
cp .env.example .envEdit .env with your configuration:
NEXT_PUBLIC_ONECHAIN_NETWORK=testnet
NEXT_PUBLIC_ONECHAIN_RPC_URL=https://rpc-testnet.onelabs.cc:443
NEXT_PUBLIC_ONECHAIN_FAUCET_URL=https://faucet-testnet.onelabs.cc/v1/gas
# Smart Contract Package IDs (update after deployment)
NEXT_PUBLIC_SIP_MANAGER_PACKAGE_ID=YOUR_PACKAGE_ID
NEXT_PUBLIC_YIELD_ROUTER_PACKAGE_ID=YOUR_PACKAGE_ID
NEXT_PUBLIC_LOCK_VAULT_PACKAGE_ID=YOUR_PACKAGE_ID
# Shared Object IDs
NEXT_PUBLIC_SIP_MANAGER_OBJECT_ID=YOUR_SIP_MANAGER_ID
NEXT_PUBLIC_YIELD_ROUTER_OBJECT_ID=YOUR_YIELD_ROUTER_ID
NEXT_PUBLIC_VAULT_MANAGER_OBJECT_ID=YOUR_VAULT_MANAGER_ID
# AI Configuration
GOOGLE_GEMINI_API_KEY=your_api_key_here- Run development server
npm run devOpen http://localhost:3000 in your browser.
- Build the project
npm run build- Install Netlify CLI
npm install -g netlify-cli- Login to Netlify
netlify login- Deploy
netlify deploy --prod-
Push your code to GitHub
-
Go to Netlify
-
Click "New site from Git"
-
Select your repository
-
Configure build settings:
- Build command:
npm run build - Publish directory:
.next - Node version: 18
- Build command:
-
Add environment variables in Netlify dashboard:
- Go to Site settings → Environment variables
- Add all variables from
.env
-
Deploy!
graph LR
A[Push to GitHub] --> B[Netlify Detects Change]
B --> C[Install Dependencies]
C --> D[Run Build]
D --> E[Deploy to CDN]
E --> F[Live Site ✅]
style F fill:#00D382
flowchart TB
A[Local .env] --> B{Deploy Method}
B -->|Netlify UI| C[Site Settings]
B -->|CLI| D[netlify.toml]
B -->|GitHub Actions| E[Repository Secrets]
C --> F[Environment Variables]
D --> F
E --> F
F --> G[Build Process]
G --> H[Production Site]
- Install OneChain CLI
cargo install --locked --git https://github.com/one-chain-labs/onechain.git one_chain
mv ~/.cargo/bin/one_chain ~/.cargo/bin/one- Create Wallet
one client
# Save your recovery phrase!- Get Test OCT
one client faucet- Build Contracts
cd contracts
one move build- Test Contracts
one move test- Deploy Contracts
one client publish --gas-budget 100000000- Update .env with deployed addresses
After deployment, you'll receive:
- Package ID: The deployed package address
- Shared Object IDs: SIP Manager, Yield Router, Vault Manager
Update your .env file with these addresses.
GET /api/sips?userAddress={address}- List user's SIPsPOST /api/sips- Create new SIPGET /api/sips/[id]- Get SIP detailsDELETE /api/sips/[id]- Cancel SIP
GET /api/portfolio?userAddress={address}- Get portfolio overview
GET /api/activity?userAddress={address}- Get recent activity
GET /api/notifications?userAddress={address}- Get notificationsPOST /api/notifications- Mark as read
GET /api/analytics- Get platform analytics
GET /api/yield/pools- List available yield pools
npm run testcd contracts
one move testnpm run test:e2eWe welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
gitGraph
commit id: "Initial"
branch feature
checkout feature
commit id: "Add feature"
commit id: "Add tests"
checkout main
merge feature
commit id: "Release"
This project is licensed under the MIT License - see the LICENSE file for details.
- Documentation: docs.sphira.finance
- Discord: discord.gg/sphira
- Email: support@sphira.finance
- Issues: GitHub Issues
- OneChain team for the amazing blockchain platform
- Sui/Move community for the smart contract framework
- Next.js team for the incredible web framework
- All contributors and supporters
Built with ❤️ for the future of decentralized finance
Powered by OneChain • Secured by Move • Built with Next.js