Lightency Documentation


  • Created: 6 December, 2022
  • Update: 9 Avril, 2023

If you have any questions that are beyond the scope of this documentation, file, Please feel free to email via the contact section .


Abstract

In this paper, we at Lightency introduce a ground-breaking implementation of bonding curves within smart contracts for our LTS token on the NEAR Protocol. Bonding curves, an essential tool in decentralized finance (DeFi), provide an algorithmic pricing mechanism that dynamically reacts to token supply, creating a decentralized and predictable marketplace and facilitating healthier liquidity management.
Despite their importance, current applications in the blockchain space often encounter limitations and challenges with transaction efficiency, secure integration with various protocols, and sustainable liquidity. To address these challenges, we leverage the unique capabilities of the NEAR Protocol to enhance transaction speed, flexibility,reduce costs, and increase security.
Our methodology includes a mathematical model of the bonding curve that adjusts the price of LTS tokens based on supply. The implemented algorithm within the smart contract manages token minting and burning according to the position on the curve, thereby creating a responsive, predictable pricing mechanism.

Introduction

DeFi aims to democratize finance by creating an open, accessible, and equal financial system for everyone, powered by blockchain technologies and smart contracts.
Lightency, recognizing the potential of DeFi, has taken the initiative to create LTS, a token on the NEAR Protocol. NEAR Protocol is a decentralized application platform designed to make apps usable on the web, with features that are crucial to the future of the decentralized web. NEAR focuses on providing the ideal developer experience with the best performance and predictability while retaining decentralization and security.
In the DeFi space, maintaining an optimal balance between token supply and demand is crucial. A solution that has been proposed and implemented with varying success across different protocols is the bonding curve model. A bonding curve is an algorithmic price-setting mechanism where the price of a token is determined based on its supply. The more tokens are in circulation, the higher their price, and vice versa. This mathematical relationship ensures predictability and responsiveness to market dynamics, supporting a healthier DeFi ecosystem.
In this paper, we present Lightency’s innovative solution to these challenges: a new implementation of a bonding curve for the LTS token on the NEAR Protocol. This solution aims to improve transaction speed, reduce costs, increase security, and ultimately, drive the further development of DeFi on NEAR. We describe our approach, including the mathematical model and the smart contract architecture, and share the results of our performance testing.

Problems

As the field of decentralized finance expands and matures, maintaining equilibrium between token supply and demand becomes an increasingly complex challenge. For a DeFi ecosystem to thrive, it requires a balance that promotes liquidity, ensures security, and fosters predictability. In this context, the bonding curve mechanism has emerged as a potential solution. However, effectively implementing a bonding curve within a blockchain protocol presents its own set of challenges:
  1. Integration with Different Protocols : Blockchain protocols have unique characteristics and constraints. A bonding curve solution that works well on one protocol may not be effective or even possible on another. An effective solution must be designed with the specific features of the protocol in mind.
  2. Smart Contract Programming : The smart contract that implements the bonding curve must be secure, efficient, and reliable. The contract is responsible for minting and burning tokens according to the bonding curve, and any vulnerabilities or inefficiencies in the contract could have significant consequences.
  3. Predictable and Fair Pricing Mechanism : The mathematical model of the bonding curve must ensure that the token price responds predictably and fairly to changes in supply. An unpredictable or unfair price could undermine trust in the system and disrupt the DeFi ecosystem.
  4. Maintaining Sustainable Liquidity : The bonding curve must manage token supply in a way that supports liquidity. If tokens become too scarce or too abundant, it could lead to price instability and hinder transactions.
These challenges present significant barriers to the implementation of bonding curves in the DeFi space. Overcoming these barriers requires innovative solutions that combine a deep understanding of token economics, expertise in smart contract programming, and a detailed knowledge of the specific blockchain protocol. In the case of Lightency's LTS token on the NEAR Protocol, we have developed such a solution.

Summary diagram

This picture describes the whole DeFi protocol of Lightency . This shows the importance of the bonding curve in the protocol . It is the core of it .

image


Token

The LTS token, developed by Lightency, is an integral part of our ecosystem and is designed to drive and facilitate decentralized finance activities on the NEAR Protocol.

I .Standard :

The LTS token follows the NEP-141 token standard, which is the NEAR Protocol's equivalent to the ERC-20 standard on Ethereum. NEP-141 is specifically designed to facilitate the interoperability of fungible tokens within the NEAR ecosystem, supporting a wide array of functionality such as transfers, allowance, and balance checks.

II .Token Features :

  1. Fungibility :
    Each LTS token is identical and interchangeable, a fundamental characteristic that enables its use as a medium of exchange within our decentralized finance platform.
  2. Scalability :
    Leveraging the high throughput and low transaction fees of the NEAR Protocol, the LTS token can support a high volume of transactions, making it a scalable solution for DeFi applications.
  3. Security :
    The LTS token smart contract adheres to the best practices in smart contract development and has undergone rigorous testing and auditing to ensure its robustness and security.
  4. Interoperability :
    As a NEP-141 token, the LTS token can interact with other contracts and tokens within the NEAR ecosystem, creating opportunities for various DeFi applications.

III .Token economics :

