-
Notifications
You must be signed in to change notification settings - Fork 0
/
football_sample.sol
34 lines (26 loc) · 1.09 KB
/
football_sample.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
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@oracle/interfaces/FootballScoresAggregator.sol";
contract ScoreRetrieveContract {
// инициализируем переменные
address private beneficiary;
int public score;
// создаем событие, в котором будет сохранена цена
event ScoreIsRetrieved(address game, int score);
// функция для указания админа
function initializeBeneficiary(address _beneficiary) public {
beneficiary = _beneficiary;
}
// функция для получения цены
function retrieveScore(address game, string game_name) public returns (int) {
require(
game != address(0x0),
"Ошибка! Адрес запроса не должен быть пустым!"
);
FootballScoresAggregator retriever = FootballScoresAggregator(feed);
int _score = retriever.get(game_name);
score = _score;
emit ScoreRetrievedFrom(game, _score);
return score;
}
}