Implementing the code to manage the asset pools
In Chapter 11, An Introduction to Crypto Loans we learned that the asset pool smart contract maintains multiple asset pools. In this section, we will explain how the AssetPool
smart contract manages these asset pools.
Pool status
We already know that an asset pool is a pool that holds an ERC20 token. The asset pool also has a life cycle. For example, the prices of some tokens may become very volatile or some tokens may be improper to be served as collaterals in a crypto loan. Therefore, we should have an approach to deactivate the assets for crypto loans. So, there could be several statuses for each asset pool that form the life cycle of the asset pool.
In the AssetPool
smart contract, we will introduce three statuses:
- Inactive: This means that the pool is initialized but inactive for the user to take any actions with this pool. The inactive status means the owner needs to safely configure the pool or shut down the pool...