Messari Mainnet Convos: Spot Margin Trading without Impermanent Loss through Primex Finance

2 Oct 2023 · 33:50

Recorded at Messari's Mainnet conference, Robbie Klages of The Rollup interviews the Primex Finance team about how the protocol offers spot margin trading without exposing users to impermanent loss. They cover Primex's brokerage model, which lets users borrow liquidity for undercollateralized leverage and routes trade execution through decentralized keepers, and how the protocol's composability lets that same capital keep working elsewhere in DeFi. The conversation frames Primex as an onchain prime broker built for mainstream order flow.

Topics

Transcript

foreign so you're enjoying the the conference so far yeah yeah I like it a lot yeah I love the interesting things happening people are talking about regulations and real world assets that uh I think it's the next big move yeah so we we spoke a little bit about the real world asset total addressable market and how it seems like it's the next big thing it is a massive unlock and there was uh there was a talk yesterday uh from Robert leschner yeah yeah what they do at Super state is really great yeah yeah I think uh with their experience after compound definitely uh they can

make this this change happen and um through this real world asset tokenization it's the crypto world that will give the value uh to their like often World by uh providing this programmability and uh yeah oh this is a really huge opportunity for the both sides yeah and and hopefully it can make uh certain assets that are kind of siled off chain right now like you know you don't see like there's real estate but you don't see it composable with other markets maybe uh yeah that's right there were some projects that tried to tokenize a real estate uh different parts of the

world for example in Dubai but it's not yet uh like really adopted and integrated with other um Unchained Solutions so yeah making it uh transferable between uh different chains and uh um to to allow this composibility is is important here not just tokenizing it that's it yeah tokenizing to become part of the assets freely circulated across different protocols yeah I think that's an important Point like we talk about tokenization of real world assets but it doesn't end there there's so much more that happens with the tokens after tokenization yeah maybe some adjustments will be needed to allow rwa

um freely transition across different protocols something like kyc and other uh like limitating approaches but it should not be fully permissioned I mean um we should never like go to the direction of a completely permission Chains It's not the right path but maybe creating some um kyc and uh verification mechanisms in public ledgers uh that will be required by the regulations for wa is definitely the the way to do it

and uh um what's happening now in uh chains in layer 2 is created by big Enterprises like what coinbase is doing with the base and also linear I think these ledgers will uh really adopt their wa uh yeah yeah the next run yeah I I think so too they have the relationships with some of the off-chain partners and banking partners that are currently custodying some of these real world assets um so they're they're in a great position to put those assets on Shane so let's talk a little bit more about primex yeah that's it yeah so actually

uh yeah I'm I'm glad that that co-founder of primex Finance uh it's Ram brokerage protocol uh that allows using a borrowed liquidity from lenders uh for different specific use cases without overculturalizing less liquidity because it never goes directly to the wallet of uh the boring party instead it's used for uh specific use cases and the first one that we implemented is for sport margin trading this means that uh the other role in our protocol is a Trader who can borrow These funds and open sport merging positions using existing taxes so we're

integrated with multiple taxes we wrote a trade um to these taxes in his Swap and some others so actually we have edex aggregate is part of the protocol but it's not that core thing and um the trader is paying a fee for using this liquidity the Lander is earning just like in The Lending protocol so for a lender you can say that it's a landing protocol uh without an impermanent loss risk like a liquidity provider in some other protocols because the funds that land up puts into the protocol is exactly what they can uh get back without a risk of uh

transfer between several of fonts in a box yeah so for a Trader we have now quite an advanced user interface we can say that it's a trade terminal with uh different uh capabilities very similar to normal centralized exchange with different order drives with the settings of stop loss take profit and of course with the leverage parameters right yeah and with cross margin that enables leverage currently it's um the isolated margin okay yeah we are we are considering to introduce cross margin a bit later currently it's isolated monitoring so this means that uh the trader can bring

uh their asset uh we support uh different combinations I mean uh they can bring uh for example I don't know wrapped uh BTC uh and then borrow uh use the C yeah uh and then buy ethereum so long uh open a long position on ethereum using this okay um that the trader brings uh is um also uh changed to uh to the asset of the position so in in the most simple example uh you can say that you said you can bring let's say 1 000 views to see their own borrow four thousand usdc from the protocol it's a 5x

beverage and then by let's say ethereum for this 5000 it's uh yeah it's a 5x sport margin position okay and after that it's actually the East that was purchased uh that is protecting the borrowed funds yeah because it's locked in the contract uh the trader cannot uh still in any way this funds the only thing that we can do uh the trader can do with this position is closing it uh with a profit I lost uh manually or uh a position can be closed automatically uh by stop loss to take profit settings of yeah it could be liquidated but all this happens uh

