BaseCurrency

This contract is an abstraction for any ERC20 token to convert any value to a USDC equivalency for market calculations.

erc20

contract IERC20 erc20

constructor

constructor(address _erc20) internal

Constructor sets the address for the ERC20 token.

Parameters

Name
Type
Description

_erc20

address

The address of the ERC20 token to be used as the currency.

getERC20

function getERC20() public view returns (contract IERC20)

Returns the ERC20 token that is being used as the currency.

Return Values

Name
Type
Description

[0]

contract IERC20

The ERC20 token being used as the currency.

supportsInterface

Checks if the contract implements an interface.

Parameters

Name
Type
Description

_interfaceId

bytes4

The ID of the interface.

Return Values

Name
Type
Description

[0]

bool

True if the contract implements the interface, false otherwise.

getEstimatedUSDCValue

Returns the estimated value in USDC of an amount of the currency.

This function is virtual and must be implemented in child contracts.

Parameters

Name
Type
Description

_amount

uint256

The amount of currency to estimate the value of.

Return Values

Name
Type
Description

[0]

uint256

The estimated value in USDC of the specified amount of currency.

Last updated