The Ajna Perpetual Market Maker

Ajna Perpetual Market Maker

Request

  • Receiving Address: (0xfccD8868e7dD9A060AA12c3c3e4287Ce0D9b41c6)
  • AJNA Amount: (730,818)
    • Allocated as follows:
      • Build-out and audit fee: 10% of the amount awarded
      • PMM Price Point 1: 1,000 AJNA per ETH
        • Long term perspective to build liquidity in a bull market or after substantial Ajna has been burned. Also, this creates a longer-lived Flash loan facility.
      • PMM Price Point 2: 20,000 AJNA per ETH
        • Short term provisioning of permanent liquidity as a proof of concept and to add market depth.

Note: This submission only requires a single funding transaction, which includes an inbuilt build-out fee for the mechanism, with the remainder going directly to the PMM at two price points, effectively setting two floor prices as described below and in the following whitepaper.

Applicant and Team Information

Project Information

1. What is it?
This governance submission proposes the Ajna Perpetual Market Maker (PMM), an immutable, no-ownership, market making mechanism.

2. What problem is being solved, how?

  • Price Volatility: Cryptocurrency markets are often characterized by high price volatility. By providing liquidity, the PMM mitigates sharp upward price spikes in times of low supply. This helps in stabilizing prices for participants to engage in auctions.
  • Price Stability: By locking away a portion of the supply in an immutable contract, the PMM can prevent large, destabilizing sell-offs, contributing to price stability when liquidity builds up around price floor levels.
  • Liquidity Shortages: Cryptocurrency markets, especially for newer or less mainstream tokens, can suffer from liquidity shortages. The PMM tackles this by scaling the system to potentially include multiple floor prices, enhancing overall liquidity.
  • Price Support Mechanisms: The PMM introduces a system akin to limit orders, where tokens become pooled and released only at a predetermined price. This serves as a price support mechanism, potentially preventing the price from falling below a certain level, acting like a soft-burn, by reducing the effective circulating supply.

This is an essential Ajna governance proposal, one that is good for Ajna token holders, and the only proposal that does not add sell pressure while still helping grow the ecosystem.

3. How will this project be a source of growth or success for Ajna?
In addition to the above solutions, this project will provide automated liquidity provision for the AJNA/WETH trading pair with a predefined immutable floor price. It will also incorporate the ERC3156 standard for flash loans, allowing for collateral-free borrowing of AJNA tokens. The flash loan capability includes a 0.01% flash loan fee that will accumulate even more AJNA tokens to the contract.

Please see the below whitepaper for a detailed description of the use cases and scenarios for how this is useful across a variety of scenarios.

4. What are the objectives?

  • Objective 1: Enable healthy markets by providing liquidity to prevent price spikes when supply is low, and to provide deep Ajna liquidity at a good price for auctions
  • Objective 2: Absorb outstanding supply and keep it in an immutable UniV2 contract
  • Objective 3: Scale over time to include multiple price points for increased liquidity and smoother market operations
  • Objective 4: Provide price stability by acting like a limit order for all Ajna holders where the token goes into a pool, equivalent to a soft-burn until a predetermined price point is reached.

5. What are the deliverables?
An immutable, no-ownership, market making Uniswap v2 smart contract

6. What is the timeline for completing the deliverables?
Immediately at the conclusion of governance voting

7. What level of support do you anticipate needing through the duration of the project?
Feedback on future PMM price points to provide subsequent, additional incremental liquidity. Delegates, community members and grant recipients giving refunds can send their AJNA directly to the distributor or the PMM of their choice to increase the liquidity that gets deployed.

8. How often will progress reports be published to the forum?
The smart contract is immutable and will be visible through a variety of existing on-chain DeFi dashboards.

9. What are the estimated costs associated with the full completion of this project?
This involves smart contract engineering and an internal audit. We estimate the work as equivalent to 10% of the Ajna amount awarded for the proposal. Through a tip function described below, the team also accrues a perpetually diminishing percentage of the deployed liquidity.

10. If applicable, How will the project be maintained after completion of the grant?
The project is immutable and will live on indefinitely but future grant cycles may deposit additional AJNA to an existing PMM.

Please review the following whitepaper and the scenario descriptions to learn how the Ajna PMM is designed to be an autonomous and immutable mechanism to grow and perpetuate the Ajna ecosystem with minimal governance overhead except the initial funding requirement.

