- Contract: β Implemented with FungibleToken Standard
- Tests: β 100% Passing (22/22 tests)
- Coverage: β 89.7%
- Documentation: β Complete
- Standards: β FungibleToken & DeFi Actions Compatible
- FlowVault Removal: β Complete (Ready for FlowVaults Integration)
- β Smart Contract Integration: FlowCreditMarket provides sink/source interfaces for token swapping
- β Development & Testing: Automated testing framework for FlowCreditMarket and DefiActions
- β Repository Structure: FlowCreditMarket code in private repo, DefiActions in public repo
- π Test Coverage: Working towards comprehensive test suite for FlowVaults functionality
- π AMM Integration: Currently using dummy swapper, real AMM deployment planned
- β Documentation: First pass documentation of FlowCreditMarket (this README)
- β Testing: Extensive test suite for FlowCreditMarket and DefiActions
- π Sample Code: DefiActions sample code and tutorials needed
- π Advanced Features: Per-user limits and controlled testing capabilities
- β Open Access: Full public access to FlowCreditMarket and DefiActions
- π Documentation: Improved documentation and tutorials
- β Sample Code: Complete tutorials for DefiActions integration
FlowCreditMarket is a decentralized lending and borrowing protocol built on the Flow blockchain. It implements the Flow FungibleToken standard and integrates with DeFi Actions for composability.
- FungibleToken Standard: Full compatibility with Flow wallets and DEXs
- DeFi Actions Integration: Composable with other DeFi protocols via Sink/Source interfaces
- Vault Operations: Secure deposit and withdraw functionality
- Position Management: Create and manage lending/borrowing positions
- Interest Mechanics: Compound interest calculations with configurable rates
- Health Monitoring: Real-time position health calculations and overdraft protection
- Access Control: Secure entitlement-based access with proper authorization
- Token Agnostic: Supports any FungibleToken.Vault implementation (FlowVault removed)
- Implements
FungibleToken.Vaultinterface for standard token operations - Provides
DeFiActions.SinkandDeFiActions.Sourcefor DeFi composability - Uses scaled balance tracking for efficient interest accrual
- Supports multiple positions per pool with independent tracking
- Includes comprehensive metadata views for wallet integration
The project includes comprehensive tests covering all functionality:
# Run all tests with coverage
flow test --cover
# Run specific test file
flow test cadence/tests/core_vault_test.cdc- Core Vault Operations: β 3/3 passing
- Interest Mechanics: β 6/6 passing
- Position Health: β 3/3 passing
- Token State Management: β 3/3 passing
- Reserve Management: β 3/3 passing
- Access Control: β 2/2 passing
- Edge Cases: β 3/3 passing
- Simple Import: β 2/2 passing
Total: 22/22 tests passing with 89.7% code coverage
For detailed test status and FlowVault removal summary, see TestingCompletionSummary.md
- Flow CLI installed
- Visual Studio Code with Cadence extension
- Clone the repository:
git clone https://github.com/your-username/FlowCreditMarket.git
cd FlowCreditMarket- Install dependencies:
flow dependencies install- Run tests:
flow test --cover- Start the Flow emulator:
flow emulator --start- Deploy the contracts:
flow project deploy --network=emulatorFlowCreditMarket/
βββ cadence/
β βββ contracts/
β β βββ FlowCreditMarket.cdc # Main lending protocol contract
β βββ tests/
β β βββ test_helpers.cdc # Shared test utilities
β β βββ core_vault_test.cdc # Vault operation tests
β β βββ interest_mechanics_test.cdc # Interest calculation tests
β β βββ ... # Other test files
β βββ transactions/ # Transaction templates (coming soon)
β βββ scripts/ # Query scripts (coming soon)
βββ FlowActions/
β βββ cadence/contracts/interfaces/
β βββ DeFiActions.cdc # DeFi Actions interface
βββ imports/ # Flow standard contracts
βββ flow.json # Flow configuration
βββ README.md # This file
- Pool: Main lending pool managing positions and reserves
- Position: User positions tracking deposits and borrows
- TokenState: Per-token state including interest indices
- FlowCreditMarketSink/Source: DeFi Actions integration for composability
FungibleToken.Vault: Standard token operationsViewResolver: Metadata views for walletsBurner.Burnable: Token burning capabilityDeFiActions.Sink/Source: DeFi protocol composability
// Create a new pool with your token type
let pool <- FlowCreditMarket.createPool(
defaultToken: Type<@YourToken.Vault>(),
defaultTokenThreshold: 0.8
)
// Create a position
let positionId = pool.createPosition()
// Deposit funds
let vault <- YourToken.mintTokens(amount: 100.0)
pool.deposit(pid: positionId, funds: <-vault)# Run all tests
flow test --cover
# Run specific test category
flow test cadence/tests/interest_mechanics_test.cdc- Testing Completion Summary - Latest test results and FlowVault removal
- Tests Overview - Comprehensive test blueprint
- Intensive Test Analysis - Security testing results
- Cadence Testing Best Practices - Testing guidelines
- FlowVaults Integration Milestones - Integration phases
- Future Features - Upcoming development
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License.
Tests are being updated for the new contract implementation and will be added in the next PR.