Feature/bnb lending protocol #182
Open
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.
BNB Lending Protocol MVP
A decentralized lending and borrowing protocol built on BNB Chain for the BNB Chain Cookbook Hackathon. Users can supply stablecoins to earn interest and borrow against their collateral.
🏗️ Project Structure
✨ Features
Smart Contracts
Frontend
🧪 Smart Contract Testing
Prerequisites
cd contractsUnit Tests
Run the standard unit tests:
forge testRun with verbosity:
forge test -vvvMainnet Fork Tests (with Chainlink Oracle)
The fork tests use real Chainlink price feeds from BSC Mainnet:
cp .env.example .env # Edit .env and add: BSC_RPC_URL=https://bsc-dataseed.binance.org/Note: Fork tests utilize:
0x0567F2323251f0Aab15c8dFb1967E4e8A7D42aeE0xB97Ad0E74fa7d920791E90258A6E2085088b4320🚀 Deployment
BSC Testnet Deployment
cd contracts cp .env.example .env.env:BSC_TESTNET_RPC_URL=https://data-seed-prebsc-1-s1.binance.org:8545/ PRIVATE_KEY=your_private_key_here BSCSCAN_API_KEY=your_api_key_here # Optional, for verificationforge script script/Deploy.s.sol:DeployScript --rpc-url $BSC_TESTNET_RPC_URL --broadcast --verifyUpdate Frontend with Deployed Addresses
After deployment, update
/frontend/config/addresses.ts:💻 Frontend Setup
Install Dependencies
cd frontend npm installConfigure WalletConnect (Optional)
Get a Project ID from WalletConnect Cloud and update
/frontend/config/wagmi.ts:projectId: 'YOUR_PROJECT_ID'Run Development Server
Open http://localhost:3000 in your browser.
📖 How to Use
For Users
Connect Wallet
Get Test Tokens
mint()directly if you deployedSupply Assets
Borrow Assets
Monitor Health Factor
Repay & Withdraw
🔑 Key Contract Functions
LendingPool
🛡️ Security Considerations
📚 Technology Stack
Smart Contracts
Frontend
🤝 Contributing
This is a hackathon project. Feel free to fork and improve!
📄 License
MIT License
🔗 Resources
Built with ❤️ for BNB Chain Cookbook Hackathon