Implementing an Asset Pool Smart Contract for a Crypto Loan
The asset pool smart contract is the most important component of the decentralized crypto loan system we are building in this book. Based on the architecture we discussed in Chapter 11, An Introduction to Crypto Loans, the asset pool smart contract builds on top of asset pool shares, pool configuration, and the price oracle. It maintains the information of all the asset pools for various ERC20 tokens in the crypto loan system, manages the user ledger for recording the loan-related information (e.g., collateral and borrowed assets) for each user, and provides the interfaces for frontend or other off-chain components to interact with the on-chain crypto loan system.
By reading this chapter, you will learn the following:
- How to implement the code to manage the asset pools for crypto loans
- How to manage the records in user ledgers with smart contract code
- How to implement the functions for users to interact...