Skip to content

Launching Pilgrim

Pilgrim allows for novel market constructions that completely eliminates the requirement for manual liquidity management, resulting in CLOB-like liquidity efficiencies on an AMM-based market for new asset types.

This post was taken from Pilgrim Protocol's medium article.

Today, we are proud to officially unveil Pilgrim Protocol to the world.

Pilgrim enables something that no other financial primitive in existence could have ever done: continuous valuation of nonfungible assets without time-consuming auctions or fractionalization.

In other terms: price curves and trading for every NFT without providing liquidity. Just. Like. Magic.

I would like to thank everyone who worked tirelessly over the past 6 months to make this day possible: Taem, CEO at Test in Prod who have led the team and was the only one who got his hands dirty; Tei, who literally was in charge of development of most of our codebase — including the core smart contracts, indexers on The Graph, and our frontend; Changwan, who wrote our Valuation Mechanism Paper and ran rigorous internal mechanism & security audits of our smart contracts; Diane, who designed everything visible, from user experience flow to icons and interfaces (credits to her for our beautiful Pilgrim logo!); and of course, our anon superhero devs who do not wish to be named for obvious reasons.

Everyone at Nonce Classic have done a fantastic job at building a vibrant community even before we launched, and we are fairly confident on them to continue doing so now that Pilgrim is actually out there in the wild. See here for a full list of stakeholders and contributors in the Pilgrim DAO.

Last but not least, if you have found Pilgrim interesting, do not hesitate to contribute or contact us directly over Email, Telegram, or Discord! Help us build the next generation of market-based on-chain valuation — the Pilgrims shall greet you with love. 😍

How it started

8 months ago, on July 23rd, 2021, a weird idea struck me in the shower.

Back then, I was working for Terra, playing with a couple of interesting financial primitives after designing some components of Anchor Protocol starting a year prior. After leaving the Anchor team, I wanted to work on impactful things, one of them being decentralized funding.

That led me to working with Pylon, with its demand-based virtual AMM model and funding based on Anchor yield redirection. Unfortunately fundraising protocols that gives tokens in return had a significant problem: market volatility.

People technically were not losing money as Anchor yield was paying back for their token positions. Things started getting rough quickly when the launched token was listed on AMMs: initial liquidity was limited, causing valuation to severely fluctuate, which meant a lot of investors who went in early were being rekt.

It became obvious to me that fundraising based on tokens were not sustainable.

One potential solution to this, I thought, was deliberately limiting liquidity for investors at a fixed rate so that they would never be valuated based on market liquidity, similar to how equity funding rounds for startups work. A problem with this approach was that this time, there is no centralized entity or investment lead that determines how much this percentage of shares is worth.

To address this problem, I came up with a reverse money market model that recursively determines value based on a governance-set LTV, of which FDV of liquid assets equals portion of deposited shares set by the LTV parameter; the protocol would then either mint an ERC-20 token or contract state that represents stake in this reverse loan position. Represented collateral was deliberately set as an NFT for liquidity and valuation control.

…What’s interesting about those internal deposit positions is that they are effectively holding an ETF and/or partially collateralized synthetic asset composed of: (future NFT valuation) + (borrowed coins), of which TVL is equivalent to (borrowed coins) * (1 + 1 / LTV). When LTV is over liquidation threshold TVL would instantly become zero, and therefore this must satisfy POSITION_VALUATION > (borrowed coins) * (1 + 1 / LIQ_LTV), unless a liquidation event is triggered by sharesholders. This blocks NFT valuation arbitrage and oracle attacks in cases when the NFT itself is tokenized & available for trading on open markets, as liquid assets are already available with the position itself.

The issue with this approach, though, was that liquidations were not elegant; because LTV was governance-set, there is no clear way to trigger liquidations in cases of bankruptcy other than to initiate a governance vote among shareholders.

Unless LTV was also dynamically set by market demand, this was not going to work.

While going through this, I was also looking at how existing DeFi Lego blocks, especially money markets, were approaching NFTs. A friend of mine won 1st Prize at Cosmos HackAtom HCMC with a Cosmos SDK-based money market that supports NFTs, of which is collateral auction-based. Aave was looking at NFTs as potential collateral, also based on a fixed-rate exchange contract with floor prices as its price oracle.

None of those were solving the problem I was after.

I started ranting at a Telegram room (in Korean) about some of the potential solutions I was looking at, especially regarding the borrowers’ valuation arbitrage attack problem that may arise with NFT-based money markets:

of which the conclusion being — minting shares of a borrow position for an NFT would solve valuation arbitrage.

The fundamental problem was still there, however: NFTs are very illiquid assets, and valuation was still going to be affected anyways regardless of how we try to address this at the money market level. We needed to tackle liquidity before we start talking about valuation and its potential applications.