thanks to one more role in the protocol the keeper that are responsible for trade execution Trend execution is also decentralized so we don't have any back end responsible for doing this uh it's this keeper roll and an app at the same time that can be launched on any desktop machine we do also provide it uh so uh the keeper is incentivized because on each action like this uh they get a small profit so they get compensated for the guests see plus some some profit on top oh yeah that's it so there are three main rows uh lender Trader and keeper uh yeah we have a lot more other

um improvements to introduce into the protocol and maybe one of the most important is uh more like compatibility because currently it's just one use case for trading but these board fonts could be potentially used for a lot of other things like for example uh LPN into Unix 43 or in any other protocol that can potentially generate some some interest for this user and if this interest is higher than the fee that they have to pay in primex as a borrower then it's a potentially profitable Arbitrage yeah yeah yeah yeah that's right yeah and uh

yeah it's up to the user to use this in their trading or Market making strategy we just provide them or the instruments got it okay I think the most curious question that our audience would have because it Leverage is something that really under collateralized Leverage is something that has kind of escaped the industry for a long time if you look at maker Dao or some of these other protocols all of these systems remain solvent through over collateralization and then when a particular account becomes under collateralized then we have a network of Liquidators that will liquidate those positions and then uh

the the under collateralized position is erased so I think you you did touch on uh the mechanism between Keepers and Traders that allows for the under collateralization maybe you can specifically talk about how the protocol remains solvent even in the case of under collateralized positions yeah um great question thank you so um it's quite straightforward of course we do have this liquidation mechanism as in any uh protocol that that has any any type of risks yeah but based on a specific uh pair we have uh different uh settings for

the moment when we start liquidating so it's the smart contract that uh validates this action from a keeper who tries to liquidate position if this really should happen uh basically it's like a health factor in many other protocols that calculates uh how much of uh the collateral in a position is still present and if it's enough to buy back the borrowed asset so in my previous example uh it's quite simple the East that was bought uh in a simplified way you can say that as soon as we have just that enough of

eighth to buy back four thousand then of course we have to liquidate this position because it's the amount that was borrowed so we never really go um at least in the current implementation we never go below the and the collateralized use case the asset that was actually bought and now present in the position and the same with other use cases if we can see them for example uh news 43 yeah as uh as a place where the borax funds were moved uh it's uh the same thing just the

health Factor has to be calculated differently uh and uh when we see that the board's Bonsai risk we just revert this action so we take back the funds from unusual P3 to put them back into the collateral into into the market into the bucket uh from where it was taken okay so the difference um is that uh this uh mechanism of liquidation is um uh fully decentralized and uh um remains secure thanks to them uh how uh keepers are incentivized actually very similar

to what we have in Banker dog yeah it's the same approach uh and the difference is from some existing um non-custodian but still centralized merging trading solutions that have their liquidation engine uh in the centralized manner okay yeah so so in primex um I can bring 1 000 usdc and then borrow 4 000 usdc for example uh I can use that 4 000 to buy eth and then the 05 actually oh five okay okay uh this improves a bit the uh Capital inefficiency because if we uh keep the

collateral um unchanged uh this reduces the potential of buying yeah uh the buying power buying power but I I cannot withdraw 4 000 usdc never yeah right that's that's the difference so it's the difference from The Landing protocols yeah that's the reason why uh these four thousands are borrowed you never have to bring an equilateral in a different asset and with all the culturalization at least I don't know 150 percent uh yeah so um of course this makes a landing protocol unreasonable to use board funds to open any marketing positions there are other

great use cases for a landing vertical but not for for trading okay that makes sense okay Trader we can say that the value that we bring is it's actually Dax but with a lot of this additional capabilities are usually unavailable uh in a in a classic yeah and you know I I heard came from synthetics give a a talk about a combination almost like a hybrid model between centralized finance and decentralized finance and he he actually he that was his preface that was uh how he introduced a new product that they're launching um and and it the the model at primex

sounds like a very it sounds like a similar hybrid model because you have the decentralized functionality of a decentralized liquidator mechanism um and you are on chain uh which which uses decentralized settlement um but there is a form of I don't want to what what is the right term because I don't it's not centralized it's not custodial but I'm not able to withdraw um custodian uh actually it's um some kind of new defy primitive uh that we are going to extend to other use cases not just trading okay so the idea is allowing using board liquidity

for specific scenarios and uh weekend uh abstract this use case in a way that let's say there is something in between uh the the boring step and the final uh let's say collateral that returns to the smart contract and it could be uh like a black box in between uh in the next versions we're going to implement this approach as well so we um cannot even care what happens in between something like in a um fresh loan but it's persistent it doesn't end in one transaction yeah and if in the end of this uh

