> For the complete documentation index, see [llms.txt](https://casten.gitbook.io/untitled/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://casten.gitbook.io/untitled/casten/protocol-smart-contracts/casten-protocol-contract-architecture.md).

# Casten Protocol Contract Architecture

As we continue research towards designing of our robust protocol infrastructure, this page gives a sneak peak into our initial design.

![](https://3379034831-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fq8hfXlTUePVtpKSSKTQB%2Fuploads%2FO2rnALq4ezsDizGih4t9%2FScreenshot%202022-04-24%20at%203.58.53%20PM.png?alt=media\&token=9010e35e-146c-4c08-af0d-98dc9310439b)

**Lender Contracts overview**

* New users on Casten protocol need be whitelisted by completing KYC. Each eligible investor is then added to a mapping list housed in Whitelist.sol. The whitelist contract also houses the user -> position mappings.&#x20;
* After a user is whitelisted, the user enters an epoch and places a supply order on the tranche.&#x20;
* The Epoch controller computes all the supply and redeem orders and executes orders accordingly.&#x20;
* The SeniorTranche pool behaves like a credit line to the borrower, with suppliers adding capital upto the pool limit, and borrowers accessing funds based on loan agreement terms, and collecting interest.&#x20;
* PoolReserve is a reserve pool which holds cash for supply and redeem orders.&#x20;
* PoolFactory is the factory contract which deployes new pools for a new or existing borrower, with pool terms like interest rate, maturity, loan amount as parameters.
* Auditor houses the logic for computing interst and penalties in case of delayed interest payments. It also contains the loan asset value calculations for the NAV feed.&#x20;
* NAV feed contract acts as an oracle for each pools senior and junior ERC20 tokens for composibilty and data utilities.&#x20;
