TwoKey documentation

TwoKey documentation

  • Docs

›2KEY / SINGLETON-CONTRACTS

2KEY

  • Migrations
  • Ownable
  • TwoKeyConversionStates
  • TwoKeyConverterStates
  • TwoKeyTypes
  • UpgradabilityProxyAcquisition

2KEY / ACQUISITION-CAMPAIGN-CONTRACTS

  • TwoKeyAcquisitionCampaignERC20
  • TwoKeyAcquisitionLogicHandler
  • TwoKeyConversionHandler
  • TwoKeyPurchasesHandler

2KEY / CAMPAIGN-MUTUAL-CONTRACTS

  • ArcERC20
  • TwoKeyCampaign
  • TwoKeyCampaignConversionHandler
  • TwoKeyCampaignIncentiveModels
  • TwoKeyCampaignLogicHandler

2KEY / DONATION-CAMPAIGN-CONTRACTS

  • InvoiceTokenERC20
  • TwoKeyDonationCampaign
  • TwoKeyDonationCampaignType
  • TwoKeyDonationConversionHandler
  • TwoKeyDonationLogicHandler

2KEY / ERC20

  • ERC20

2KEY / INTERFACES

  • IBancorContract
  • IERC20
  • IGetImplementation
  • IHandleCampaignDeployment
  • IKyberNetworkProxy
  • IMaintainingPattern
  • IStructuredStorage
  • ITwoKeyAcquisitionCampaignERC20
  • ITwoKeyAcquisitionLogicHandler
  • ITwoKeyAdmin
  • ITwoKeyBaseReputationRegistry
  • ITwoKeyCampaign
  • ITwoKeyCampaignGetReferrers
  • ITwoKeyCampaignPublicAddresses
  • ITwoKeyCampaignValidator
  • ITwoKeyConversionHandler
  • ITwoKeyConversionHandlerGetConverterState
  • ITwoKeyDonationCampaign
  • ITwoKeyDonationCampaignFetchAddresses
  • ITwoKeyDonationConversionHandler
  • ITwoKeyDonationLogicHandler
  • ITwoKeyEventSource
  • ITwoKeyEventSourceEvents
  • ITwoKeyExchangeRateContract
  • ITwoKeyMaintainersRegistry
  • ITwoKeyPlasmaEvents
  • ITwoKeyPlasmaRegistry
  • ITwoKeyPurchasesHandler
  • ITwoKeyReg
  • ITwoKeyRegistry
  • ITwoKeyRegistryEvents
  • ITwoKeySingletoneAddressStorage
  • ITwoKeySingletoneRegistryFetchAddress
  • ITwoKeySingletonesRegistry
  • ITwoKeyWeightedVoteContract
  • IUpgradableExchange

2KEY / INTERFACES / STORAGE-CONTRACTS

  • ITwoKeyAdminStorage
  • ITwoKeyBaseReputationRegistryStorage
  • ITwoKeyCampaignValidatorStorage
  • ITwoKeyCommunityTokenPoolStorage
  • ITwoKeyDeepFreezeTokenPoolStorage
  • ITwoKeyEventSourceStorage
  • ITwoKeyExchangeRateContractStorage
  • ITwoKeyFactoryStorage
  • ITwoKeyLongTermTokenPoolStorage
  • ITwoKeyMaintainersRegistryStorage
  • ITwoKeyPlasmaEventsStorage
  • ITwoKeyPlasmaMaintainersRegistryStorage
  • ITwoKeyPlasmaRegistryStorage
  • ITwoKeyRegistryStorage
  • ITwoKeySignatureValidatorStorage
  • ITwoKeyUpgradableExchangeStorage

2KEY / LIBRARIES

  • Call
  • GetCode
  • IncentiveModels
  • SafeMath
  • Utils

2KEY / SINGLETON-CONTRACTS

  • ITwoKeySingletonUtils
  • StandardTokenModified
  • TwoKeyAdmin
  • TwoKeyBaseReputationRegistry
  • TwoKeyCampaignValidator
  • TwoKeyCongress
  • TwoKeyEconomy
  • TwoKeyEventSource
  • TwoKeyExchangeRateContract
  • TwoKeyFactory
  • TwoKeyMaintainersRegistry
  • TwoKeyPlasmaEvents
  • TwoKeyPlasmaMaintainersRegistry
  • TwoKeyPlasmaRegistry
  • TwoKeyPlasmaSingletoneRegistry
  • TwoKeyRegistry
  • TwoKeySignatureValidator
  • TwoKeySingletonesRegistry
  • TwoKeyUpgradableExchange

2KEY / SINGLETON-STORAGE-CONTRACTS

  • TwoKeyAdminStorage
  • TwoKeyBaseReputationRegistryStorage
  • TwoKeyCampaignValidatorStorage
  • TwoKeyCommunityTokenPoolStorage
  • TwoKeyDeepFreezeTokenPoolStorage
  • TwoKeyEventSourceStorage
  • TwoKeyExchangeRateStorage
  • TwoKeyFactoryStorage
  • TwoKeyLongTermTokenPoolStorage
  • TwoKeyMaintainersRegistryStorage
  • TwoKeyPlasmaEventsStorage
  • TwoKeyPlasmaMaintainersRegistryStorage
  • TwoKeyPlasmaRegistryStorage
  • TwoKeyRegistryStorage
  • TwoKeySignatureValidatorStorage
  • TwoKeyUpgradableExchangeStorage

2KEY / TOKEN-POOLS

  • TokenPool
  • TwoKeyCommunityTokenPool
  • TwoKeyDeepFreezeTokenPool
  • TwoKeyLongTermTokenPool

2KEY / UPGRADABILITY

  • Proxy
  • StructuredStorage
  • UpgradeabilityStorage
  • UpgradeabilityProxy
  • Upgradeable

2KEY / UPGRADABLE-PATTERN-CAMPAIGNS

  • ProxyCampaign
  • UpgradeabilityCampaignStorage
  • UpgradeableCampaign

TEST

  • FungibleMockToken
  • TestA
  • TestB
  • KyberNetworkTestMockContract

TwoKeyExchangeRateContract

contract TwoKeyExchangeRateContract

is Upgradeable, ITwoKeySingletonUtils

Source: contracts/2key/singleton-contracts/TwoKeyExchangeRateContract.sol
Author: Nikola Madjarevic

Index

  • exchangeCurrencies
  • getBaseToTargetRate
  • setFiatCurrencyDetails
  • setInitialParams
  • setMultipleFiatCurrencyDetails
  • storeFiatCurrencyDetails
  • stringToBytes32

Reference

Functions

  • exchangeCurrencies

    function exchangeCurrencies(string base_target, uint base_amount) public view returns (uint)

    Helper calculation function.

    Parameters:
    base_target - string
    base_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
← TwoKeyEventSourceTwoKeyFactory →
Copyright © 2019 2key.network