Address Registry

AddressRegistry.sol: A contract for managing contract addresses and whitelist state, enabling address storage, de-whitelisting, bulk whitelist updates, and verification of whitelist status for borrowe

Summary:

AddressRegistry.sol is a contract that stores addresses of other contracts and controls the whitelist state. It also provides the ability to de-whitelist contracts or tokens, which is an important security feature in case of vulnerabilities or forks.

Key Features:

  • Stores addresses of other contracts and controls whitelist state.

  • Supports de-whitelisting to prevent further borrowing with specific tokens or contracts.

  • Allows for updating whitelist states for multiple addresses at once.

  • Provides functions to check the whitelist status of borrowers and tokens.

  • Keeps track of registered lender vault addresses.

Key Functions:

  • initialize(): Initializes the AddressRegistry contract with the addresses of the lenderVaultFactory, borrowerGateway, and quoteHandler contracts.

  • setWhitelistState(): Sets the whitelist state for multiple addresses, allowing them to be whitelisted, compartmentalized, or not whitelisted.

  • setWhitelistedTokensForCompartment(): Whitelists or de-whitelists tokens for a given compartment.

  • setMysoTokenManager(): Updates the MYSO token manager address.

  • addLenderVault(): Registers a lender vault address in the AddressRegistry.

  • claimBorrowerWhitelistStatus(): Allows borrowers to claim their whitelist status until a specific time by providing a valid signature.

  • updateBorrowerWhitelist(): Updates the whitelist status for multiple borrowers.

  • isWhitelistedBorrower(): Checks if a borrower is currently whitelisted by a specific authority.

  • isWhitelistedCompartment(): Checks if a token is whitelisted for a given compartment.

  • registeredVaults(): Returns an array of registered lender vault addresses.

Libraries:

  • ECDSA: The contract imports the ECDSA library from the OpenZeppelin library for ECDSA signature verification.

Interfaces:

  • IAddressRegistry: The contract imports the IAddressRegistry interface, which defines the owner function that needs to be implemented by the AddressRegistry contract.

Inheritance:

  • Ownable: The contract inherits from the Ownable contract, which provides a modifier for owner-based access control.

Dependencies:

  • DataTypesPeerToPeer: The contract imports the DataTypesPeerToPeer contract to access the WhitelistState enum used for whitelist management.

  • Errors: The contract imports the Errors library, which provides custom error messages for different exceptional scenarios.

Last updated