Backend Price Provider

Backend price verifier.

Methods

DEFAULT_ADMIN_ROLE

function DEFAULT_ADMIN_ROLE() external view returns (bytes32)

Returns

NameTypeDescription

_0

bytes32

undefined

DESCRIPTION

function DESCRIPTION() external view returns (string)

Returns

NameTypeDescription

_0

string

undefined

TRUSTED_BACKEND_ROLE

function TRUSTED_BACKEND_ROLE() external view returns (bytes32)

Returns

NameTypeDescription

_0

bytes32

undefined

backendMetadata

function backendMetadata(address) external view returns (bool isListed, bool isActive)

Parameters

NameTypeDescription

_0

address

undefined

Returns

NameTypeDescription

isListed

bool

undefined

isActive

bool

undefined

changeActive

function changeActive(address token, bool active) external nonpayable

Parameters

NameTypeDescription

token

address

undefined

active

bool

undefined

getEthSignedMessageHash

function getEthSignedMessageHash(bytes32 messageHash) external pure returns (bytes32)
  1. step. Backend formatting the message and get hash of this message.

returns the keccak256 of formatted message

Parameters

NameTypeDescription

messageHash

bytes32

the keccak256 of message

Returns

NameTypeDescription

_0

bytes32

undefined

getEvaluation

function getEvaluation(address token, uint256 tokenAmount) external pure returns (uint256 evaluation)

Parameters

NameTypeDescription

token

address

undefined

tokenAmount

uint256

undefined

Returns

NameTypeDescription

evaluation

uint256

undefined

getEvaluationSigned

function getEvaluationSigned(address token, uint256 tokenAmount, uint256 priceMantissa, uint256 validTo, bytes signature) external view returns (uint256 evaluation)

return the evaluation in $ of tokenAmount with signed price

Parameters

NameTypeDescription

token

address

the address of token to get evaluation in $

tokenAmount

uint256

the amount of token to get evaluation. Amount is scaled by 10 in power token decimals

priceMantissa

uint256

the price multiplied by priceDecimals. The dimension of priceMantissa should be $/token

validTo

uint256

the timestamp in seconds, when price is gonna be not valid.

signature

bytes

the ECDSA sign on eliptic curve secp256k1.

Returns

NameTypeDescription

evaluation

uint256

undefined

getMessageHash

function getMessageHash(address token, uint256 priceMantissa, uint256 validTo) external pure returns (bytes32)
  1. step. Backend creates offchain data and get hash of this data. This data calls message.

returns the keccak256 of concatenated input data

Parameters

NameTypeDescription

token

address

the address of asset

priceMantissa

uint256

the price of asset that include decimals

validTo

uint256

the unix timestamp in seconds that define the validity of given price to validTo timestamp

Returns

NameTypeDescription

_0

bytes32

undefined

getPrice

function getPrice(address token) external pure returns (uint256 price, uint8 priceDecimals)

Returns the latest asset price and price decimals

Parameters

NameTypeDescription

token

address

the token address

Returns

NameTypeDescription

price

uint256

undefined

priceDecimals

uint8

undefined

getPriceDecimals

function getPriceDecimals() external view returns (uint8)

Returns

NameTypeDescription

_0

uint8

undefined

getPriceSigned

function getPriceSigned(address token, uint256 priceMantissa, uint256 validTo, bytes signature) external view returns (uint256 _priceMantissa, uint8 priceDecimals)

Parameters

NameTypeDescription

token

address

undefined

priceMantissa

uint256

undefined

validTo

uint256

undefined

signature

bytes

undefined

Returns

NameTypeDescription

_priceMantissa

uint256

undefined

priceDecimals

uint8

undefined

getRoleAdmin

function getRoleAdmin(bytes32 role) external view returns (bytes32)

Returns the admin role that controls role. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.

Parameters

NameTypeDescription

role

bytes32

undefined

Returns

NameTypeDescription

_0

bytes32

undefined

grandTrustedBackendRole

function grandTrustedBackendRole(address newTrustedBackend) external nonpayable

Parameters

NameTypeDescription

newTrustedBackend

address

undefined

grantRole

function grantRole(bytes32 role, address account) external nonpayable

