> For the complete documentation index, see [llms.txt](https://docs.lossless.io/protocol/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lossless.io/protocol/technical-reference/wrapped-tokens/extensible-wrapped-tokens/extensions/lossless-core-extension.md).

# Lossless Core Extension

## Overview <a href="#overview" id="overview"></a>

The [Lossless Core Extension](https://github.com/Lossless-Cash/wrapped-lossless-erc20/blob/master/src/Extensions/LosslessCoreExtension.sol) is an extension designed for the [Lossless WERC20 Extensible](https://lossless.atlassian.net/wiki/spaces/LOSSLESSCO/pages/254443525). It will allow the wrapped token to interact with the Lossless Core Protocol. Providing it all the features, reporting, staking and voting.

The extension has to be registered and set as Lossless Core Base for it to be applied. On deployment, in its constructor, all the required configurations will be set in order to properly function with the Lossless Controller.

## Workflow <a href="#workflow" id="workflow"></a>

<figure><img src="https://2406906599-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWd1iFH2pSxHtVxpot5%2Fuploads%2FcnIEgj4cR4ILtbBtq4pQ%2Fimage.png?alt=media&amp;token=9c95ab35-fcc1-4cb5-83cd-ce0f39331cec" alt=""><figcaption></figcaption></figure>

## Variables <a href="#variables" id="variables"></a>

#### `recoveryAdmin` <a href="#recoveryadmin" id="recoveryadmin"></a>

| Type        | `address`                                                                                                                                   |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| Visibility  | `public`                                                                                                                                    |
| Description | Address of the recovery admin. The recovery admin has the power to execute a set of functions in order to not lose ownership of a contract. |

#### `recoveryAdminCandidate` <a href="#recoveryadmincandidate" id="recoveryadmincandidate"></a>

| Type        | `address`                                                  |
| ----------- | ---------------------------------------------------------- |
| Visibility  | `public`                                                   |
| Description | This variable is used when proposing a new recovery admin. |

#### `recoveryAdminCandidate` <a href="#recoveryadmincandidate.1" id="recoveryadmincandidate.1"></a>

| Type        | `bytes32`                                          |
| ----------- | -------------------------------------------------- |
| Visibility  | `private`                                          |
| Description | Keyhash used to execute the recovery admin change. |

#### `admin` <a href="#admin" id="admin"></a>

| Type        | `address`             |
| ----------- | --------------------- |
| Visibility  | `public`              |
| Description | Address of the admin. |

#### `timelockPeriod` <a href="#timelockperiod" id="timelockperiod"></a>

| Type        | `uint256`                                                       |
| ----------- | --------------------------------------------------------------- |
| Visibility  | `public`                                                        |
| Description | Timeframe to wait to execute a lossless turnoff since proposal. |

#### `losslessTurnOffTimestamp` <a href="#losslessturnofftimestamp" id="losslessturnofftimestamp"></a>

| Type        | `uint256`                                             |
| ----------- | ----------------------------------------------------- |
| Visibility  | `public`                                              |
| Description | Timestamp of when lossless protection was turned off. |

#### `isLosslessOn` <a href="#islosslesson" id="islosslesson"></a>

| Type        | `bool`                                   |
| ----------- | ---------------------------------------- |
| Visibility  | `public`                                 |
| Description | Determines if lossless protection is on. |

#### `lossless` <a href="#lossless" id="lossless"></a>

| Type        | `ILssController`                    |
| ----------- | ----------------------------------- |
| Visibility  | `public`                            |
| Description | Address of the lossless controller. |

#### `protectedToken` <a href="#protectedtoken" id="protectedtoken"></a>

| Type        | `ILosslessExtensibleWrappedERC20`                                                |
| ----------- | -------------------------------------------------------------------------------- |
| Visibility  | `public`                                                                         |
| Description | Address of the extensible wrapped token where the extension is being registered. |

## Functions <a href="#functions" id="functions"></a>

#### `transferOutBlacklistedFunds` <a href="#transferoutblacklistedfunds" id="transferoutblacklistedfunds"></a>

| Type         | external                                                                                                                                                                                                                                            |
| ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Restrictions | Only called by Lossless Controller                                                                                                                                                                                                                  |
| Parameters   | address\[]                                                                                                                                                                                                                                          |
| Returns      | -                                                                                                                                                                                                                                                   |
| Description  | This function gets called only by the Lossless Controller when a report gets solved. The main objective is to transfer the stolen funds from a list of addresses back to the Lossless Contracts to be distributed once again to the rightful owner. |

#### `setLosslessAdmin` <a href="#setlosslessadmin" id="setlosslessadmin"></a>

| Type         | external                          |
| ------------ | --------------------------------- |
| Restrictions | Only called by Recovery Admin     |
| Parameters   | address                           |
| Returns      | -                                 |
| Description  | Sets a new admin of the contract. |

#### `transferRecoveryAdminOwnership` <a href="#transferrecoveryadminownership" id="transferrecoveryadminownership"></a>

| Type         | external                                                                                                                                                                           |
| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Restrictions | Only called by Recovery Admin                                                                                                                                                      |
| Parameters   | <p>address</p><p>bytes32</p>                                                                                                                                                       |
| Returns      | -                                                                                                                                                                                  |
| Description  | This function allows transferring the recovery admin to another address. It’s a two step process where first an address is proposed, paired with a keyHash. And later on executed. |

#### `acceptRecoveryAdminOwnership` <a href="#acceptrecoveryadminownership" id="acceptrecoveryadminownership"></a>

| Type         | external                                                                                                                   |
| ------------ | -------------------------------------------------------------------------------------------------------------------------- |
| Restrictions | Only called by the recovery admin candidate                                                                                |
| Parameters   | bytes                                                                                                                      |
| Returns      | -                                                                                                                          |
| Description  | This function finishes the recovery adminship transfer. The candidate has to accept the transfer with the correct keyHash. |

#### `proposeLosslessTurnOff` <a href="#proposelosslessturnoff" id="proposelosslessturnoff"></a>

| Type         | external                                                                                                                                                                                  |
| ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Restrictions | Only called by Recovery Admin                                                                                                                                                             |
| Parameters   | -                                                                                                                                                                                         |
| Returns      | -                                                                                                                                                                                         |
| Description  | This function allows to propose turning off lossless protection on the wrapped token. It’s a two step process where later on, after the timelock period, the turn off has to be executed. |

#### `executeLosslessTurnOff` <a href="#executelosslessturnoff" id="executelosslessturnoff"></a>

| Type         | external                                              |
| ------------ | ----------------------------------------------------- |
| Restrictions | Only called by Recovery Admin                         |
| Parameters   | -                                                     |
| Returns      | -                                                     |
| Description  | This function executes the lossless turnoff proposal. |

#### `executeLosslessTurnOn` <a href="#executelosslessturnon" id="executelosslessturnon"></a>

| Type         | external                                              |
| ------------ | ----------------------------------------------------- |
| Restrictions | Only called by Recovery Admin                         |
| Parameters   | -                                                     |
| Returns      | -                                                     |
| Description  | This function instantly turns on lossless protection. |

#### `setLosslessCoreExtension` <a href="#setlosslesscoreextension" id="setlosslesscoreextension"></a>

| Type         | external                                                                                                         |
| ------------ | ---------------------------------------------------------------------------------------------------------------- |
| Restrictions | Only called by Recovery Admin                                                                                    |
| Parameters   | Address                                                                                                          |
| Returns      | -                                                                                                                |
| Description  | This functions will register the Lossless Core Extension as the before transfer base and the Lossless Core base. |

#### `extensionBeforeTransfer` <a href="#extensionbeforetransfer" id="extensionbeforetransfer"></a>

| Type         | external                                                             |
| ------------ | -------------------------------------------------------------------- |
| Restrictions | -                                                                    |
| Parameters   | <p>address sender,</p><p>address recipient,</p><p>uint256 amount</p> |
| Returns      | bool                                                                 |
| Description  | Executes logic before a transfer takes place.                        |

#### `extensionBeforeTransferFrom` <a href="#extensionbeforetransferfrom" id="extensionbeforetransferfrom"></a>

| Type         | external                                                             |
| ------------ | -------------------------------------------------------------------- |
| Restrictions | -                                                                    |
| Parameters   | <p>address sender,</p><p>address recipient,</p><p>uint256 amount</p> |
| Returns      | bool                                                                 |
| Description  | Executes logic before a transferFrom takes place.                    |