Whitepaper: Perpetual Market Maker for AJNA/WETH on Uniswap V2 with ERC3156 Flash Loan Functionality

Abstract

In the evolving landscape of DeFi, the need for innovative liquidity solutions is paramount. This whitepaper introduces a smart contract Perpetual Market Maker (PMM) to facilitate trading on Uniswap V2 for the AJNA/WETH trading pair. This contract aims to automate liquidity provision, enhance market efficiency, stability, and provide novel financial opportunities for users to participate in the collateral auction system. It does this in an automated, trustless, and immutable manner.

Introduction

Traditional market-making strategies often require constant human oversight and adjustment. In contrast, the PMM smart contract automates these processes, offering a resilient and efficient approach to market-making on Uniswap V2, one of the leading decentralized exchanges.

Key Features

  1. Liquidity Provision: Automated liquidity provision for the AJNA/WETH trading pair with a predefined immutable floor price.
  2. Flash Loan Functionality: Incorporation of ERC3156 standard for flash loans, allowing for collateral-free borrowing of AJNA tokens.

Liquidity Provision

Floor Price Mechanism

The PMM deploys with a specified, immutable floor price, representing the minimum ETH (WETH) amount required to purchase one AJNA token. This floor price is critical in determining when the contract will actively participate in the market.

Market Participation

Once the floor price is met, the contract is designed to provide liquidity to the AJNA/WETH trading pair on Uniswap V2. It calculates the optimal amount of AJNA tokens to buy based on the reserves of the trading pair and the floor price. The purchased tokens are then used to mint liquidity pool (LP) tokens.

Flash Loan Functionality

ERC3156 Implementation

The PMM offers ERC3156 standard-based flash loans. Users can borrow AJNA tokens for a short period, under the condition of repaying the borrowed amount with a fee. This feature is useful in the instance that Ajna tokens are required for participation in Ajna protocol auctions.

Use Cases

For Liquidity Providers

The PMM contract automates the liquidity provision process, making it an attractive tool for liquidity providers looking to participate in the AJNA/WETH market on Uniswap V2 without the need for continuous management.

For Users Seeking Short-term Access to AJNA Tokens

The flash loan feature caters to users requiring temporary access to AJNA tokens without the need for collateral, opening up new strategies in trading and arbitrage.

Explanation as to how the PMM will work from Day 1

  1. At the outset, the PMM accepts the deposit of AJNA tokens from the Ajna grant fund, which in turn enables users to borrow these tokens through the standardized ERC-3156 process. These flash loans enable technically capable, but uncollateralized participants to borrow tokens, purchase collateral from an outstanding auction, and cycle the collateral back through Ajna to repay the loan. There is a minimal fee involved in this transaction which accrues to the contract balance, increasing the amount available for borrowing with each subsequent event. Since these tokens are owned by the PMM, this represents a “soft burn” of the AJNA token until the tokens are released in the second stage, described below.

  2. In the second stage, the Ajna tokens are distributed to the market when the price of Ajna reaches a defined threshold relative to ETH. This threshold is currently set at 1,000 Ajna per ETH and is an immutable value, currently designed to approximate 10% of the market value of Ethereum (assuming roughly 100,000,000 ETH supply and 1,000,000,000 AJNA supply). The PMM provides a permissionless buy() function which allows any market participant to initiate a sale of Ajna at or above the threshold price. The PMM performs this operation by inspecting the reserves of the Uniswap V2 AJNA/ETH pairing and selling Ajna to ETH above the threshold price, then re-depositing the ETH and AJNA to the V2 contract, establishing an LP position in the pair. This operation can be used to liquidate the underlying Ajna balance in whole or in part until the underlying balance is depleted. The minted LP position is then owned by the PMM in perpetuity, less the tip(), providing infinite range liquidity to the markets while allowing the market to determine the future price.

The Ajna PMM is designed to be an autonomous and immutable mechanism to grow and perpetuate the Ajna ecosystem with minimal governance overhead except the initial funding requirement.

Detailed Scenarios

Scenario A)

The price of Ajna never exceeds 1000 Ajna per ETH. The balance provided to the PMM is available as flash loan reserve, which enables technically inclined ecosystem participants to engage in collateral auctions at or near the market price of Ajna, democratizing the auction participation process and giving Ajna holders the best price in reserve auctions even in low-liquidity circumstances, such as when a large number of reserve auctions are happening in parallel or a large position is being liquidated. Since all Ajna acquired as a result of auctions is burned, this results in the optimal amount of Ajna being removed from the market.

