TokenValidator
View Source: @nomisma/elektro-protocol-aux/contracts/tokens/validation/TokenValidator.sol
↗ Extends: RoleAware ↘ Derived Contracts: TokenValidatorProxy
TokenValidator
Contract used for whitelisting tokens used in Elektro Markets Only user with "admin" role can add or remove tokens to whitelist If token is not valid, transaction is reverted Additionally contract is storing precision values for tokens. Precision is used in trade settlement calculations
Structs
Precision
Contract Members
Constants & Variables
Mapping holding datd for Elektro whitelisted token precisions.Maps token address to a {Precision} struct holding precision values. Notice that a zero precision can NOT be passed since it serves as a sign that a precision for a certain token has not been initialized. See {Precision}
TokenWhitelisted
Event fired upon whitelisting a token for Elektro usage.
Parameters
whitelistedToken
address
- address of a whitelisted token
precision
uint256
- amount of decimals used/important for Elektro during rounding of values (always <= token decimals!)
toTokenPower
uint256
- difference between decimals and precision, this value is used for calculations to convert (normalize) precision based amount to actual token denomination 10^(decimals-precision)
TokenRemovedFromWhitelist
Event fired upon token delisting.
Parameters
deletedToken
address
Functions
(address roleManager)
validateTokens(address[] tokens)
validateToken(address token)
getTokenPrecision(address token)
addTokensToWhitelist(address[] tokens, uint256[] precisions)
removeTokenFromWhitelist(address token)
Constructor setting {RoleManager} contract
Arguments
roleManager
address
address of {RoleManager} contract
validateTokens
Function to bulk check if tokens can be used in Elektro as deposit in {FundLock} and traded with
Arguments
tokens
address[]
addresses of tokens to be checked
validateToken
Function to check if token can be used in Elektro as deposit in {FundLock} and traded with
Arguments
token
address
address of token to be checked
getTokenPrecision
Function to get precision for token.
Returns
precision of a requested token
Arguments
token
address
address of token to get precision for
addTokensToWhitelist
Function to add addresses of tokens to be whitelisted for Elektro
Arguments
tokens
address[]
array of tokens addresses to be added to {TokenValidator}'s whitelist
precisions
uint256[]
array of precision values to store in {TokenValidator} for tokens
removeTokenFromWhitelist
Function to remove token address from {TokenValidator} whitelist
Arguments
token
address
address of token to be removed from {TokenValidator} whitelist
Last updated
Was this helpful?