/
TBYRateProvider.sol
52 lines (44 loc) · 1.91 KB
/
TBYRateProvider.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// SPDX-License-Identifier: BUSL-1.1
/*
██████╗░██╗░░░░░░█████╗░░█████╗░███╗░░░███╗
██╔══██╗██║░░░░░██╔══██╗██╔══██╗████╗░████║
██████╦╝██║░░░░░██║░░██║██║░░██║██╔████╔██║
██╔══██╗██║░░░░░██║░░██║██║░░██║██║╚██╔╝██║
██████╦╝███████╗╚█████╔╝╚█████╔╝██║░╚═╝░██║
╚═════╝░╚══════╝░╚════╝░░╚════╝░╚═╝░░░░░╚═╝
*/
pragma solidity 0.8.19;
import "../interfaces/IRateProvider.sol";
import "./ExchangeRateRegistry.sol";
/**
* @title Bloom Registry interface to return exchangeRate
*/
interface IRegistry {
/**
* @notice Returns the current exchange rate of the given token
* @param token The token address
* @return The current exchange rate of the given token
*/
function getExchangeRate(address token) external view returns (uint256);
}
/**
* @title Bloom TBY Rate Provider
* @notice Returns value of TBY in terms of USD.
* Bloom controls the oracle's address and updates exchangeRate
* every 24 hours at 4pm UTC. This update cadende may change
* in the future.
*/
contract TBYRateProvider is IRateProvider {
IRegistry public immutable registry;
address public immutable tby;
constructor(IRegistry _registry, address _tby) {
registry = _registry;
tby = _tby;
}
/**
* @return value of TBY in terms of USD returns an 18 decimal number
*/
function getRate() public view override returns (uint256) {
return registry.getExchangeRate(tby);
}
}