Inspiration

DeFi creates a new paradigm that was unthinkable before in private credit markets: Liquidity; meaning that liquidity providers should have the option to withdraw at any time. Provided liquidity in a Credix pool is being lent out for a period of time. Liquidity providers get liquidity provider tokens (LP tokens) which represent their stake in the protocol. If all underlying capital is allocated, the LP token holders cannot redeem their LP tokens for the underlying asset.

At Credix, we came up with a liquidity system that allows us to:

  • keep yields high by not working with a buffer
  • allow liquidity providers to get in / out
  • prevent KYC’d liquidity providers to transfer LP tokens to non-KYC’d entities

Our solution is based upon the following principles:

  1. Permissioned order book per Credix pool
  2. Burning LP tokens
  3. Buy-in moments

What it does

Although 2 (burning LP tokens) and 3 (buy-in moments) are interesting mechanism that we’ll further explore in the near future, they’re out of scope for this hackathon. For this hackathon, we focus on “1. Permissioned order book per Credix pool”

A permissioned order book is set up for each Credix pool. It is similar to most order books in that it allows participants to place buy and sell orders, yet different in that:

  • it only allows entities that have passed Civic KYC/KYB, and thus have a valid Civic pass
  • entities should have a valid Credix pass (= pool-specific whitelisting)
  • LP token accounts are always frozen; only the Credix program can thaw them upon posting a sell order and freeze them again upon execution of a buy/sell order

How we built it

We’ve built 2 programs: the credix program and the credix-permissioned-market program:

credix program

This is a dummy program featuring limited functionality of the Credix protocol, it contains instructions to: initialize a market, deposit funds and get LP tokens, to create a Credix pass, and to update a Credix pass. Anyone can initiate these instructions (for the ease of demonstration). It also contains an instruction to freeze LP Tokens and thaw LP tokens. Only the signing-authority PDA of credix-permissioned-market program can invoke this freeze/thaw instruction. This way we make sure that no-one can thaw their LP tokens and transfer them to a public key that doesn't have a valid Credix pass or Civic pass.

credix-permissioned-market program

The credix permissioned market is a "permissioned market" on Serum via a proxy program. It is a regular serum market with the additional checks for a valid Civic- and Credix pass. Along with these checks it also sends an instruction to the credix program to thaw LP tokens before calling the dex instruction and freeze them again right after that.

We created this proxy program with the permissioned package. Along with the proxy instructions to the dex program it contains an instruction to create the signing-authority PDA.

Challenges we ran into

  • The credix permissioned market is a "permissioned market" on Serum via a proxy program. It is a regular serum market with the additional checks for a valid Civic- and Credix pass. Along with these checks it also sends an instruction to the credix program to thaw LP tokens before calling the dex instruction and freeze them again right after that.
  • limited documentation on how to work with permissioned markets

Accomplishments that we're proud of

  • coming up with a novel way to provide liquidity in private (credit) markets
  • be the first protocol ever to complete a fully permissioned transfer of assets (= Civic pass check, Credix pass check + FREEZING/THAWING of token accounts to prevent transfers to non-qualified participants)
  • deployed on devnet

What we learned

  • how Serum Core works; very interesting to see how data structures from the old-coding-world are implemented in the Solana programming model
  • how we can work with Serum’s permissioned markets and proxy programs

What's next for Credix | hyper-permissioned market

  • clean up the credix-permissioned-market code and tests
  • expand the test cases
  • write a Medium article on how to get started with permissioned markets + open source the dummy version to complement the article
  • integrate this solution in the Credix protocol as part of our novel liquidity provisioning system
  • Integrate a user-friendly UI into the Credix app. The submitted app as featured in the demo video was hacked together in a very short amount of time and is only used for this hackathon.

Built With

+ 37 more
Share this project:

Updates