gulitsky / eth-rub-oracle

:ru: Реализация ETH/RUB оракула на блокчейне Ethereum.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ETH/RUB оракул

Solidity 0.4.23 Лицензия MIT

Реализация ETH/RUB оракула на блокчейне Ethereum; для работы с API Cryptonator используется Oraclize.

Пример использования

pragma solidity ^0.4.23;

interface ETHRUBOracle {
    function price() public view returns (uint);
    function updatedAt() public view returns (uint);
    function update(uint delay) public payable;
    function isOutOfSync() public view returns (bool);
}

contract ETHToRUBConverter {
    ETHRUBOracle internal priceOracle;

    function constructor(address priceOracleAddress) public {
        priceOracle = ETHRUBOracle(priceOracleAddress);
    }

    function convert(uint amountInEther) public view returns (uint) {
        require(!priceOracle.isOutOfSync());
        return amountInEther * priceOracle.price();
    }
}

About

:ru: Реализация ETH/RUB оракула на блокчейне Ethereum.

License:MIT License


Languages

Language:JavaScript 100.0%