Lossless Extensions Core
Workflow
Overview
The Lossless Extensions Core is the smart contract in charge of managing the extensions installed on the Lossless Wrapped ERC20 Extensible contract.
Through this contracts the users can interact in order to register and unregister extensions. Additionally when an extension is registered it needs to be set as one of the following bases:
beforeTransferBase
: The logic of the extension is ran before a transfer takes place.afterTransferBase
: The logic is ran after a transfer takes placebeforeMintBase
: The logic is ran before a mint takes placeafterMintBase
: The logic is ran after a mint takes placebeforeBurnBase
: The logic is ran before burning takes placeafterBurnBase
: The logic is ran after burning takes place
In order to properly implement the extensions the corresponding interface has to be implemented.
Extensions
An extension is a smart contract that implements one or more of the interfaces stated in the repository.
For instance, when a user interacts with the Lossless WERC20 Extensible to perform a transfer, the wrapping contract will check if abeforeTransferBase
is set and if so, if it has an extension registered with the same address. If both of this conditions are true, the call to the extension is made, applying the deployed logic.
More info
Lossless Core Extension can be taken as an example of an extension that implements before and after transfer base, effectively expanding the logic by interacting with the Lossless Core Protocol.
Variables
_extensions
_extensions
Type |
|
Visibility |
|
Description | Corresponds to a list of registered extensions. |
losslessCoreExtension
losslessCoreExtension
Type |
|
Visibility |
|
Description | Corresponds to the registered address as the lossless core extension. |
beforeTransferBase
beforeTransferBase
Type |
|
Visibility |
|
Description | Corresponds to the registered address as the before transfer base. Executes its logic before performing a transfer. |
beforeMintBase
beforeMintBase
Type |
|
Visibility |
|
Description | Corresponds to the registered address as the before mint base. Executes its logic before minting. |
afterMintBase
afterMintBase
Type |
|
Visibility |
|
Description | Corresponds to the registered address as the after mint base. Executes its logic after minting. |
beforeBurnBase
beforeBurnBase
Type |
|
Visibility |
|
Description | Corresponds to the registered address as the before burn base. Executes its logic before burning. |
afterBurnBase
afterBurnBase
Type |
|
Visibility |
|
Description | Corresponds to the registered address as the after burn base. Executes its logic after burning. |
_CREATOR_CORE_V1
_CREATOR_CORE_V1
Type |
|
Visibility |
|
Description | Corresponds to the interfaceID of the Extensions Core Contract |
Events
ExtensionRegistered
Parameters |
|
Description | It is emitted when a new extension is registered. |
ExtensionUnregistered
Parameters |
|
Description | It is emitted when a new extension is registered. |
BeforeTransferUpdated
Parameters |
|
Description | It is emitted when a new transfer base is registered. |
AfterTransferUpdated
Parameters |
|
Description | It is emitted when a new after transfer base is registered. |
BeforeMintUpdated
Parameters |
|
Description | It is emitted when a new before mint base is registered. |
AfterMintUpdated
Parameters |
|
Description | It is emitted when a new after mint base is registered. |
BeforeBurnUpdated
Parameters |
|
Description | It is emitted when a new before burn base is registered. |
AfterBurnUpdated
Parameters |
|
Description | It is emitted when a new after burn base is registered. |
Functions
getExtensions
Type | external view |
Restrictions | - |
Parameters | - |
Returns | Returns an array of addresses |
Description | Returns a list of all registered extensions in the contract. |
registerExtension
Type | external |
Restrictions | Only admin |
Parameters | extension address |
Returns | - |
Description | Adds the address of the extension to the _extensions list. |
registerExtension
Type | external |
Restrictions | Only admin |
Parameters | extension address |
Returns | - |
Description | Removes the address of the extension from the _extensions list. |
setLosslessCoreExtension
Type | external |
Restrictions | Only registered extension |
Parameters | - |
Returns | - |
Description | Sets the calling extension as the Lossless Core Extension |
setBeforeTransferExtension
Type | external |
Restrictions | Only registered extension |
Parameters | - |
Returns | - |
Description | Sets the calling extension as the before transfer base. |
setAfterTransferExtension
Type | external |
Restrictions | Only registered extension |
Parameters | - |
Returns | - |
Description | Sets the calling extension as the after transfer base. |
setBeforeMintExtension
Type | external |
Restrictions | Only registered extension |
Parameters | - |
Returns | - |
Description | Sets the calling extension as the before mint base. |
setAfterMintExtension
Type | external |
Restrictions | Only registered extension |
Parameters | - |
Returns | - |
Description | Sets the calling extension as the after mint base. |
setBeforeBurnExtension
Type | external |
Restrictions | Only registered extension |
Parameters | - |
Returns | - |
Description | Sets the calling extension as the before burn base. |
setAfterBurnExtension
Type | external |
Restrictions | Only registered extension |
Parameters | - |
Returns | - |
Description | Sets the calling extension as the after burn base. |
Last updated