OZLFacetV1_2

Modifies the original methods from OZLFacet to add and remove tokens from the database in order to support the ability of add/remove tokens from the tokens array, which is the one the front-end needs to display all the stablecoins an user can choose from

Owner methods

addTokenToDatabase

function addTokenToDatabase(
        struct TradeOps calldata newSwap_, 
        struct LibDiamond.Token calldata token_
) external;

Adds a new token to the group of tokens that an user can choose from for an Account as the coin to receive as the final destination on L2.

Due to the nature of the interaction of each token, other details are added besides the address of the token, details such the Curve pool where it can be traded, its base token, etc.

Parameters:

Struct:

struct TradeOps {
    int128 tokenIn;
    int128 tokenOut;
    address baseToken;
    address token;  
    address pool;
}
Name
Type
Description

tokenIn

int128

Index at Curve pool of the base token (USDT or WBTC) of the new token to add

tokenOut

int128

Index at Curve pool of the new token to add

baseToken

address

Base token for swaps

token

address

New token to add

pool

address

Curve pool where the new token to add is found

Struct:

struct Token {
   address l1Address;
   address l2Address;
}
Name
Type
Descritpion

l1Address

address

L1 address of the token to add (it'd be address(0) if bridging is disabled)

l2Address

address

L2 address of the token to add

Function:

Name
Type
Description

newSwap_

struct TradeOps

Configuration of the new token to add

token_

struct LibDiamond.Token

Addresses (L1 and L2) of the token to add

removeTokenFromDatabase

function removeTokenFromDatabase(
        TradeOps calldata swapToRemove_, 
        LibDiamond.Token calldata token_
) external;

Removes a token from the database of tokens that the protocol supports.

Parameters:

The same as addTokenToDatabase()

Function:

Name
Type
Description

swapToRemove_

struct TradeOps

Configuration of the token to remove

token_

struct LibDiamond.Token

Addresses (L1 and L2) of the token to remove

Last updated