Crayon Protocol

 

Lending

Traditional DeFi lending protocols have tended to favor new participants in the lending pool at the expense of existing ones. When a new deposit is made, both the interest rate paid by the borrower and the share of the current participants in the pool decrease. With Crayon Protocol, borrowers pay a fee up-front that is fully credited to current participants. Future lenders will be paid from fees on loans taken after they made their deposit. Crayon Protocol makes it possible for lenders to reserve funds for future withdrawal if current liquidity does not allow it.

One-step Leveraged Dollar-Matched Pairs Trading

Traditional DeFi lending protocols expose borrowers to variable and unpredictable interest rates on their loans. PnL from certain leveraged trades can be highly dependent on the interest rate. In addition, some DeFi lending protocols require multiple transactions, sometimes across multiple platforms, for a leveraged position to be created. With Crayon Protocol, a leveraged, dollar-matched pairs trade expressing the view that certain tokens will outperform the base token (see below) can be created for a fixed fee in a single transaction. The transaction borrows funds, buys the desired (approved) tokens, and deposits them in the pool as collateral. It's similar to a traditional flashloan except that at the end of the transaction, instead of returning the borrowed funds, other tokens (from an approved list) can be deposited. Tokens deposited by borrowers are available for traditional flashloans allowing borrowers to earn additional fees.

One-step Asset Financing

Unlike trade leveraging, asset financing assumes the assets are already held by the borrower who wishes to obtain a loan. Crayon Protocol allows a more "repo-style" asset financing than traditional DeFi. Existing assets can be posted as collateral for a loan in some base token but, unlike traditional DeFi protocols, Crayon Protocol fixes the fee and the expiration date of the loan. This, again, allows for better cost predictions or PnL projections, depending on how the loan is used. Crayon Protocol allows posting the collateral and borrowing against it in a single transaction.

Flashloans

Crayon Protocol supports traditional flashloans of the base token (the token available for lending) and the tokens posted as collateral. Fees from flashloans of the base token are paid to lenders; fees from flashloans of another token are paid to users who posted that token as collateral. Smart contracts can flashloan up to the full amount of their own deposit or their own collateral for no fee.

Third-party Integrators

The Crayon Protocol team will not be hosting a front-end. Third parties are given incentives to integrate with Crayon. This applies to front-end providers and low-code smart contract solution providers. DEXes can also integrate with Crayon to source loans for leveraged trading on their platforms thereby increasing volume. DEXes that integrate with Crayon can also flashloan collateral posted by their users at no cost.

 

Architecture


Crayon Protocol is implemented in a cluster of smart contracts at the center of which are the Control and XCRAY smart contracts. Lending, trade leveraging and asset financing are done through a Desk.

Desks. Desks are the smart contracts that users interact with for lending and borrowing, be it for trade leveraging or asset financing. A Desk is characterized by:

  • The base token: The ERC20 token that can be borrowed and serves as the numeraire for all prices.
  • The longable tokens: The ERC20 tokens that are accepted as collateral and therefore the tokens that users can finance or have leveraged positions in.
  • The horizons: The lenghts in number of blocks that users can have loans for. At expiration, users can extend or repay the loan. A horizon of 5760 is roughly a day.
  • The loan fees: Different borrowing fees apply to the different horizons.
  • Flashloan fees: One flashloan fee applies to borrowing any of the longable tokens as well as the base token. Note that a smart contract can flashloan its own collateral or base token deposit for no fee.
  • The value to loan threshold: The minimum acceptable ratio for the value of the collateral to the amount of the loan. If the ratio drops below the threshold, then the loan is subject to liquidation.
  • The liquidation bonus: This is the discount applied when a liquidator is awarded collateral of the loan being liquidated.

Control. The Control smart contract currently receives snapshots of the positions of all users in all Crayon Protocol desks. The snapshots are used to calculate the amount of reward tokens a user (lender or borrower) has earned from using the platform, across all desks. The Control smart contract also sets fees and reward distribution rates on the various desks.

  • Users invoke the minting function of the Control contract to acquire their earned XCRAY tokens.

XCRAY. The (now) reward ERC20 token for lenders and borrowers and (future) governance token of the Crayon Protocol. Decentralized Crayon Protocol governance support is planned for 2023Q3 after which point holders of XCRAY will:

  • Decide the desks to deploy and their attributes.
  • Manage the borrowing and flashloan fees and liquidation bonuses on various desks on an on-going basis.
  • Manage the rates of distribution of XCRAY as rewards to lenders and borrowers on the various desks on an on-going basis.

 

Documentation