Scenario B)

The market price of Ajna organically exceeds the threshold price. If the burn mechanism is effective at reducing the outstanding Ajna supply to the point where 1000 Ajna is naturally valued at more than 1 ETH, the PMM will methodically issue the underlying balance into the LP position and on to the market until the contract’s supply is exhausted. This has the effect of placing a temporary ceiling on the market price of Ajna at the threshold price of the PMM, but only until the underlying balance is depleted. As this balance is deposited into the Uniswap V2 pool in perpetuity, the price relative to ETH will then float with the market price and provide an infinite range of liquidity for ecosystem participants in the future. It should be noted that the Uniswap V2 pairing itself imposes a 0.3% fee on trades through the contract, which are accrued to and compound the value and holdings of the PMM-owned LP position.

Scenario C)

The Uniswap V2 pair price is manipulated above the threshold price. The PMM looks solely at the reserve balance of the Uniswap V2 pairing and not at the broader market price of the Ajna token. It is possible that the Uniswap V2 pairing can be manipulated to drive the price of Ajna in ETH above the threshold price in a single block, despite the prevalent market price being lower than the reserve balances would suggest. In this case, the buy() function is enabled, allowing the PMM to buy and mint LP tokens with its underlying Ajna reserves. The buy operation will buy ETH at a favorable price relative to the market and deposit that ETH and an equivalent amount of Ajna into the pool at this favorable ratio. When the market discovers the manipulation, arbitrageurs will find it advantageous to sell additional AJNA into the V2 pool to achieve market parity, thus drawing more Ajna from other sources into the PMM-owned LP position than would initially have been available if the PMM had been sold at current market ratio. This would technically result in some “impermanent loss” in ETH terms, however, since the PMM is solely concerned with making a one-sided buy into the pool with Ajna, this has the result of pulling more Ajna into its liquidity position than it would have initially been capable of. Thus, a market manipulation strategy could be seen as a favorable scenario for Ajna holders and the PMM’s objectives.

It might also be that rather than a true “manipulation”, a cascade of liquidations may temporarily and acutely sap external markets of on-chain liquidity. Rather than completing auctions at an unfavorable price due to an absence of liquidity, this mechanism allows for the release of AJNA tokens at at least the threshold price, providing the best value for Ajna holders by avoiding low-bid auctions from completing and allowing arbitrage to push Ajna back into the LP as liquidity flows back on-chain.

Scenario D)

The market price is above the threshold price and the PMM’s balance is depleted. A new PMM with a higher target price can be deployed and funded if governance wishes to continue to provide flash loan services. This will of course change the contract with which flash loan integrators will need to target, but by providing the threshold price as an immutable value it is possible to sidestep any governance process around rate modification, so Ajna governance can be sure that the terms of the contract will not change over time.

Considerations

Risk and Security

The contract’s effectiveness hinges on the accurate setting of the floor price and assumptions made in the flash loan fee calculation. Prior to deployment, comprehensive testing and auditing are crucial to ensure security and efficiency.