The supply of LTS tokens is managed through our innovative bonding curve implementation, which algorithmically determines the price of LTS tokens based on the current supply. When demand increases and more tokens are minted, the price rises according to the curve. Conversely, as tokens are burned and supply decreases, the price falls. This mechanism ensures a responsive and predictable pricing model, which is crucial to maintain a healthy and sustainable DeFi ecosystem.

Integration with other protocols

I .Interoperability Importance :

Interoperability allows for different blockchain protocols to communicate and transact with one another. This cross-protocol interaction creates a more connected and efficient blockchain ecosystem, allowing tokens and smart contracts on one blockchain to interact with those on another. For our LTS token on the NEAR Protocol, interoperability expands potential use cases and opens up interactions with a wider range of DeFi applications and services.

II .Aurora: EVM on NEAR :

A notable example of interoperability in action within our system is the integration with Aurora. Aurora is an Ethereum-compatible solution built on NEAR Protocol. It allows developers to deploy existing Ethereum dApps, or develop new ones, using familiar Ethereum tools but benefiting from NEAR's scalability and low transaction costs.

III .LTS Token and Aurora :

The LTS token, while native to the NEAR Protocol, is designed to be compatible with the Aurora EVM. This compatibility allows the LTS token to be utilized within the robust and mature Ethereum DeFi ecosystem, extending its usability beyond NEAR Protocol-based applications. It also enables Ethereum applications to leverage the innovative bonding curve implementation of the LTS token.

IV .Broad Ecosystem Engagement :

The integration with Aurora is part of our broader strategy to ensure the LTS token and our bonding curve implementation engage with a wide range of protocols and platforms. By maintaining high interoperability standards, we enable the LTS token to play an active role in various DeFi scenarios, enhancing its value and utility in the decentralized finance landscape.

Conception

Lightency token should be low in volatility, non-inflationary. The token price should grow proportionately with Lightency token utilities, which is directly related to the growth of the active users. The token bonding curve (BC) is an Aristotian[1] view of money, in the sense that each token issued is backed by a stable store of value (fiat or stablecoin). This ensures less information asymmetry and reduces the volatility of the asset. Creating a fixed supply with no underlying asset follows the Platonic Vision.

Mint situation :

image

Burn situation :

image


Smart contract architecture

First things first , here is the github link  
  1. Language and security :
    Our smart contract for the LTS token and its bonding curve is written in Rust, a language known for its performance and safety, especially regarding memory safety. We have taken extensive measures to ensure the security of the smart contract. This includes following best practices for Rust development, comprehensive testing, and external audits to verify the contract's safety and correctness.
  2. Structure and Functions:
    The smart contract acts as a custodian for the LTS token supply and the stablecoin treasury. Its primary responsibilities are to mint and burn LTS tokens and manage the treasury balance of stablecoins (USDT, USDC, USN).
  3. Structure and Functions:
    The smart contract acts as a custodian for the LTS token supply and the stablecoin treasury. Its primary responsibilities are to mint and burn LTS tokens and manage the treasury balance of stablecoins (USDT, USDC, USN).

    Mint :

    When a user buys LTS tokens with a cryptocurrency (NEAR, wrapped Bitcoin, etc.), the contract mints the corresponding number of LTS tokens based on the current rate defined by the bonding curve. The received cryptocurrency is immediately swapped to one of the stablecoins (USDT, USDC, USN) via a decentralized exchange. The stablecoin is then added to the treasury of the bonding curve. This will give the bonding curve to buy more LTS from the market in order to burn it for preventing price hyper-inflation. To ensure accurate token pricing, especially when interacting with volatile tokens like NEAR or wrapped Bitcoin, our contract utilizes a NEAR oracle to retrieve real-time market prices.

    Burn :

    When a user sells LTS tokens, the contract burns the corresponding amount of LTS tokens and sends the user an equivalent value of stablecoins from the treasury. The contract selects the stablecoin that is most abundant in the treasury, maintaining a balanced distribution of stablecoins.
  4. Bonding Curve Implementation :
    The smart contract implements a bonding curve that algorithmically adjusts the price of LTS tokens based on supply. When the contract mints new LTS tokens (increasing the supply), the bonding curve raises the price. Conversely, when the contract burns LTS tokens (decreasing the supply), the bonding curve lowers the price.
  5. Treasury Management :
    The contract's treasury holds stablecoins acquired from LTS token sales. An algorithm ensures the treasury maintains a balanced distribution of different stablecoins. When a user sells LTS tokens, the contract automatically selects the stablecoin that is most abundant in the treasury to compensate the user, thereby keeping the treasury's stablecoin distribution balanced.
  6. Near oracle :
    The use of a price oracle to get real-time prices when dealing with volatile tokens is a crucial part of maintaining the accuracy and fairness of your system, so it's definitely worth highlighting in this section.

Math model

Mathematical Model

The bonding curve implemented in the smart contract utilizes a mathematical model that governs the relationship between token supply and price. This model ensures the responsive and predictable pricing mechanism of the LTS token.

Mathematical Formula/Algorithm:

image

Parameters and Variables:

x :

Responsive Pricing Dynamics:


Curve

Bonding curve :

image


Diagrams & Flowcharts


Lightency platforms :