Secondary on-chain market for Ajna lenders
Request
Recieving Address: (0xe5351029EDB4C1Ee048e76fC1D423d007e3f4008
)
AJNA Amount: (800,000
)
Applicant and Team Information
Applicant Name: @kfedoseev
Email: ajna@kfedoseev.com
About you and/or the team: Smart contract engineer, blockchain security researcher. Currently at Blockscout, ex-Ajna auditor, ex-zkBob, ex-xDai dev team.
Additional Links: x.com
Project Information
What is it?
A more efficient, permissionless and trustless secondary on-chain market for Ajna lenders based. See Project details below for more details.
What problem is being solved, how?
Inefficiencies in the primary market for Ajna lenders for entering and exiting their positions. See Project details below for more details.
How will this project be a source of growth or success for Ajna? Please include a step-by-step summary of how you imagine the completed project will affect Ajna.
Project enables an additional way for lenders to enter/exit Ajna positions at a potentially better rate, with better gas usage, without any time restrictions.
What is/are the objective(s)?
Build and launch a first version of the above mentioned protocol.
What is/are the deliverable(s)?
- Smart contract source code
- Single audit report for a smart contract from an independent third-party
- Deployment addresses on all Ajna-supported networks
- Basic off-chain backend for tracking & discovering submitted orders
- Basic UI for submitting, discovering and filling orders
What is the timeline for completing the deliverables?
2 months since the grant approval.
What level of support do you anticipate needing through the duration of the project?
Guidance for integration with existing Ajna frontends & periphery contracts.
How often will progress reports be published to the forum?
At least once a month, depending on the progress.
What are the estimated costs associated with the full completion of this project?
Development & audit costs are estimated to be 15,000 USD
. Any excess of the grant will be used to pay for the hosting fees of the required off-chain infrastructure.
If applicable, How will the project be maintained after completion of the grant?
Happy to accept any community contributions and feature requests. Hosting is expected to be covered via small in-protocol fees. Separate V2 development and deployment will require an additional grant.
Additional Information
How will you handle a delay in your project timeline?
Timely inform community on the forum about the delay, its cause and further action plan.
How will you handle a scenario where the project can’t be completed due to insufficient funding or other factors?
Partially deliver what’s completed, seek for community help with further action plan.
How will you handle a scenario where the project is completed, but significantly under-budget?
Any excess of the grant will be spent on hosting fees or post-deployment maintenance of the protocol.
Project details
Problem
Ajna lenders have permissionless access to the primary lending market through existing summer.fi and ajnafi.com, however there are certain nuances for it:
- Any new lender deposit is subject to deposit fees (8h of current borrow rate).
- Withdrawals can be unavailable due to ongoing liquidations, high utilization or long periods of rate inefficiencies. Time has also shown that prolonged periods (of few days) of near 100% utilization are very likely to happen and somewhat unavoidable due to how Ajna is designed.
- This has been flagged as a big issue for lenders on Discord numerous times
- Unavailability of withdraws for lenders increases the risk of forced liquidations, which are counterproductive for both: lender (since they act as a kicker and will lose some of their bond) and borrower (liquidation penalties are no fun)
- Deposits and withdrawals on Ethereum Mainnet are very gas intensive and can be too expensive for regular users during periods of high gas demand.
Solution
Create a secondary trustless & permissionless market for Ajna lenders (i.e. their LPB - Liquidity Provider Balances), which does not have the above restrictions. Idea is inspired by the existing gasless limit order systems for ERC20 tokens (1inch, CowSwap) and Pendle PT tokens.
Example
Alice is a lender in the WETH / USDC Ajna pool and has an LPB position in one of the buckets for 1000 USDC.
Current borrowing rate is 5%, although the demand for borrowing stables has skyrocketed and the pool is fully utilized at the moment. All borrowers are willing to pay up to 15% to borrow USDC against their WETH, so it will take at least 6 full days to bump the interest rate from 5% to 15% with regular interest bumps every 12 hours. So the pool is very likely to stay at 100% utilization for at least 6 days.
Alice has a sudden off-chain emergency, that requires her to withdraw 1000 USDC from Ajna as soon as possible. However, as the primary market for LPB withdrawals is unavailable due to 100% utilization, thus Alice goes to the secondary market.
Alice creates a sell order for her locked LPB worth 1000 USDC on the secondary market, similar to creating regular limit order for ERC20 tokens on supporting platforms. Order has a fixed price of 0.99 USDC per 1 LPB USDC, meaning that Alice is willing to redeem her full LPB for 990 USDC.
On the other side of the secondary market, Bob is actively looking for lending opportunities for his 990 USDC. Bob considers depositing them into Ajna WETH / USDC pool, but only once it’s borrowing rate reaches a market rate of 15% in 6 days. Bob monitors the secondary Ajna market as well and sees Alice’s order and finds it profitable for himself, by doing the following math:
Bob’s reasoning | Scenario 1 (primary market) | Scenario 2 (secondary market) |
---|---|---|
Initial capital | 990 USDC | 990 USDC |
Deposit date | in 6 days | today |
Capital after deposit | 989.86 USDC | 1000 USDC |
Capital after 6 days | 989.86 USDC | 1001.64 USDC (avg Ajna APR of 10%) |
Effective APR for 6 days | ~15% (market rate ouside of Ajna) | ~71% (11.64 / 990 / (6 / 365)) |
Gas costs | 500,000 gas | 300,000 gas |
Bob decides to act immediately and fill Alice’s order by converting his 990 USDC into 1000 LPB USDC through the secondary market.
Alice receives her 990 USDC and uses them to resolve her off-chain emergency.
Proposal
Build and launch a secondary market for Ajna LPBs consisting of the following components:
- On-chain smart contract for fulfilling orders
- Off-chain API for submitting & discovering orders
- Simple UI for submitting & filling orders
The following features are currently planned:
- Gas-less order creation authorized by ECDSA signatures for EOA wallets
- Support for Summer.fi positions (likely not in the gas-less format though)
- Support for partial order filling
- Cheaper order creation and filling than the respective primary market deposits and withdrawals
- Integration docs for third-party UIs and smart contracts
Associated implementation costs:
- Smart contract development
- Smart contract audit through 1 third-party auditor
- Smart contract deployment fees
- UI development
- Backend development
- UI & Backend hosting fees (first 3 months)
Current grant is supposed to cover all of the above costs. Hosting fees after first 3 months will be covered by on-chain protocol fees (i.e. 10% of taker’s profit, 1 USDC for the above Alice-Bob example) or through a subsequent grant proposal.
Alternatives
Ajna has an existing approach for tokenizing LPB positions via NFTs through the dedicated position manager smart contract. Conceptually, such tokenized positions could also be used as a secondary market. However, due to its non gas-less nature, missing tooling support, higher execution costs (NFT creation, LPB memoization, NFT marketplace listing, NFT marketplace fees) and known frontrunning issues, it not considered feasible to do so.