Backend Price Provider

Backend price verifier.

Methods

DEFAULT_ADMIN_ROLE

function DEFAULT_ADMIN_ROLE() external view returns (bytes32)

Returns

Name
Type
Description

_0

bytes32

undefined

DESCRIPTION

function DESCRIPTION() external view returns (string)

Returns

Name
Type
Description

_0

string

undefined

TRUSTED_BACKEND_ROLE

function TRUSTED_BACKEND_ROLE() external view returns (bytes32)

Returns

Name
Type
Description

_0

bytes32

undefined

backendMetadata

Parameters

Name
Type
Description

_0

address

undefined

Returns

Name
Type
Description

isListed

bool

undefined

isActive

bool

undefined

changeActive

Parameters

Name
Type
Description

token

address

undefined

active

bool

undefined

getEthSignedMessageHash

  1. step. Backend formatting the message and get hash of this message.

returns the keccak256 of formatted message

Parameters

Name
Type
Description

messageHash

bytes32

the keccak256 of message

Returns

Name
Type
Description

_0

bytes32

undefined

getEvaluation

Parameters

Name
Type
Description

token

address

undefined

tokenAmount

uint256

undefined

Returns

Name
Type
Description

evaluation

uint256

undefined

getEvaluationSigned

return the evaluation in $ of tokenAmount with signed price

Parameters

Name
Type
Description

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

Name
Type
Description

evaluation

uint256

undefined

getMessageHash

  1. step. Backend creates offchain data and get hash of this data. This data calls message.

returns the keccak256 of concatenated input data

Parameters

Name
Type
Description

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

Name
Type
Description

_0

bytes32

undefined

getPrice

Returns the latest asset price and price decimals

Parameters

Name
Type
Description

token

address

the token address

Returns

Name
Type
Description

price

uint256

undefined

priceDecimals

uint8

undefined

getPriceDecimals

Returns

Name
Type
Description

_0

uint8

undefined

getPriceSigned

Parameters

Name
Type
Description

token

address

undefined

priceMantissa

uint256

undefined

validTo

uint256

undefined

signature

bytes

undefined

Returns

Name
Type
Description

_priceMantissa

uint256

undefined

priceDecimals

uint8

undefined

getRoleAdmin

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

Parameters

Name
Type
Description

role

bytes32

undefined

Returns

Name
Type
Description

_0

bytes32

undefined

grandTrustedBackendRole

Parameters

Name
Type
Description

newTrustedBackend

address

undefined

grantRole

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

Name
Type
Description

role

bytes32

undefined

account

address

undefined

hasRole

Returns true if account has been granted role.

Parameters

Name
Type
Description

role

bytes32

undefined

account

address

undefined

Returns

Name
Type
Description

_0

bool

undefined

initialize

isActive

Parameters

Name
Type
Description

token

address

undefined

Returns

Name
Type
Description

_0

bool

undefined

isListed

Parameters

Name
Type
Description

token

address

undefined

Returns

Name
Type
Description

_0

bool

undefined

recoverSigner

returns the signer of ethSignedMessageHash

Parameters

Name
Type
Description

ethSignedMessageHash

bytes32

undefined

signature

bytes

undefined

Returns

Name
Type
Description

_0

address

undefined

renounceRole

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

Name
Type
Description

role

bytes32

undefined

account

address

undefined

revokeRole

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

Parameters

Name
Type
Description

role

bytes32

undefined

account

address

undefined

revokeTrustedBackendRole

Parameters

Name
Type
Description

trustedBackend

address

undefined

setToken

Parameters

Name
Type
Description

token

address

undefined

supportsInterface

See {IERC165-supportsInterface}.

Parameters

Name
Type
Description

interfaceId

bytes4

undefined

Returns

Name
Type
Description

_0

bool

undefined

usdDecimals

Returns

Name
Type
Description

_0

uint8

undefined

verify

  1. step. Smart contract verify the message (tuple)

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

Parameters

Name
Type
Description

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

Name
Type
Description

_0

bool

undefined

Events

ChangeActive

Parameters

Name
Type
Description

who indexed

address

undefined

token indexed

address

undefined

active

bool

undefined

GrandTrustedBackendRole

Parameters

Name
Type
Description

who indexed

address

undefined

newTrustedBackend indexed

address

undefined

RevokeTrustedBackendRole

Parameters

Name
Type
Description

who indexed

address

undefined

trustedBackend indexed

address

undefined

RoleAdminChanged

Parameters

Name
Type
Description

role indexed

bytes32

undefined

previousAdminRole indexed

bytes32

undefined

newAdminRole indexed

bytes32

undefined

RoleGranted

Parameters

Name
Type
Description

role indexed

bytes32

undefined

account indexed

address

undefined

sender indexed

address

undefined

RoleRevoked

Parameters

Name
Type
Description

role indexed

bytes32

undefined

account indexed

address

undefined

sender indexed

address

undefined

SetToken

Parameters

Name
Type
Description

who indexed

address

undefined

token indexed

address

undefined

Last updated