feat: Integrate Starknet support for share management #21
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🚀 PR: Complete Starknet Local Testnet Setup & Frontend Integration
📋 Overview
This PR implements a complete Starknet local development environment with deployed smart contracts and full frontend integration for the BigInc deWhitepaper. The implementation enables users to mint shares using mock tokens and visualize on-chain data through an interactive pie chart.
🎯 Issue Addressed
Issue Description: Set up Starknet local testnet environment, deploy BigIncGenesis smart contract and mock ERC20 tokens, and integrate everything into the deWhitepaper page with live on-chain data visualization.
✅ All Acceptance Criteria Met
🔧 Local Setup Implementation
Starknet Devnet Stack Setup
1. Development Environment Configuration
2. Contract Deployment
Successfully deployed to local Katana devnet:
{ "network": "katana_local", "rpc_url": "http://localhost:5050", "contracts": { "BigIncGenesis": { "address": "0x0524d0778e535c840b4aeea9958d30c182d0064cdd584ea7c0f9e0cf897b36bc", "class_hash": "0x06b69532ce0df2f3d6361775ebc5ce59d01f399c69b2ce802c2c0755a1c84a2b" }, "MockUSDT": { "address": "0x04d2092d368213a814e384facca6a82a47f753f9c95bd98859374f47bbfb9398", "class_hash": "0x0365f4f0dd738f5d5a51760aa002ed66f690c0337af0b41c664ae10b0fb78dd0" }, "MockUSDC": { "address": "0x06e37c9a6de30781abc6973101e7a7c5e343ccb906a70223a24407a56cde99ef", "class_hash": "0x0365f4f0dd738f5d5a51760aa002ed66f690c0337af0b41c664ae10b0fb78dd0" } } }3. Mock ERC20 Token Implementation
🌐 Frontend Integration Implementation
1. Starknet-React Configuration
Chain Configuration (
src/lib/starknet/config.ts)Wallet Integration (
src/context/StarknetKitProvider.tsx)2. Custom Hooks & Utilities (
src/lib/starknet/hooks.ts)Smart Contract Interaction Hooks
3. Component Integration
ShareChartStarknet.tsx
ShareModalStarknet.tsx
4. deWhitepaper Page Integration (
src/app/dewhitepaper/page.tsx)🛠 Development Scripts & Automation
Setup Scripts
scripts/setup-devnet.sh: Starts Katana with correct parametersscripts/deploy-contracts.sh: Automated contract deploymentscripts/full-setup.sh: Complete environment initializationscripts/verify-setup.sh: End-to-end verificationConfiguration Management
scripts/update-addresses.js: Automatically updates frontend config with deployed addressesdeployment/contracts.json: Centralized contract registry.starkli-wallets/: Local wallet configuration for development🔍 Technical Implementation Details
Smart Contract Architecture
Frontend Architecture
State Management
📊 Verification & Testing
Contract Verification
Frontend Testing
🎯 Key Features Delivered
For Developers
For Users
For Future Development
📁 Files Changed/Added
Smart Contracts
contract_/src/MockERC20.cairo- Mock ERC20 token implementationcontract_/src/lib.cairo- Module declarationsdeployment/contracts.json- Contract registryFrontend Integration
src/lib/starknet/config.ts- Starknet configurationsrc/lib/starknet/hooks.ts- Custom contract interaction hookssrc/context/StarknetKitProvider.tsx- Wallet provider setupsrc/components/ShareChartStarknet.tsx- Live data pie chartsrc/components/ShareModalStarknet.tsx- Share minting interfacesrc/app/dewhitepaper/page.tsx- Page integrationDevelopment Scripts
scripts/setup-devnet.sh- Katana devnet startupscripts/deploy-contracts.sh- Automated deploymentscripts/full-setup.sh- Complete environment setupscripts/verify-setup.sh- End-to-end verificationscripts/update-addresses.js- Config management🚀 Ready for Production
This implementation provides a complete, production-ready Starknet integration that:
The deWhitepaper page now successfully connects to local Starknet contracts, enables share minting with mock tokens, and displays live on-chain data through an interactive pie chart. All components are tested and verified working end-to-end.