-
Notifications
You must be signed in to change notification settings - Fork 0
/
ThemisIntegration.sol
33 lines (26 loc) · 1.03 KB
/
ThemisIntegration.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
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.8.0;
interface IThemis {
function getConversionFactor(uint256 _index) view external returns (uint256);
function getParityData(uint256 _index)
view external
returns (
string memory ccIsoAlpha2, string memory ccIsoAlpha3, uint256 exchangeRate, uint256 ppp, uint256 pppConversionFactor
);
}
contract ThemisIntegration {
IThemis public themis = IThemis(0xD4822b35ED7574510426e0828c2188e84DEdD681);
function getParityData(uint256 _amount, uint256 _queryIndex)
public view
returns (uint256 _parityAmount)
{
(string memory ccIsoAlpha2, string memory ccIsoAlpha3, uint256 exchangeRate, uint256 ppp, uint256 pppConversionFactor ) = themis.getParityData(_queryIndex);
return _amount*pppConversionFactor;
}
function getParityPrice(uint256 _amount, uint256 _queryIndex)
public view
returns (uint256 _parityAmount)
{
return _amount*themis.getConversionFactor(_queryIndex);
}
}