UniswapV2PriceProviderMock
Overview
License: MIT
This implementation can be affected by price manipulation due to not using TWAP. For development purposes only
Structs info
PriceInfo
UniswapV2Metadata
Events info
GrantModeratorRole
RevokeModeratorRole
SetTokenAndPrice
ChangeActive
Constants info
MODERATOR_ROLE (0x797669c9)
DESCRIPTION (0xf1ae8856)
State variables info
usdDecimals (0x66a4b6c0)
uniswapV2Metadata (0x809205db)
tokenPrice (0x84ba3f69)
Modifiers info
onlyAdmin
onlyModerator
Functions info
initialize (0x8129fc1c)
grantModerator (0x6981c7ae)
revokeModerator (0x36445636)
setTokenAndPrice (0x179750ec)
changeActive (0x258a4532)
Changes the active status of a token.
Parameters:
Name | Type | Description |
---|---|---|
token | address | The address of the token to change the active status for. |
active | bool | The new active status of the token. |
isListed (0xf794062e)
Returns a boolean indicating whether the given token address is listed in the price provider.
Parameters:
Name | Type | Description |
---|---|---|
token | address | The address of the token to check. |
Return values:
Name | Type | Description |
---|---|---|
[0] | bool | A boolean indicating whether the token is listed or not. |
isActive (0x9f8a13d7)
Returns whether a token is active or not.
Parameters:
Name | Type | Description |
---|---|---|
token | address | The address of the token to check. |
Return values:
Name | Type | Description |
---|---|---|
[0] | bool | A boolean indicating whether the token is active or not. |
getPrice (0x41976e09)
Returns the price of the specified token.
Parameters:
Name | Type | Description |
---|---|---|
token | address | The address of the token to get the price for. |
Return values:
Name | Type | Description |
---|---|---|
priceMantissa | uint256 | The price of the token, represented as a mantissa. |
priceDecimals | uint8 | The number of decimal places in the token's price. |
getEvaluation (0x81fd01ea)
Returns the evaluation of a given token amount based on the current price.
Parameters:
Name | Type | Description |
---|---|---|
token | address | The address of the token to evaluate. |
tokenAmount | uint256 | The amount of tokens to evaluate. |
Return values:
Name | Type | Description |
---|---|---|
evaluation | uint256 | The evaluation of the token amount. |
getReserves (0x32749461)
getPriceDecimals (0x1b30aafc)
Returns the number of decimal places for the price returned by the price provider.
Return values:
Name | Type | Description |
---|---|---|
priceDecimals | uint8 | The number of decimal places for the price. |
Last updated