chain of steps there is something that returns into the protocol into the spa contract that is enough to uh collateralize the original borrowed amount then we can accept such um such a let's say position yeah and uh and allow it okay and this way we can even allow other users other even protocols to integrate with us when we implement this feature uh so they can actually uh put between these two steps something that will be potentially profitable in there

protocol and we won't even care so yes something like a smart contract in between I like the the mental model of uh a procedure of transactions where as long as you have the origination and the uh at the end destination uh as long as those two transactions are met in sequence you can allow this very like fertile very like creative Middle Ground exactly yeah yeah it's all happening in one transaction but in multiple let's say smart contract calls uh and uh yeah or some other smart contracts could be introduced in between yeah the only

thing that we care is what we get uh as the final step is enough for us to culturalize that the depth I'd like maybe to briefly also describe what we did related to security of course we had uh audits not just smart contract audits but um more integral review of the whole infrastructure including front-end and also the settings the final settings that we put in the contracts uh when we deploy them because it's a very important thing uh auditing just the the code isn't enough to make users secure because

usually the difference is in the actual values and we asked uh two of our auditors to do this final review of the settings when we really deploy we're going to deploy in in October finally uh first in polygon and then to our bedroom and some other Indian chains after that so this review of settings will validate that everything is is finally correct because Yeah the code depends on the values of course right okay uh what else so we had audits with um uh one stamp album and resonance uh they're all great but maybe I'd like to add some words about resonance

they're quite new that we like to load the approach uh they try to see not just one thing not just smart contracts but also the whole picture uh yeah and uh they audit uh uh front-end uh different backend infrastructure if it's present in a protocol or Cloud infrastructure everything and they do it really in a very tail view oh yeah what else about security we are using hypernative to monitor uh some critical State changes in the context very important thing yeah one question I do have um I think because it is a unique

solution um some people might be wondering like how do you enforce the the return of debt um because if I borrow U.S if I borrow some margin um even if I keep it within the protocol um there has to be some mechanism that Returns the debt to the lender yeah yeah definitely so uh actually uh this works um in a way very similar to a landing protocol while this depth is active a position is active of course the borrowing part is the trader has to pay for this uh funding rate yeah yeah

it's um of course in um Parts in derivative margin trading protocols it's usually called the funding rate in our case it's a bit different because yeah it can never be like negative it's it's always positive the trader is paying uh for the borrowed funds because they're locked in in this position yeah so this is actually a difference um and uh if we imagine even uh such a situation that the price uh of a pair never changes at all like it's they're still paying funding

they're still paying and at some point uh the collateral that is present in this position uh will end because it's used to it's calculated uh to uh to compensate the fee okay and the position will be liquidated but of course it will take I don't know years because of course this funding rate is quite small yeah yeah makes sense okay so the the collateral that the user deposits pays the funding rate and then and then they can retain the the debt as long as they like as long as they have some collateral yeah and there are also um different possibilities to uh change

the position including uh the leveraging it so adding some collateral uh so yeah like like uh you know normal exchange there are different parameters that can be changed in an existing position awesome okay that makes that makes sense and then once that collateral runs out that's when the position is liquidated yeah yeah yeah okay and do they ever have like if I is there a maximum amount of credit that I can take from The Exchange uh it of course depends on the size of this uh shared pools that we call markets okay uh we're going to have multiple buckets and they will differentiate not only on the asset type

but also on different uh settings that are related to risk so for example we could have even two buckets of the same asset let's say usdc but in one uh this UCC is allowed to be borrowed for trading more stable pairs uh like I don't know 8th or ATC and another bucket uh for like more volatile higher risk assets yeah and these two buckets will have a different um

amounts of liquidity of course and different uh leverage settings and uh differentization ratio yeah so the idea is to give to both lenders and Traders with flexibility so the lender can select from multiple or create some kind of portfolio with different buckets each with a different interest rates uh but of course those that will have high interest rates are potentially like more risky of course yeah yeah because uh yeah if the protocol works correctly we never have a loss because the

position is liquidated in time but of course there is of some small probability that something really huge happens with a specific pad and it drops to zero just immediately yeah of course it may happen that uh for this now these positions are the keepers won't be able to liquidate them correctly so you have to be very careful with the the yeah uh uh the pairs exactly yeah but initially we're launching with uh the master stable uh assets and we are going to introduce a more risky uh assets later uh in

separate markets okay that's it yeah and you guys have a liquidity mining program coming up yeah yeah speaking about the launch uh we have two uh approaches uh first of all uh we already have the wrestle program uh it's quite active uh in in the um in the desk Nets that we have and the protocol is running in testnet for some time already uh the users that come now uh their their relationship for uh the connection between those who refer those who are invited uh is already recorded and it's recorded on chain so we cannot