FAQ

  • Why Uniswap V2 (as opposed to Uniswap V3)?
    • The PMM is intended to provide a long-term and immutable source of Ajna liquidity and stability, and Uniswap V2 was chosen as the ideal DeFi primitive for this purpose. A minted UNIV2LP token is created and owned by the PMM contract after provisioning liquidity, which needs no further interaction to benefit the liquidity markets.
    • Uniswap V2 fees compound and accrue directly to the LP position, without additional required logic to harvest and redeposit trading fees.
    • Uniswap V2 provides infinite range liquidity by default, avoiding the need to determine or alter price buckets as market conditions change.
    • The Uniswap V2 pool exists and is seeing active trading though this is limited due to low liquidity and high price volatility in this pool. Despite this, this pool is currently identified and has been processing transactions from the Uniswap Router, 1inch, Cowswap, and other trading platforms. Uniswap Info
  • What benefits are obtained by allowing flash loans?
    • Market liquidity for Ajna is very low across all markets at this time. By enabling a pool of AJNA for flash loans, we allow reserve auctions to complete at the best possible price based on market conditions. Since all AJNA that is purchased in auctions is burned, this requires the flash borrower to extract AJNA from the market at the best price after recycling collateral, and gives AJNA holders the best possible outcome for these auctions.
  • How was the floor price determined prior to deployment?
    • Two Floor Price PMM’s are identified prior to the initial deployment. The values were determined based on a long-term strategic optimism and a shorter term tactical optimism of AJNA price relative to ETH.
      • The long-term option is intended to hold AJNA as a flash loan facility until market conditions permit it to deploy liquidity.
      • The short-term option is intended to target a lower price in order to deploy its liquidity at a price target that AJNA has already achieved, but without an immediate dump of liquidity on the market while increasing the market depth on a shorter horizon. This liquidity can be seen as a backstop on AJNA price based on its ETH reserves in the liquidity pool.
  • Where does the initial ETH come from to fund the LP?
    • The ETH used in the PMM comes directly from the Uniswap V2 when it can be purchased at or above the specified price threshold in AJNA. It then redeploys this ETH back into the LP.
  • Where does the Flash Loan fee go?
    • The flash loan includes a modest fee which accrues directly to the PMM’s internal AJNA balance. This AJNA is then locked until it is available to be deployed into the LP. Flash loan fees can therefore be thought of as a “soft burn” in the short term, and will enable the PMM to have a larger liquidity position when the tokens are issued back to the market.
  • What happens to the LP tokens when the PMM buys them?
    • The UNIV2LP ERC20 tokens are owned by the PMM after they are minted. A permissionless tip() function is included in the deployed PMM that allows the community to tip the developers a maximum of 1% of these LP tokens annually to the development team. This value is accrued over time and caps out at the annual rate if it is not utilized. Since the tip is based on the contract balance, the LP tokens can never be fully depleted from the contract.

Conclusion

The PMM presents a novel approach to DeFi market making for the Ajna token, combining automated liquidity provision with flexible flash loan capabilities. Its deployment on Uniswap V2 has the potential to enhance market liquidity and offer users innovative tools to advance the DeFi ecosystem.

7 Likes

Currently, this is the only proposal that reduces the outstanding supply of Ajna. It provides direct, verifiable value back to all Ajna holders.

As customers (Ajna holders), we should consider the following advantages the PMM has over alternate market making solutions:

  • The cost of this market making service is verifiable and transparent.
  • We know the price at which the Ajna liquidity will be deployed.
  • The PMM provides liquidity above a price threshold and, therefore, defends a price.
  • It supports Ajna auction liquidity.
  • It verifiably redistributes its profits back into the service we are hiring it for: market making.
  • The authors of the PMM are compensated proportionally to the utility they provide Ajna token holders (when the PMM contract LPs).
  • The advantages listed above cannot change based on will or circumstance of the developers or operators who have put forth this proposal due to the immutability of the code.
1 Like

The technical details of this proposal are as follows.

Grant funding is transferred to a distributor contract which is responsible for sending 10% of the deposit to Prototech Labs as the build-out fee.

Distributor 1: 0xfccD8868e7dD9A060AA12c3c3e4287Ce0D9b41c6

The remaining 90% of the proposal funding is sent to a second distributor contract which allocates 25% of the proposal to a PMM with a price target of 20,000 Ajna per ETH, and the remaining 75% to a PMM with a price target of 1,000 Ajna per ETH.

Distributor 2: 0x3e340ae9be6BED3c7bD641128e7fE2488394BF7a

The PMM contract code is on-chain and verifiable at the following addresses:

PMM (20,000): 0x7A85e146af25e9EF8De864c45A31CE685d41F338
PMM (1,000): 0x55F341E9eC422F8cf599ab24232E5896d61C73f4

All contracts are immutable, permissionless, verifiable, and purpose-built for Ajna token holders.

3 Likes

Please let me make you a better website

Does this contract get seeded with WETH? Where does the WETH come from?

It gets seeded with AJNA. At a certain strike price it gets put up as a limit sell order. Once that gets filled the contract gets the WETH.

What’s the latest update?

1 Like

Hi Doo, quick update to say that the funds have arrived in the contracts and are awaiting the market price to reach the target level for deployment. Until then they are available for flash loans and are non-circulating.

2 Likes

@Prototech_Labs @brianmcmichael

What price point is the current grant request being allocated towards?

@Prototech_Labs submitted the proposal to send 1,000,000 Ajna tokens directly to the existing 20kAjna/ETH PMM, available at 0x7A85e146af25e9EF8De864c45A31CE685d41F338

The tokens will stay in the PMM contract until the market can bear the threshold price.

1 Like