# ProxyWalletRegistry

The `ProxyWalletRegistry` manages the creation and administration of proxy wallets. This contract serves as a registry to associate owners with their respective proxy wallets and includes features to manage access and operational states.

#### Events

* **`LogAddToWhitelist`**:
  * Emitted when an address is added to the whitelist. Only in centralized mode.
  * Parameters:
    * `_user` (address indexed): The address added to the whitelist.
* **`LogRemoveFromWhitelist`**:
  * Emitted when an address is removed from the whitelist. Only in centralized mode.
  * Parameters:
    * `_user` (address indexed): The address removed from the whitelist.
* **`LogSetDecentralizedMode`**:
  * Emitted when the decentralized mode is toggled.
  * Parameters:
    * `newValue` (bool): The new state of the decentralized mode (true for enabled, false for disabled).
* **`LogProxyWalletCreation`**:
  * Emitted when a new proxy wallet is created and associated with an owner.
  * Parameters:
    * `owner` (address): The owner of the new proxy wallet.
    * `proxyWallet` (address): The address of the newly created proxy wallet.

#### State Variables

* **`proxies`** (mapping(address => ProxyWallet)):
  * Maps an owner's address to their corresponding proxy wallet.
* **`factory`** (ProxyWalletFactory):
  * The factory contract used for creating new proxy wallets.
* **`whitelisted`** (mapping(address => bool)):
  * Tracks whether addresses are whitelisted, which influences their ability to create proxy wallets. Only in centralized mode.
* **`bookKeeper`** (IBookKeeper):
  * Reference to the `BookKeeper` contract used for managing financial interactions within the system.
* **`isDecentralizedMode`** (bool):
  * A flag indicating whether the system is operating in a decentralized mode, affecting proxy wallet creation permissions.

#### Functions

**Public/External Functions**

* **`initialize`**:
  * Initializes the `ProxyWalletRegistry` with necessary contract references.
  * Parameters:
    * `_factory` (address): Address of the `ProxyWalletFactory` contract.
    * `_bookKeeper` (address): Address of the `BookKeeper` contract.
* **`addToWhitelist`**:
  * Adds an address to the whitelist. Only in centralized mode.
  * Parameters:
    * `_usr` (address): The address to add to the whitelist.
* **`removeFromWhitelist`**:
  * Removes an address from the whitelist. Only in centralized mode.
  * Parameters:
    * `_usr` (address): The address to remove from the whitelist.
* **`setDecentralizedMode`**:
  * Toggles the decentralized mode of the registry.
  * Parameters:
    * `isOn` (bool): Boolean to enable or disable decentralized mode.
* **`pause`** and **`unpause`**:
  * Controls the paused state of the contract, restricting or enabling function execution based on the contract's operational state.
* **`build0`**:
  * Convenience function that allows an owner to create a proxy wallet for themselves without specifying an owner explicitly.
* **`build`**:
  * Creates a new proxy wallet for a specified owner if they are whitelisted or if the contract is in decentralized mode.
  * Parameters:
    * `_owner` (address): The intended owner of the new proxy wallet.
* **`setOwner`**:
  * Changes the owner of a specific proxy wallet.
  * Parameters:
    * `_newOwner` (address): The new owner to set.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.fathom.fi/fxd-stablecoin/interfaces/proxywalletregistry.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
