Skip to content

[academy] Permissionless Lending Pool Deployment via a Factory in the lending protocol example #613

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
gitshreevatsa opened this issue Mar 20, 2025 · 7 comments · May be fixed by #634
Open
Assignees
Labels
academy good first issue Good for newcomers ODHack12 Tag for issues which are suitable for ODHack week

Comments

@gitshreevatsa
Copy link
Collaborator

Overview

The lending-protocol is an example repository built for educational purposes which showcases a lending protocol implementation on =nil; blockchain on the sole purpose of helping users understand how to work with cross shard communication protocols. For this example project, implement a factory contract system to enable permissionless deployment of lending pools that register with the global ledger, with proper role-based access control to maintain system security.

Background

The example lending protocol contracts are currently deployed across all four shards and uses a global ledger for tracking user deposits and communicate via the cross shard communication functions mentioned in Nil.sol. Currently, the example lending protocol has a single lending pool that communicates with the global ledger. The task, is the need to enable permissionless deployment of additional lending pools while maintaining security and proper registration with the global ledger. You can learn more about the lending protocol here - README)

Feature Requirements

Create a system that allows:

  1. Permissionless deployment of new lending pools through a factory contract
  2. Automatic registration of newly deployed pools with the global ledger
  3. Role-based access control to ensure only registered pools can interact with the global ledger

Technical Implementation Steps

  1. Create a factory contract for lending pool deployment:

    • Implement deployment function accessible to any user
    • Add configuration parameters for customizing lending pool properties like tokens traded on that pool
    • Setup automatic registration with global ledger upon successful deployment
  2. Modify global ledger contract to implement role-based access control:

    • Add registry of authorized lending pools
    • Implement registration function callable only by the factory
    • Update all sensitive functions to check caller authorization lke recordDeposit and recordLoan

Technical References

Acceptance Criteria

  • Users can deploy new lending pools through the factory contract
  • Newly deployed pools are automatically registered with the global ledger
  • Only registered pools can interact with the global ledger
  • Unregistered contracts cannot call protected global ledger functions
  • All existing functionality continues to work with the new architecture
@gitshreevatsa gitshreevatsa added academy good first issue Good for newcomers ODHack12 Tag for issues which are suitable for ODHack week labels Mar 20, 2025
@kelly-musk
Copy link

Can I work on this, please?

@JMSBPP
Copy link

JMSBPP commented Mar 20, 2025

Hey! I'd love to tackle this factory contract implementation for your lending protocol. I've worked extensively with factory patterns and RBAC systems in Solidity, so I can build this permissionless deployment system while ensuring proper security controls for the global ledger interactions.

@soyaya
Copy link

soyaya commented Mar 20, 2025

I am a Solidity developer with expertise in security and cross-shard smart contracts. My experience in smart contract security will help safeguard protocol integrity and prevent unauthorized interactions. Excited to contribute to enhancing the lending protocol on =nil; with scalable and secure solutions.

@melissacinta
Copy link

Hello gitshreevatsa,

I’d love to contribute to the lending-protocol example repository by implementing the factory contract system for permissionless lending pool deployment while ensuring security through role-based access control. Below is my structured approach to achieving this.

Implementation Plan
Day 1: Factory Contract Development

  • Design and implement a factory contract that allows users to deploy new lending pools.
  • Include configuration options (e.g., token selection, interest rates).
  • Ensure automatic registration of deployed pools with the global ledger.
  • Write Solidity unit tests for the deployment and registration process.

Day 2: Global Ledger Security Enhancements

  • Modify the global ledger contract to include a registry of authorized pools.
  • Implement a registration function callable only by the factory contract.
  • Secure sensitive functions (e.g., recordDeposit, recordLoan) with role-based access control to restrict unregistered contracts.
  • Conduct cross-shard communication tests to ensure deployed pools properly interact with the global ledger.
  • Deploy on a local test environment with all four shards.
  • Validate that unregistered pools are blocked from interacting with the ledger.
  • Ensure all existing functionality continues to work as expected.
  • Optimize contract gas efficiency and modularize the code for maintainability.
  • Submit a draft PR for review.

Relevant Experience

  • Solidity smart contract development with factory patterns for modular deployments.
  • Experience working with cross-shard communication in blockchain protocols.
  • Strong background in role-based access control (RBAC) and security best practices.
  • Prior contributions to DeFi lending protocols and multi-contract systems.

I’m ready to start immediately and ensure secure, permissionless expansion of lending pools while maintaining protocol integrity. Looking forward to your approval!

@KevinMomanyi
Copy link

Am Kevin Momanyi Web3 developer in smart contract development, decentralized applications, and blockchain security. I have skills in Cairo, and Starknet, with a deep understanding of ZK-rollups and on-chain game mechanics. Am thriving in building scalable, secure, and efficient blockchain solutions, leveraging technologies like Starknet.js, Dojo, and Rust for cutting-edge development. My background in security research gives me a strong edge in writing secure and optimized smart contracts, ensuring reliability and efficiency in Web3 ecosystems.I have read and understood what the project is all about and am looking forward to contribute in the required time framework. Your effort to assign me the issues will be highly appreciated, thanks.

@idea404
Copy link
Collaborator

idea404 commented Mar 21, 2025

Hey @KevinMomanyi thanks for indicating your interest in this issue. Happy to assign this issue to you. If you have any questions feel free to tag me, @0xAleksaOpacic or @gitshreevatsa in case of questions or reach us directly through our developer Telegram group which you can find here

@KevinMomanyi
Copy link

KevinMomanyi commented Mar 21, 2025 via email

@gitshreevatsa gitshreevatsa linked a pull request Mar 25, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
academy good first issue Good for newcomers ODHack12 Tag for issues which are suitable for ODHack week
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants