UniswapV2PriceProvider
Overview
License: MIT
This implementation can be affected by price manipulation due to not using TWAP. For development purposes only
Structs info
UniswapV2Metadata
Events info
GrantModeratorRole
Emitted when the moderator role is granted to a new account.
Parameters:
RevokeModeratorRole
Emitted when the moderator role is revoked from an account.
Parameters:
SetTokenAndPair
Emitted when the token and pair addresses are set for the UniswapV2PriceProvider contract.
Parameters:
ChangeActive
Emitted when the active status of a token changes.
Parameters:
SetTokenDecimals
Emitted when the token decimals is set.
Parameters:
Constants info
MODERATOR_ROLE (0x797669c9)
DESCRIPTION (0xf1ae8856)
State variables info
tokenDecimals (0x3b97e856)
uniswapV2Metadata (0x809205db)
Modifiers info
onlyAdmin
Modifier to restrict access to functions to only the contract admin.
onlyModerator
Modifier to restrict access to functions to only the contract moderator.
Functions info
initialize (0x8129fc1c)
Initializes the contract by setting up the access control roles and the number of decimals for the USD token.
grantModerator (0x6981c7ae)
Grants the moderator role to a new address.
Parameters:
revokeModerator (0x36445636)
Revokes the moderator role from an address.
Parameters:
setTokenDecimals (0xf2cf47be)
Sets the number of decimals used by the token. Only the moderator can call this function.
Parameters:
setTokenAndPair (0xa6ff9e94)
Sets the token and pair addresses for the UniswapV2PriceProvider contract.
Requirements:
token
andpair
addresses must not be zero.Only the contract moderator can call this function.
The
token
andpair
addresses must be valid.The
metadata
struct for thetoken
address must be updated with thepair
address,pairAsset
address,tokenDecimals
, andpairAssetDecimals
.
Parameters:
changeActive (0x258a4532)
Changes the active status of a token in the UniswapV2PriceProvider contract.
Requirements:
The token must be listed in the UniswapV2PriceProvider contract.
Only the contract moderator can call this function.
Parameters:
isListed (0xf794062e)
Check if a token is listed on UniswapV2.
Parameters:
Return values:
isActive (0x9f8a13d7)
Returns whether the specified token is active or not.
Parameters:
Return values:
getPrice (0x41976e09)
This function requires that the token is active in the price provider. Returns the price of a given token in pairAsset, and the number of decimals for the price.
Parameters:
Return values:
getReserves (0x32749461)
Returns the reserves of the specified Uniswap V2 pair for the given tokens.
Parameters:
Return values:
getPriceDecimals (0x1b30aafc)
Returns the number of decimals used for the USD price.
Return values:
Last updated