The main components of the Atlendis protocol are the BorrowerPools and the Position smart contracts.
The BorrowerPools is the core component of the Atlendis protocol. It stores the state of each borrower's order book and updates it based on specific actions from lenders and borrowers. Order books are siloed from one another in terms of whitelisted borrowers and individual maturities. For instance, whitelisted borrower A will have a unique order book for each maturity of issued bonds. BorrowerPools is the interface to the borrower, where loans are taken out and repaid.
The Position smart contract is the interface to the lender. It is responsible for the bookkeeping of each individual position. A lender can place an order to buy a zero coupon bond at a given rate by depositing assets into the Position smart contract. The logic of an order is handled by the BorrowerPool smart contract which updates the order book state accordingly. Initially a deposit gets deposited with the underlying yield provider, until the respective borrower chooses to sell a bond into the given order. In a nutshell, the position acts as an interface to the lender and holds state to keep track of this individual position's composition.
The borrower can raise capital by selling zero coupon bonds by calling the relevant endpoint in the BorrowerPools contract. Unlike the lender, the borrower is a price taker i.e. they have the ability to set a rate at which to sell a given quantity of bonds. Borrowers can observe the order book composed of the bids set by the lenders and decide on a quantity of bonds to sell. Their sell offer will be matched by the optimal composition of bids for the required quantity.
The following smart contracts should generally not be interacted with directly, but are used throughout the Atlendis protocol via smart contract calls.
This contract is used to generate the SVG artwork for a position. The visuals are dynamically generated on-chain, and change depending on the parameters of the position, such as pool name, position id, amounts deposited and borrowed, etc.
Various libraries are also used throughout the Atlendis protocol:
- Types: all data structures types used in the platform
- Pool Logic: low level accounting logic to handle order book updates
- Errors: all errors used in the platform
- WadRayMath: math library used to make computations with ray or wad precision, used for fixed point arithmetics