Skip to content

refactor: reimplement contract logic for protocol update#1

Merged
FabianSanchezD merged 18 commits into
mainfrom
feat/protocol-update
Jan 3, 2026
Merged

refactor: reimplement contract logic for protocol update#1
FabianSanchezD merged 18 commits into
mainfrom
feat/protocol-update

Conversation

@FabianSanchezD

Copy link
Copy Markdown
Contributor

This pull request introduces the foundational configuration contract and documentation for the Kleo Protocol, a decentralized lending system built with Ink! v6 for the Polkadot ecosystem. The main changes include a comprehensive new README.md that documents the protocol's architecture and contract responsibilities, the implementation of the config contract with admin-controlled protocol parameters, and the initial setup for the lending_pool contract with dependencies. These changes lay the groundwork for the protocol's modular smart contract system and provide clear guidance for further development.

Documentation and Protocol Overview:

  • Major rewrite and expansion of README.md to describe the Kleo Protocol's architecture, contract roles, deployment order, and user flows for lenders, borrowers, and vouchers. The documentation also details error handling and provides build instructions for each contract.

Config Contract Implementation:

  • Added the new config contract (config/lib.rs) that manages all protocol parameters (interest rates, reputation requirements, cooldowns, exposure caps, etc.) with admin-only setters and public getters. Includes error handling for unauthorized access and establishes default values for all parameters.
  • Updated config/Cargo.toml (renamed from loan_manager/config/Cargo.toml) to reflect correct author information and project structure.

Lending Pool Setup:

  • Added initial lending_pool/Cargo.toml with dependencies on Ink! and the new config contract, setting up the project for further development of the lending pool logic.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request implements a major refactor of the Kleo Protocol, transitioning from a simple trust-graph-based lending system to a comprehensive reputation-based, community-vouched lending protocol. The changes introduce a modular smart contract architecture with five interconnected contracts built using Ink! v6 for the Polkadot ecosystem.

Key changes:

  • Implementation of a reputation system with star-based credit scoring to track user creditworthiness
  • Introduction of a social vouching mechanism where users stake reputation and capital to guarantee borrowers
  • Creation of an automated liquidity pool with dynamic interest rates based on utilization and borrower reputation
  • Comprehensive documentation of the protocol architecture, user flows, and deployment procedures

Reviewed changes

Copilot reviewed 15 out of 17 changed files in this pull request and generated 23 comments.

Show a summary per file
File Description
config/lib.rs New foundational contract managing protocol parameters with admin-controlled setters and public getters
config/Cargo.toml Package configuration for the config contract with updated author information
config/.gitignore Standard Rust/Cargo ignore patterns for build artifacts
reputation/lib.rs New contract implementing star-based reputation system with staking, slashing, and history tracking
reputation/Cargo.toml Package configuration updating from "trust_graph" to "reputation" with config dependency
reputation/.gitignore Standard ignore patterns for the reputation contract
vouch/lib.rs New contract managing social guarantee relationships between vouchers and borrowers
vouch/Cargo.toml Package configuration with dependencies on config, reputation, and lending_pool contracts
vouch/.gitignore Standard ignore patterns for the vouch contract
lending_pool/lib.rs New contract implementing liquidity pool with two-slope interest rate model and automatic accruals
lending_pool/Cargo.toml Package configuration with config contract dependency
lending_pool/.gitignore Standard ignore patterns for the lending pool contract
loan_manager/lib.rs Major refactor from multi-lender microloans to single-pool undercollateralized loans with reputation requirements
loan_manager/Cargo.toml Updated dependencies replacing trust_graph with reputation, lending_pool, and vouch contracts
loan_manager/trust_graph/lib.rs Removed legacy trust graph contract (242 lines deleted)
loan_manager/config/lib.rs Removed old config contract implementation (164 lines deleted)
README.md Comprehensive documentation rewrite covering protocol architecture, contracts, user flows, and deployment
Comments suppressed due to low confidence (2)

config/Cargo.toml:5

  • The edition field is set to "2024", which is not a valid Rust edition. Valid Rust editions are "2015", "2018", "2021", or potentially "2024" if it has been released since the knowledge cutoff. However, as of January 2025, Rust edition 2024 has not been officially released. This should likely be "2021".
    reputation/Cargo.toml:5
  • The edition field is set to "2024", which is not a valid Rust edition. Valid Rust editions are "2015", "2018", "2021", or potentially "2024" if it has been released since the knowledge cutoff. However, as of January 2025, Rust edition 2024 has not been officially released. This should likely be "2021".

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread vouch/lib.rs
Comment thread vouch/lib.rs
Comment thread loan_manager/lib.rs Outdated
Comment thread vouch/lib.rs
Comment thread loan_manager/lib.rs Outdated
Comment thread loan_manager/lib.rs Outdated
Comment thread config/lib.rs
Comment thread lending_pool/lib.rs Outdated
Comment thread vouch/.gitignore
Comment thread lending_pool/lib.rs
@FabianSanchezD

Copy link
Copy Markdown
Contributor Author

@copilot review again

Copilot AI commented Jan 3, 2026

Copy link
Copy Markdown

@FabianSanchezD I've opened a new pull request, #2, to work on those changes. Once the pull request is ready, I'll request review from you.

@FabianSanchezD FabianSanchezD merged commit c63888d into main Jan 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants