Skip to content

Commit

Permalink
CollateralRegistry overview
Browse files Browse the repository at this point in the history
  • Loading branch information
uprotocore committed Nov 29, 2023
1 parent 232abbb commit 183cfd6
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions doc/dev/CollateralRegistry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# CollateralRegistry Smart Contract Overview

The `CollateralRegistry` smart contract is designed for managing approved collateral assets in the Unit Protocol. It enables the tracking and modification of collateral assets within the protocol.

## Key Components and Features

### 1. Inheritance
- Inherits from the `Auth` contract for permissions and access control.

### 2. Events
- **CollateralAdded**: Emitted when a new collateral asset is added to the registry.
- **CollateralRemoved**: Emitted when a collateral asset is removed from the registry.

### 3. State Variables
- **collateralId**: Maps an asset address to its identifier.
- **collateralList**: An array storing addresses of the collateral assets.

### 4. Constructor
- Initializes the contract with a list of collateral assets, adding them to the `collateralList` and assigning identifiers in `collateralId`.

### 5. Collateral Management Functions
- **addCollateral**: Adds a new asset to the collateral list, ensuring the asset isn't already listed and the address is valid.
- **removeCollateral**: Removes an existing asset from the collateral list, after confirming its presence.

### 6. Utility Functions
- **isCollateral**: Determines if an address is a listed collateral asset.
- **collaterals**: Returns the complete list of collateral assets.
- **collateralsCount**: Provides the total number of collateral assets in the list.

## Purpose and Use Case

The `CollateralRegistry` contract is essential in the Unit Protocol ecosystem for several reasons:

1. **Risk Management**: Maintains a list of vetted assets that are permissible as collateral, aiding in risk control.
2. **Protocol Governance**: Allows protocol to adjust the collateral asset list in response to market dynamics or governance decisions.
3. **User Transparency**: Offers users clear information on permissible collateral assets, enhancing trust and clarity.
4. **Efficiency and Flexibility**: Streamlines the process of updating the list of collateral assets, ensuring the protocol's adaptability to market changes.

In essence, `CollateralRegistry` is crucial for maintaining the collateral system's integrity and adaptability within the Unit Protocol, ensuring that the protocol stays responsive to asset value fluctuations and market trends.

0 comments on commit 183cfd6

Please sign in to comment.