To run the service locally, simply run the generateConfig.sh script, or use
it as a template to create your configuration file at src/config.local.ts.
Once the configuration file has been created, you can start the service by
running npm i && npm start. Note that due to CORS restrictions, the provided
configuration values will require the service to be hosted on
http://localhost:3000 as it is by default, or the use of an additional
service such as
local-cors-proxy.
- Node.js (v16 or higher recommended)
- Yarn or npm
- A Cardano wallet (e.g., Eternl, Nami, etc.)
- Basic understanding of React, TypeScript, and the Cardano blockchain
- Fork the repository on GitHub by clicking the "Fork" button at the top right of the repository page
- Clone your forked repository:
git clone https://github.com/OptimFinance/oada-ui.git cd oada-ui - Install dependencies:
npm install # or if using yarn yarn
-
Create a configuration file by either:
- Running the configuration script:
./generateConfig.sh - Manually copying the example file:
cp src/config.local.ts.example src/config.local.ts
- Running the configuration script:
-
Modify
src/config.local.tswith your specific settings:- Backend API endpoints
- Blockchain network configuration
- Fee addresses and amounts
- Other environment-specific values
-
Start the development server:
npm start # or with yarn yarn start -
The application will be available at
http://localhost:3000 -
For API requests that might be affected by CORS, consider using:
npx local-cors-proxy --proxyUrl="https://your-api-endpoint.com"
npm run build
# or with yarn
yarn buildThe build artifacts will be located in the build/ directory.
To adapt this codebase for your own DApp:
-
Token Configuration:
- Update token names and references in
/src/oada/actions.tsand relevant UI components - Modify token logic in transaction-related files
- Update token names and references in
-
UI Customization:
- Brand colors and theme are configurable in
tailwind.config.js - Update logos and assets in
/src/assets - Modify component styles as needed
- Brand colors and theme are configurable in
-
Blockchain Integration:
- Update the Cardano network settings in
/src/network.ts - Adjust transaction building in
/src/tx.tsand/src/tx-recipe.ts - Configure wallet integration in relevant wallet slice files
- Update the Cardano network settings in
-
Backend Endpoints:
- Replace API endpoints in your config file with your own service endpoints
-
Feature Customization:
- The feature-based organization allows for easy addition/removal of features
- Each feature in
/src/featurescan be modified independently
This is a React TypeScript application built with the following key technologies:
- React (v18.0.0) - Frontend framework
- Redux (with Redux Toolkit) - State management
- React Router (v6.3.0) - Routing
- TypeScript - Type safety
- Tailwind CSS - Styling (with some custom components)
- Radix UI - UI component primitives
- Lucid Cardano - Cardano blockchain interaction library
- Craco - Configuration override for Create React App
This is a DApp (Decentralized Application) interface for OADA (Optimiz Algorithmic Digital Asset) on the Cardano blockchain. The application allows users to:
- Connect their Cardano wallet (via wallet providers like Eternal, Nami, etc.)
- Mint OADA tokens using ADA (Cardano's native currency)
- Stake OADA tokens to earn yield (converting to sOADA)
- Unstake sOADA tokens back to OADA
- Participate in Epoch Stake Auctions - Users can bid to participate in staking epochs
- Lock OADA tokens for OPTIMiz conversion
- View dashboard statistics like TVL (Total Value Locked), yield rates, etc.
- The app integrates with Cardano wallets through the
cardano-dapp-connector-bridge.js - Wallet state is managed in the Redux store via
walletSlice.ts - The app periodically refreshes wallet UTXOs (Unspent Transaction Outputs)
- OADA: The primary token of the system
- sOADA: Staked OADA that earns yield
- OPTIMiz/OPTIM: Related tokens for conversion/locking mechanics
- Displays TVL, volume, positions, and yield information
- Shows user positions and staking options
- Visualizes data with charts
- Allows users to mint OADA with ADA
- Enables staking OADA to sOADA
- Supports unstaking sOADA back to OADA
- Shows pending transactions in a queue
- Users can bid for participation in staking epochs
- Variable APY/APR based on bid amount
- Auction mechanics with clearing rates
- Locking mechanism for OADA to convert to OPTIMiz/OPTIM tokens
- Various lockup options with different rates and durations
The app uses Redux with several slices:
walletSlice: Manages wallet connection and statealertSlice: Handles application alerts/notificationsoadaActions: Manages OADA-specific functionality
- The app communicates with endpoints defined in
config.local.ts - Uses both REST API calls and WebSocket connections for real-time updates
- Interactions with the Cardano blockchain are handled via Lucid library
- Combines Tailwind CSS with custom components
- Uses Radix UI primitives for accessible components
- Custom theme and styling system
The codebase follows a feature-based organization:
/src/components: Reusable UI components/src/features: Feature-specific components and logic/src/store: Redux store configuration/src/oada: OADA-specific logic and API actions/src/utils: Utility functions/src/types: TypeScript type definitions
The application uses Lucid Cardano to:
- Read blockchain data
- Submit transactions
- Work with Cardano-specific data types like UTXOs
- Manage wallet connections
-
Minting OADA:
- Connect wallet
- Specify ADA amount
- Execute mint transaction
- Receive OADA tokens
-
Staking Flow:
- Connect wallet
- Select OADA amount to stake
- Execute stake transaction
- Receive sOADA tokens
-
Auction Bidding:
- Connect wallet
- Select bid amount and APY
- Submit bid transaction
- Monitor bid status
-
Wallet Connection Issues:
- Ensure you have the wallet extension installed and configured properly
- Check if the wallet is connected to the correct Cardano network
- Try refreshing the page or reconnecting the wallet
-
Transaction Errors:
- Verify you have sufficient ADA for transaction fees
- Check wallet UTXOs for conflicts
- Ensure correct token amounts are specified
-
CORS Errors:
- Configure and use
local-cors-proxyfor API requests - Ensure your config points to the correct proxy URL
- Configure and use
- Use browser developer tools to debug React components and network requests
- Redux DevTools can help inspect the application state
- Check the browser console for error messages
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the project
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request