CurrencyRegistry

This contract is used for registering and unregistering ERC20 tokens as base currencies.

Inherits from MarketAccess for role-based access control.

_currenciesByERC20

mapping(address => address) _currenciesByERC20

Internal storage for registered currencies and their corresponding ERC20 tokens.

_erc20sByCurrency

mapping(address => address) _erc20sByCurrency

erc20s

address[] erc20s

An array of registered ERC20 tokens.

registerERC20

function registerERC20(address _currency) public

Registers an ERC20 token as a base currency.

Parameters

Name
Type
Description

_currency

address

The address of the BaseCurrency contract associated with the ERC20 token.

unregisterERC20

Unregisters an ERC20 token from being a base currency.

Parameters

Name
Type
Description

_currency

address

The address of the BaseCurrency contract associated with the ERC20 token.

getCurrencyByERC20

Retrieves the BaseCurrency contract associated with a specific ERC20 token.

Parameters

Name
Type
Description

_erc20

address

The address of the ERC20 token.

Return Values

Name
Type
Description

[0]

contract BaseCurrency

The BaseCurrency contract associated with the ERC20 token.

getERC20ByCurrency

Retrieves the ERC20 token associated with a specific BaseCurrency contract.

Parameters

Name
Type
Description

_currency

address

The address of the BaseCurrency contract.

Return Values

Name
Type
Description

[0]

contract IERC20

The ERC20 token associated with the BaseCurrency contract.

isERC20Registered

Checks if an ERC20 token is registered as a base currency.

Parameters

Name
Type
Description

_erc20

address

The address of the ERC20 token.

Return Values

Name
Type
Description

[0]

bool

true if the ERC20 token is registered, false otherwise.

getERC20s

Gets all registered ERC20 tokens.

Return Values

Name
Type
Description

[0]

address[]

An array of addresses of the registered ERC20 tokens.

Last updated