manipulate it in any way and later uh the real activity when we launch the mainnet of the users uh different type of activities yeah if it's a Lander how much they land if it's a Trader what type of positions they they open and how long uh all this will be of course calculated to uh incentivize and compensate those who invited them this is the referral proper yep and that uh other early user programs they include uh this liquidity money thing uh it's quite important because we have uh we need to have liquidity in the buckets to launch this margin

capability so specifically while the market isn't yet active and the phones are not borrowed to generate a normal interest uh during this time uh the early lender the early liquidity provider has to be compensated uh for this period and uh yeah we um compensate in our early tokens that later will be transferable to to normal tokens so this compensation definitely will cover uh some kind of uh say um

lost that um they didn't use this fans to put in a let's say a lending product okay so at least this but definitely much more to incentivize that yeah so early stage liquidity providers are rewarded with uh tokens that will offset any any type of uh uh interest or earnings that they could have gotten from some other liquidity yeah and of course as soon as uh the bucket is launched it's uh uh the normal interest that becomes active as soon as uh the borrowing capability of course is allowed yeah is there Traders as well we have uh how to use a program

okay that incentivize them to use the protocol but open not just margin but even uh spot uh like 1X positions uh and uh yeah we'll calculate the the activity of the Traders as well to to after that reward them to reward them as well okay as we kind of well I have one one question as far as the liquidity mining program um is there a amount of liquidity that you will um once like a critical mass of liquidity that once you exceed that's when you will open up them exactly yeah yeah this is working exactly like this uh I don't

remember their real numbers for now because they're different for different buckets but yeah uh it's based on their uh popularity of a specific asset in a specific chain and we are using um information from uh DC dexes from Landing protocols for specific asset and a pair and based on this we set this minimal amount for each bucket uh to actually allow the borrowing capability because um you know critical situation if for example we launch a bucket uh from zero uh it will be very unstable the

utilization ratio will jump or back and forth all the times of course yeah we need some uh first amount here awesome yeah I think uh I think it's going to be a big Community push um uh to reach that that critical mass um and it makes sense because you're rewarding the early liquidity providers um so uh in theory the liquidity providers rush into the pool to earn the early rewards and then after it hits the certain level um then it will unlock uh the the funding rate uh from from the market we also try to protect a Beat from uh those who just try to chase this first rewards

and then visit PM so we have some small period of so-called like stabilization uh while the Boron capability is already allowed and the lenders start earning normal interest rate additionally to their early user Awards but during this civilization period they still cannot uh withdraw the original funds without losing their worth so if they withdraw they will lose this broad but it won't be uh really long because isn't it justice to make Traders start using the market yeah that goes to invest our

existing Community uh thank you there are really active currently on the desknet and in the telegram and Discord groups um I think maybe someone is ready a bit disappointed because unfortunately we developed this a bit longer than expected so yeah we're finally launching in October uh first uh in polygon than in our bedroom and other evm chains uh plant uh including ethereum Mann net uh there are some limitations related to the fee that uh the keeper has to pay um for the guest fee that they have to

pay uh so in um uh ethereum Minette uh the minimal position size will be a bit adjusted a little bit higher than in the cheaper Play Toes but it's still doable we have the values and it looks quite reasonable awesome I I think this has been great uh that's about all the questions I have if there's anything else that you'd like to add or uh tell the audience what uh they can do to get more involved and participate um yeah this has been a lot of fun so uh any any closing thoughts thank you uh yeah stay tuned we have uh different uh more capabilities planned on the roadmap not just for trading to do different Define composable uh guilt farming

things with uh with the board funds uh we'll deploy another chains uh we also plan to introduce uh cross chain rebalancing between these buckets that will improve a lot we try to make the user interface quite simple for all like normal people uh really I believe that it's an important thing to make the adoption happen a protocol should not be over complicated for a user it can be very like or difficult in their internals but it should be very simple for the user uh so uh for this uh we are also planning to uh integrate an on-ramp okay

uh thing to to make people easily uh top up with the fields yeah so yeah I really believe that we need to make device simple for for normal people yeah onboarding uh on-ramps and uh even account abstraction is is yeah we are expecting to um make some of this account abstraction uh like uh standards uh more more stable and uh we'll make this uh this integration upgrade uh to uh make it more flexible and secure for the users because a simple uh wallet uh that everyone is using today is quite scary I

see that a lot of quite crypto friendly people still use centralized exchanges just to store their crypto because defy uh storages over complicated for them so we need to make this change yeah agreed agreed awesome well it was uh it was great to meet and uh this was a very fun conversation thank you thank you