# A quick update on DEVS ✨

By [Pawnshop Gnomies](https://paragraph.com/@pawnshop-gnomies) · 2021-12-20

---

### Overview

Gnomies are building the first NFT lending protocol to evaluate NFTs using AI and build derivatives around them.

The first version is a decentralized pawnshop for NFTs on Solana. The pawnshop should allow the user to borrow money (fungible tokens) against NFTs by estimating the value of the particular NFT. If the user is satisfied, he will be able to get a loan against the asset. After repaying the loan, the user will be able to get his NFT back and if the debt is not repaid, the protocol will sell the asset on secondary markets to gain a profit and avoid default.

At the moment we are launching MVP with a starting functionality, and with further updates, the team will increase the automation and introduce a range of services like derivative sales, NFT futures, or NFT leasing.

In this article, we would like to share the MVP protocol operations model.

### Architecture

In the first version of the protocol, we are going to divide the entire work into three blocks, which must communicate with each other through secure channels using digital signatures.

### Model

The first block is called a model. The main function is to accept NFTs from the user and issue loans with interest for a certain period. To do this, the model creates a vault with specified parameters e.g. counterparty wallet info, collateralized asset, loan terms, or the amount owed. This vault can only be redeemed by the user before the expiry date or can be redeemed by the protocol straight after.

The process of redeeming follows with next transactions:

*   Returning the loan amount plus terms
    
*   Return of NFT back to the user
    
*   Vault destruction
    

It is worth paying attention to important differences between the first MVP and the final version of the protocol:

*   Oracle - our controller
    
*   Oracle data source - magiceden.io API
    
*   Loan period - two weeks
    
*   Interest rate - fixed commission, no complicated calculations
    
*   Accepted collection - Pawnshop Gnomies
    

### Controller

The second block is called the controller. The main task of the controller is to provide data for the model and interact with the user.

The controller must collect data and update it real-time:

*   Floor prices - these are all published offers on verified collections
    
*   Sales - transactions activity and sales volume
    
*   The storage - we store all data in a DB on AWS
    

Thus, the controller must update the info about the approved NFT collections. In this version of MVP, we will be using the simplest way to determine the market price and the maximum loan amount - we find the floor price on the market, divide it by half, and put a small safety buffer.

In the full version of the protocol, the AI will determine the maximum amount of the loan. We have already researched the ability to predict prices for NFT and we are satisfied with the results, but at the beginning, the evaluation will be done simply to exclude any errors.

### View

The third block is the frontend development with the UI. The main task is to show the user the data from the model through the controller, also to initiate transactions after interaction with the model.

On the main page, the user will be able to see the collections we work with and learn about the offers or available loans. To estimate the amount of loan the protocol may issue, the user must connect a Solana compatible wallet e.g. Phantom.

![After clicking the green button the user will be able to enter the vault.](https://storage.googleapis.com/papyrus_images/a01fd257d63eb8f67c2e622452e50ec7cc4250529fb98736dd56051b1a269b82.png)

After clicking the green button the user will be able to enter the vault.

On the left the user will be able to check active loans and on the right observe the NFTs that are available for collateralization.

When the user clicks on the "get a loan" button, he will see:

*   Pledged item
    
*   Loan amount
    
*   Interest rate
    
*   Accept button
    

### Mechanics

In the first version of the protocol the on-chain part will be significantly simplified. It will consist of the following essential blocks:

*   oracle adaptor (current prices)
    
*   vault creation (borrowing against NFT)
    
*   vault liquidation (repaying or liquidating the loan)
    

### Oracle adaptor

Just after the first steps in Solana dev we understood that contract (program account) cannot interact with off-chain world (actually, not all the marketplaces we get prices from are on-chain & open source), so we have to build a “work around” instead of regular calling API method to fetch any price.

This is how MVP will be founded:

*   The back-end controller will fetch prices (real-time, off-chain)
    
*   Web view will ask the controller for the price valuation to initiate borrowing
    
*   The controller will sign the data package containing this data with its private key and send it to the View
    
*   The view will be able to read the data (and show it to the user) and if accepted send it to the contract (so the contract knows that the evaluation’s signed by the exact key - controller’s key)
    

### Vault creation

The web view will send a request to borrow against a specific NFT, Solana program account will check the identity of evaluation and if everything’s OK the vault will be created:

*   NFT stored in the vault
    
*   money sent to the user
    
*   additional data stored: timestamp, IDs
    

### Vault liquidation

There will be an option of liquidating any vault for both sides: user and protocol, hence these options will be different:

User will be able to close the vault anytime before it expires by repaying the loan:

*   the user gets his NFT
    
*   protocol gets the funds
    
*   vault destroys
    

The protocol will be able to raise liquidation only after the vault expires:

*   protocol gets NFT
    
*   vault destroys
    

![A basic scheme of the pawnshop lending protocol](https://storage.googleapis.com/papyrus_images/5a7dd254df49a0239d60c84134cfcc29a217b6c47a4658f96b152f2a1480b6a3.png)

A basic scheme of the pawnshop lending protocol

Hope you’ve enjoyed an article and can’t wait for our devnet MVP to be published! Spoiler: it will be running tmrw 😎

---

*Originally published on [Pawnshop Gnomies](https://paragraph.com/@pawnshop-gnomies/a-quick-update-on-devs)*
