Today, we are excited to open source PolyLend: a peer-to-peer lending protocol allowing users to borrow USDC against conditional token positions, the underlying share type supported by Polymarket. A key feature is that no price oracles are required. PolyLend is heavily inspired by Blend, a lending protocol which supports NFTs as collateral.
PolyLend facilitates fixed-interest rate USDC loans collateralized by conditional token positions. These loans are expected to be over-collateralized, i.e. the value of the conditional token position is worth more than the principal loan amount. The loans optionally have a minimum duration which helps protect the borrower from early termination. Additionally, there is a Dutch auction mechanism which allows loans to be transferred to a new lender at a potentially higher interest rate in case the loan is terminated.
The primary use case is for borrowers to achieve leverage in their conditional token positions, by re-entering the position with their borrowed USDC. However, borrowers are free to use the borrowed USDC for any other use. While we will not be implementing this feature in production, we hope that the community will find the concept and codebase useful and interesting!
This smart contract is unaudited and is provided as an experimental proof-of-concept. Bugs are likely to be present. If you find any, please don’t hesitate to reach out!
Discovery
Borrowers place on-chain requests for loans against a conditional token position, specifying the size and type of their position, and the minimum duration of the loan. Once a borrower places a loan request, lenders place on-chain offers for the loan, specifying a principal amount of USDC and continuous interest rate. Once a borrower receives an offer that fits their needs, they may accept the offer and initiate the loan: the USDC is transferred to the borrower, and the entire conditional tokens position is transferred to the protocol to be held in escrow until the termination of the loan. This whole process takes place completely on-chain, peer-to-peer, without any intermediary.
Loan Termination
Borrowers may repay their loan at any time; in this case, the principal amount plus accrued interest will be transferred from the borrower to the lender and the conditional token position released back to the borrower.
Once the minimum duration of the loan has elapsed, the lender is also able to call their loan: in this case, a 24-hour dutch auction commences where the loan is offered to new lenders at a linearly increasing interest rate: from 0%, the worst possible rate for the lender, to a specified maximum interest rate, the best possible rate for the lender. If a new lender is willing to take over the loan at the offered interest rate, they will purchase the loan, transferring the principal amount plus accrued interest to the original lender. A new loan is then initiated between the borrower and the new lender at the new interest rate.
The borrower is always able to pay back their loan before the end of the 24-hour period.
In case the borrower does not pay back their loan, and no new lender is willing to purchase the loan by the end of the 24-hour period, the lender can reclaim the collateral: the lender receives the full collateral amount, and the loan is terminated.
It is up to the lender to properly assess the risk associated with the loan, as it is always possible that the value of the collateral may fall below the actual value of the loan before the minimum duration has elapsed. In this case, the borrower will have no incentive to pay back their loan, and the borrower and lender both will take a loss.
Leverage
Borrowing against conditional tokens position allows borrowers to achieve leverage in a given market, i.e., using the USDC borrowed to re-enter their existing position. They are free to repeat this process multiple times effectively levering up their original position at no additional cost. So long as the value of their total position increases from the time of purchase to the time of sale, and the difference covers any interest accrued, they will achieve a profit higher than what they would have achieved with their original position alone. Of course, leveraged positions always come with risk, and if the value of the total position decreases during the lifetime of the loan, the borrower will take a loss and be forced to provide additional USDC to release their position.
Repository
The repository is provided with a comprehensive test suite, written with Foundry, a toolkit we use for all of our smart contract development here at Polymarket. The tests provide 100% coverage. Please take a look if you’re interested in how we write and structure our tests! You can find the repository here.