This was on my mind for three weeks until one day, after coming back from work at night and in the shower, I came up with an idea that seemed simple enough.

Why don’t we combine that reverse money market model with a virtual AMM, such that the value of the borrow position would increase as people deposit more money, and vice versa?

At this thought, I wrote up this Notion document of how such a system might look like, and this super rough diagram:

…and did not give much thought to it for another two months. I did, however, write down how margin trading could potentially be implemented with this mechanism, and gave it a name: Pilgrim Protocol.

A month later, I left Terra and started this super weird organization called Test in Prod with Taem and Tei — we pitched ourselves as DAO builders that works on infrastructure for building universes. After fiddling around with a few ideas for a month at this amazing co-working space & hackerhouse in Seoul (of which I am still a resident) I pitched them this idea of an NFT valuation market that I abandoned two months ago.

They bought it, and decided to give it a try.

After working on Pilgrim for a month, however, we quickly ran into problems with my original design.

For one, it turned out that implementing liquidity borrowing features against an NFT that also features a virtual price curve is mindbogglingly complex without issues with its liquidations queue.

Another problem was with the AMM itself: impermanent loss rekt us yet again, except that this time, as liquidity provision equals trading, any combination of trades with size x and y always resulted in protocol losses compared with a single trade of size x + y.

Eventually the team ended up deviating significantly from my original design and implemented a novel AMM curve that generalizes all trade sizes as multiples of a constant unit, as well as a token model for partial exposure to locked liquidity without implementing direct borrows.

The team spent more than half a year iterating upon our AMM curve, trading algorithm, and smart contract logic — and only now, we believe, Pilgrim is ready to face chainId == 1 for the first time.

The world has a liquidity problem

If Pilgrim was only about trading and speculating on NFTs, we probably would not have built it. We are looking to solve something much more fundamental: the liquidity problem with on-chain financial primitives.

Liquidity is crucial because under free market assumptions, it inherently affects valuation. Under a central limit order book (CLOB) model, managing liquidity is relatively trivial — more trading activity means more liquidity locked, because limit orders equate to liquidity provision on an orderbook. Locking liquidity with a submitted market order makes sense in terms of incentives, as you are speculating and taking a financial position even before it gets matched with counterparties.

With automated market makers (AMMs), however, the trading protocol requires constant liquidity locked. This is because all trades must have a counterparty in order to be executed; as onchain transactions are always linear, the AMM must always hold equivalent liquidity in order to execute a single-side swap trade. In other words, the AMM acts as a constantly available trading counterparty, resulting in liquidity inefficiencies.

Because AMM-based market constructions cannot form valuation without locking sufficient liquidity, there must exist a mechanism to incentivize users to lock liquidity with the AMM. Uniswap relied on liquidity fees being accumulated to liquidity providers; however, incentives from trading fees were not enough to give value to an asset that previously did not exist.

The immediate answer to this problem was, of course, liquidity mining — first implemented by Synthetix and made popular by Yearn. Sushi’s liquidity mining program proved to be destructive enough to “vampire attack” Uniswap, forcing them to launch their own token.

Liquidity mining and fair launch also proved to be not sustainable in the long run, however, mostly due to the something-for-nothing problem as described by Andre himself.

veCRV and OlympusDAO are two novel ways of maintaining liquidity incentives for long, the former giving vested stakeholders control over CRV emissions, and the latter using liquidity bonding as a mechanism for base collateral expansion — (3,3); of which both are equally ponzi schemes made to artificially reward liquidity that cannot be sufficiently rewarded by the market.

Our take is that liquidity mining is a solution for a problem that should not exist in the first place.

Any AMM construction must have liquidity locked left unused at any point in time, regardless of how much you tune its bonding curve. While Uniswap v3 has significantly improved upon capital efficiency by introducing a hybrid model between CLOBs and AMMs, it also have failed to sufficiently reward users for valuing novel types of assets.

Pilgrim allows for novel market constructions that completely eliminates the requirement for manual liquidity management, resulting in CLOB-like liquidity efficiencies on an AMM-based market for new asset types.

Liquidity available should be in proportion to market demand and trading activity, not decoupled from actual market interest based on unsustainable yield. This is what we eventually aim to solve with Pilgrim, and is a goal we will be pursuing for years to come.

Closing Thoughts

Pilgrim is a highly experimental protocol; none of the design intentions we have listed above may be realized in production.

What we are confident on, however, is that Pilgrim will eventually become a core building block for use cases even we could not have imagined.

Some of our expectations for potential applications of Pilgrim are as follows:

Of course, we need your help to unlock the full potential of what Pilgrim can do — regardless of whether you are a normal community member, a builder, or a DeFi architect.

Join us with our Pilgrimage!

— Daniel & the Pilgrim Team