TwoKeyExchangeRateContract
contract TwoKeyExchangeRateContract
Index
Reference
Functions
exchangeCurrencies
function exchangeCurrencies(string base_target, uint base_amount) public view returns (uint)
Helper calculation function.
- Parameters:
base_target
- stringbase_amount
- uint- Returns:
- uint
getBaseToTargetRate
function getBaseToTargetRate(string base_target) public view returns (uint)
Function getter for base to target rate.
- Parameters:
base_target
- is the name of the currency- Returns:
- uint
setFiatCurrencyDetails
function setFiatCurrencyDetails(bytes32 _currency, uint _baseToTargetRate) public
Only twoKeyMaintainer address will be eligible to update it, Backend calls to update rates.
- Modifiers:
- onlyMaintainer
- Parameters:
_currency
- is the bytes32 (hex) representation of currency shortcut string_baseToTargetRate
- is the rate between base and target currency
setInitialParams
function setInitialParams(address _twoKeySingletonesRegistry, address _proxyStorage) external
Function which will be called immediately after contract deployment.
- Parameters:
_twoKeySingletonesRegistry
- is the address of TWO_KEY_SINGLETON_REGISTRY contract_proxyStorage
- is the address of proxy storage contract
setMultipleFiatCurrencyDetails
function setMultipleFiatCurrencyDetails(bytes32[] _currencies, uint[] _baseToTargetRates) public
Only maintainer can call this, Function to update multiple rates at once.
- Modifiers:
- onlyMaintainer
- Parameters:
_currencies
- is the array of currencies_baseToTargetRates
- uint[]
storeFiatCurrencyDetails
function storeFiatCurrencyDetails(bytes32 _currency, uint _baseToTargetRate) internal
Function to store details about currency.
- Parameters:
_currency
- is the bytes32 (hex) representation of currency shortcut string_baseToTargetRate
- is the rate between base and target currency
stringToBytes32
function stringToBytes32(string source) internal returns (bytes32)
If string.length > 32 then the rest after 32nd char will be deleted, Helper method to convert string to bytes32.
- Parameters:
source
- string- Returns:
- result