A decentralized credit protocol built on Aptos blockchain using the Move programming language. The protocol enables overcollateralized lending with USDC, featuring a reputation-based credit system.
| Contract | Address |
|---|---|
| Protocol (All Modules) | 0x636df8ee3f59dfe7d17ff23d3d072b13c38db48740ac18c27f558e6e26165172 |
| Admin | 0xceb67803c3af67e2031e319f021e693ead697dda75e59a7b85a7e75a1cda4d78 |
| USDC Token (Metadata) | 0xbae207659db88bea0cbead6da0ed00aac12edcdda169e591cd41c94180b46f3b |
- Contract: View on Explorer
- Deployment Tx: View Transaction
All modules are deployed under the protocol address. Access them using:
0x636df8ee3f59dfe7d17ff23d3d072b13c38db48740ac18c27f558e6e26165172::credit_manager
0x636df8ee3f59dfe7d17ff23d3d072b13c38db48740ac18c27f558e6e26165172::lending_pool
0x636df8ee3f59dfe7d17ff23d3d072b13c38db48740ac18c27f558e6e26165172::collateral_vault
0x636df8ee3f59dfe7d17ff23d3d072b13c38db48740ac18c27f558e6e26165172::reputation_manager
0x636df8ee3f59dfe7d17ff23d3d072b13c38db48740ac18c27f558e6e26165172::interest_rate_model
| Module | Transaction Hash |
|---|---|
| interest_rate_model | 0xf16be1090c4911d457a8aff5d0082e7a2e6d38b440fd3cc840e1652cf59beae3 |
| reputation_manager | 0x8e09d15a0ba458fc24ac6776695fe0a008d63dc896231118e5a3d2f048e705b2 |
| lending_pool | 0xe18de65db63dcd58d155161e22552a35902be761c5bc78be13178d1ea6caafdb |
| collateral_vault | 0xbbb998bbc3f7ec3f31155b5ec8dc7d3f0242161bd212ea9ae875a11b616eda2a |
| credit_manager | 0x625455aa42404cbe14bb7de99badc3b10667d200cc833791221c9f06e5e30cf8 |
The protocol consists of 5 main modules:
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ Interest Rate │ │ Reputation │ │ Collateral │
│ Model │ │ Manager │ │ Vault │
└─────────────────┘ └──────────────────┘ └─────────────────┘
│ │ │
└───────────────────────┼───────────────────────┘
│
┌─────────────────────┐
│ Credit Manager │
│ (Orchestrator) │
└─────────────────────┘
│
┌─────────────────────┐
│ Lending Pool │
│ (Liquidity) │
└─────────────────────┘
- Core orchestration layer for the protocol
- Manages credit line creation and lifecycle
- Handles borrowing, repayment, and liquidation logic
- Integrates with all other modules
- Manages credit limit increases based on reputation
- Manages liquidity deposits and withdrawals from lenders
- Handles borrowing and repayment flows
- Distributes interest to lenders proportionally
- Collects protocol fees (10% of interest)
- Tracks utilization rates
- Manages borrower collateral deposits
- Handles collateral locking/unlocking
- Supports liquidation mechanisms
- Configurable collateralization ratio (default 150%)
- Liquidation threshold (default 120%)
- Tracks borrower credit scores (0-1000)
- Records on-time vs late payments
- Manages reputation tiers (Bronze, Silver, Gold, Platinum)
- Enables credit limit increases based on good behavior
- Manages interest rate calculations
- Default fixed rate: 15% APR
- Configurable grace period (default 30 days)
- Supports both fixed and dynamic rate models
The protocol uses the Aptos Fungible Asset Standard with support for Dispatchable Tokens. This enables compatibility with:
- Native USDC on Aptos
- Any fungible asset following the Aptos FA standard
const PROTOCOL_ADDRESS = "0x636df8ee3f59dfe7d17ff23d3d072b13c38db48740ac18c27f558e6e26165172";
const ADMIN_ADDRESS = "0xceb67803c3af67e2031e319f021e693ead697dda75e59a7b85a7e75a1cda4d78";
const USDC_METADATA = "0xbae207659db88bea0cbead6da0ed00aac12edcdda169e591cd41c94180b46f3b";aptos move run \
--function-id 0x636df8ee3f59dfe7d17ff23d3d072b13c38db48740ac18c27f558e6e26165172::lending_pool::deposit \
--args address:0xceb67803c3af67e2031e319f021e693ead697dda75e59a7b85a7e75a1cda4d78 u64:<amount_in_micro_usdc>aptos move run \
--function-id 0x636df8ee3f59dfe7d17ff23d3d072b13c38db48740ac18c27f558e6e26165172::lending_pool::withdraw \
--args address:0xceb67803c3af67e2031e319f021e693ead697dda75e59a7b85a7e75a1cda4d78 u64:<amount_in_micro_usdc>aptos move view \
--function-id 0x636df8ee3f59dfe7d17ff23d3d072b13c38db48740ac18c27f558e6e26165172::lending_pool::get_lender_info \
--args address:0xceb67803c3af67e2031e319f021e693ead697dda75e59a7b85a7e75a1cda4d78 address:<lender_address>aptos move run \
--function-id 0x636df8ee3f59dfe7d17ff23d3d072b13c38db48740ac18c27f558e6e26165172::credit_manager::open_credit_line \
--args address:0xceb67803c3af67e2031e319f021e693ead697dda75e59a7b85a7e75a1cda4d78 u64:<collateral_amount>aptos move run \
--function-id 0x636df8ee3f59dfe7d17ff23d3d072b13c38db48740ac18c27f558e6e26165172::credit_manager::add_collateral \
--args address:0xceb67803c3af67e2031e319f021e693ead697dda75e59a7b85a7e75a1cda4d78 u64:<amount>aptos move run \
--function-id 0x636df8ee3f59dfe7d17ff23d3d072b13c38db48740ac18c27f558e6e26165172::credit_manager::borrow \
--args address:0xceb67803c3af67e2031e319f021e693ead697dda75e59a7b85a7e75a1cda4d78 u64:<amount>aptos move run \
--function-id 0x636df8ee3f59dfe7d17ff23d3d072b13c38db48740ac18c27f558e6e26165172::credit_manager::borrow_and_pay \
--args address:0xceb67803c3af67e2031e319f021e693ead697dda75e59a7b85a7e75a1cda4d78 address:<recipient> u64:<amount>aptos move run \
--function-id 0x636df8ee3f59dfe7d17ff23d3d072b13c38db48740ac18c27f558e6e26165172::credit_manager::repay \
--args address:0xceb67803c3af67e2031e319f021e693ead697dda75e59a7b85a7e75a1cda4d78 u64:<principal_amount> u64:<interest_amount>aptos move run \
--function-id 0x636df8ee3f59dfe7d17ff23d3d072b13c38db48740ac18c27f558e6e26165172::credit_manager::withdraw_collateral \
--args address:0xceb67803c3af67e2031e319f021e693ead697dda75e59a7b85a7e75a1cda4d78 u64:<amount>aptos move view \
--function-id 0x636df8ee3f59dfe7d17ff23d3d072b13c38db48740ac18c27f558e6e26165172::credit_manager::get_credit_info \
--args address:0xceb67803c3af67e2031e319f021e693ead697dda75e59a7b85a7e75a1cda4d78 address:<borrower_address>Returns: (collateral_deposited, credit_limit, borrowed_amount, interest_accrued, total_debt, repayment_due_date, is_active)
| Function | Returns |
|---|---|
get_available_liquidity(pool_addr) |
Available USDC for borrowing |
get_utilization_rate(pool_addr) |
Pool utilization in basis points |
get_total_deposited(pool_addr) |
Total deposits |
get_total_borrowed(pool_addr) |
Total borrowed |
get_lender_info(pool_addr, lender) |
(deposited, earned_interest, timestamp) |
| Function | Returns |
|---|---|
get_credit_info(manager_addr, borrower) |
Full credit line details |
get_repayment_history(manager_addr, borrower) |
(on_time, late, total_repaid) |
check_credit_increase_eligibility(manager_addr, borrower) |
(eligible, new_limit) |
| Function | Returns |
|---|---|
get_reputation_score(manager_addr, user) |
Score (0-1000) |
get_reputation_tier(manager_addr, user) |
Tier (0-3) |
| Function | Returns |
|---|---|
get_collateral_balance(vault_addr, user) |
Collateral amount |
get_user_collateral(vault_addr, user) |
(amount, locked, available, status) |
| Parameter | Default Value |
|---|---|
| Base Rate | 15% APR (1500 basis points) |
| Max Rate | 20% APR |
| Penalty Rate | 30% APR |
| Grace Period | 30 days |
| Parameter | Default Value |
|---|---|
| Fixed Interest Rate | 15% APR |
| Reputation Threshold | 750 (for credit increase) |
| Credit Increase Multiplier | 120% |
| Min Collateral | 1 USDC |
| Min Borrow | 0.1 USDC |
| Parameter | Default Value |
|---|---|
| Collateralization Ratio | 150% |
| Liquidation Threshold | 120% |
| Max Collateral | 1,000,000 USDC |
| Parameter | Default Value |
|---|---|
| Protocol Fee | 10% of interest |
| Min Deposit | 1 USDC |
The protocol emits events for all major actions:
CreditOpenedEvent- Credit line openedBorrowedEvent- Funds borrowedDirectPaymentEvent- Borrow and pay to recipientRepaidEvent- Loan repaidLiquidatedEvent- Position liquidatedCreditLimitIncreasedEvent- Credit limit increasedCollateralAddedEvent- Collateral addedCollateralWithdrawnEvent- Collateral withdrawn
DepositEvent- Funds depositedWithdrawEvent- Funds withdrawnBorrowEvent- Funds borrowedRepayEvent- Loan repaid
ReputationInitializedEvent- User reputation initializedReputationUpdatedEvent- Score updatedTierChangedEvent- Tier changed
- Move Resource Model: Prevents reentrancy and ensures asset safety
- Two-Step Admin Transfer: Secure admin ownership changes
- Pausable Modules: Emergency stop functionality
- Access Control: Role-based permissions
- Parameter Validation: Comprehensive input validation
- Overflow Protection: Move's built-in safe math
# Pause
aptos move run --function-id <module>::pause --args address:<module_addr>
# Unpause
aptos move run --function-id <module>::unpause --args address:<module_addr># Step 1: Initiate transfer
aptos move run --function-id <module>::transfer_admin --args address:<module_addr> address:<new_admin>
# Step 2: New admin accepts
aptos move run --function-id <module>::accept_admin --args address:<module_addr># Update credit manager parameters
aptos move run \
--function-id 0x636df8ee3f59dfe7d17ff23d3d072b13c38db48740ac18c27f558e6e26165172::credit_manager::update_parameters \
--args address:<manager_addr> u256:<interest_rate> u256:<reputation_threshold> u256:<credit_multiplier>aptos move compileaptos move test# Set address to "_" in Move.toml first
aptos move deploy-object --address-name credit_protocol- Metadata Address:
0xbae207659db88bea0cbead6da0ed00aac12edcdda169e591cd41c94180b46f3b - Decimals: 6
- Standard: Aptos Fungible Asset (with Dispatchable hooks)
- Metadata Address:
0x69091fbab5f7d635ee7ac5098cf0c1efbe31d68fec0f2cd565e8d168daf52832
USDC has 6 decimals:
- 1 USDC = 1,000,000 (micro USDC)
- 0.1 USDC = 100,000
- 0.01 USDC = 10,000
MIT License
For questions or issues, please open an issue in this repository.