Grants role to account. If account had not been already granted role, emits a {RoleGranted} event. Requirements: - the caller must have role's admin role.

Parameters

NameTypeDescription

role

bytes32

undefined

account

address

undefined

hasRole

function hasRole(bytes32 role, address account) external view returns (bool)

Returns true if account has been granted role.

Parameters

NameTypeDescription

role

bytes32

undefined

account

address

undefined

Returns

NameTypeDescription

_0

bool

undefined

initialize

function initialize() external nonpayable

isActive

function isActive(address token) external view returns (bool)

Parameters

NameTypeDescription

token

address

undefined

Returns

NameTypeDescription

_0

bool

undefined

isListed

function isListed(address token) external view returns (bool)

Parameters

NameTypeDescription

token

address

undefined

Returns

NameTypeDescription

_0

bool

undefined

recoverSigner

function recoverSigner(bytes32 ethSignedMessageHash, bytes signature) external pure returns (address)

returns the signer of ethSignedMessageHash

Parameters

NameTypeDescription

ethSignedMessageHash

bytes32

undefined

signature

bytes

undefined

Returns

NameTypeDescription

_0

address

undefined

renounceRole

function renounceRole(bytes32 role, address account) external nonpayable

Revokes role from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been granted role, emits a {RoleRevoked} event. Requirements: - the caller must be account.

Parameters

NameTypeDescription

role

bytes32

undefined

account

address

undefined

revokeRole

function revokeRole(bytes32 role, address account) external nonpayable

Revokes role from account. If account had been granted role, emits a {RoleRevoked} event. Requirements: - the caller must have role's admin role.

Parameters

NameTypeDescription

role

bytes32

undefined

account

address

undefined

revokeTrustedBackendRole

function revokeTrustedBackendRole(address trustedBackend) external nonpayable

Parameters

NameTypeDescription

trustedBackend

address

undefined

setToken

function setToken(address token) external nonpayable

Parameters

NameTypeDescription

token

address

undefined

supportsInterface

function supportsInterface(bytes4 interfaceId) external view returns (bool)

See {IERC165-supportsInterface}.

Parameters

NameTypeDescription

interfaceId

bytes4

undefined

Returns

NameTypeDescription

_0

bool

undefined

usdDecimals

function usdDecimals() external view returns (uint8)

Returns

NameTypeDescription

_0

uint8

undefined

verify

function verify(address token, uint256 priceMantissa, uint256 validTo, bytes signature) external view returns (bool)
  1. step. Smart contract verify the message (tuple)

returns true if the message is signed by trusted backend. Else returns false.

Parameters

NameTypeDescription

token

address

the address of asset

priceMantissa

uint256

the price of asset that include decimals

validTo

uint256

the unix timestamp in seconds that define the validity of given price to validTo timestamp

signature

bytes

the sign of message.

Returns

NameTypeDescription

_0

bool

undefined

Events

ChangeActive

event ChangeActive(address indexed who, address indexed token, bool active)

Parameters

NameTypeDescription

who indexed

address

undefined

token indexed

address

undefined

active

bool

undefined

GrandTrustedBackendRole

event GrandTrustedBackendRole(address indexed who, address indexed newTrustedBackend)

Parameters

NameTypeDescription

who indexed

address

undefined

newTrustedBackend indexed

address

undefined

RevokeTrustedBackendRole

event RevokeTrustedBackendRole(address indexed who, address indexed trustedBackend)

Parameters

NameTypeDescription

who indexed

address

undefined

trustedBackend indexed

address

undefined

RoleAdminChanged

event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole)

Parameters

NameTypeDescription

role indexed

bytes32

undefined

previousAdminRole indexed

bytes32

undefined

newAdminRole indexed

bytes32

undefined

RoleGranted

event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender)

Parameters

NameTypeDescription

role indexed

bytes32

undefined

account indexed

address

undefined

sender indexed

address

undefined

RoleRevoked

event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender)

Parameters

NameTypeDescription

role indexed

bytes32

undefined

account indexed

address

undefined

sender indexed

address

undefined

SetToken

event SetToken(address indexed who, address indexed token)

Parameters

NameTypeDescription

who indexed

address

undefined

token indexed

address

undefined

Last updated