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 place

  • beforeMintBase: The logic is ran before a mint takes place

  • afterMintBase: The logic is ran after a mint takes place

  • beforeBurnBase: The logic is ran before burning takes place

  • afterBurnBase: 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

Type

EnumerableSet.AddressSet

Visibility

internal

Description

Corresponds to a list of registered extensions.

losslessCoreExtension

Type

address

Visibility

public

Description

Corresponds to the registered address as the lossless core extension.

beforeTransferBase

Type

address

Visibility

public

Description

Corresponds to the registered address as the before transfer base. Executes its logic before performing a transfer.

beforeMintBase

Type

address

Visibility

public

Description

Corresponds to the registered address as the before mint base. Executes its logic before minting.

afterMintBase

Type

address

Visibility

public

Description

Corresponds to the registered address as the after mint base. Executes its logic after minting.

beforeBurnBase

Type

address

Visibility

public

Description

Corresponds to the registered address as the before burn base. Executes its logic before burning.

afterBurnBase

Type

address

Visibility

public

Description

Corresponds to the registered address as the after burn base. Executes its logic after burning.

_CREATOR_CORE_V1

Type

bytes4

Visibility

public constant

Description

Corresponds to the interfaceID of the Extensions Core Contract

Events

ExtensionRegistered

Parameters

Address of the registered extension. Indexed.

Address of the one registering the extension. Indexed.

Description

It is emitted when a new extension is registered.

ExtensionUnregistered

Parameters

Address of the unregistered extension. Indexed.

Address of the one unregistering the extension. Indexed.

Description

It is emitted when a new extension is registered.

BeforeTransferUpdated

Parameters

Address of the set before transfer base.

Description

It is emitted when a new transfer base is registered.

AfterTransferUpdated

Parameters

Address of the set after transfer base.

Description

It is emitted when a new after transfer base is registered.

BeforeMintUpdated

Parameters

Address of the set before mint base.

Description

It is emitted when a new before mint base is registered.

AfterMintUpdated

Parameters

Address of the set after mint base.

Description

It is emitted when a new after mint base is registered.

BeforeBurnUpdated

Parameters

Address of the set before burn base.

Description

It is emitted when a new before burn base is registered.

AfterBurnUpdated

Parameters

Address of the set after burn base.

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