@@ -21,22 +21,46 @@ interface FtsoV2Interface {
2121 FeedData body;
2222 }
2323
24+ /// Feed id change structure
25+ struct FeedIdChange {
26+ bytes21 oldFeedId;
27+ bytes21 newFeedId;
28+ }
29+
30+ /// Event emitted when a feed id is changed (e.g. feed renamed).
31+ event FeedIdChanged (bytes21 indexed oldFeedId , bytes21 indexed newFeedId );
32+
2433 /**
25- * Returns stored data of a feed.
26- * A fee (calculated by the FeeCalculator contract) may need to be paid.
27- * @param _index The index of the feed, corresponding to feed id in
28- * the FastUpdatesConfiguration contract.
29- * @return _value The value for the requested feed.
30- * @return _decimals The decimal places for the requested feed.
31- * @return _timestamp The timestamp of the last update.
34+ * Returns the FTSO protocol id.
3235 */
33- function getFeedByIndex (uint256 _index )
34- external payable
35- returns (
36- uint256 _value ,
37- int8 _decimals ,
38- uint64 _timestamp
39- );
36+ function getFtsoProtocolId () external view returns (uint256 );
37+
38+ /**
39+ * Returns the list of supported feed ids (currently active feed ids).
40+ * To get the list of all available feed ids, combine with `getFeedIdChanges()`.
41+ * @return _feedIds The list of supported feed ids.
42+ */
43+ function getSupportedFeedIds () external view returns (bytes21 [] memory _feedIds );
44+
45+ /**
46+ * Returns the list of feed id changes.
47+ * @return _feedIdChanges The list of changed feed id pairs (old and new feed id).
48+ */
49+ function getFeedIdChanges () external view returns (FeedIdChange[] memory _feedIdChanges );
50+
51+ /**
52+ * Calculates the fee for fetching a feed.
53+ * @param _feedId The id of the feed.
54+ * @return _fee The fee for fetching the feed.
55+ */
56+ function calculateFeeById (bytes21 _feedId ) external view returns (uint256 _fee );
57+
58+ /**
59+ * Calculates the fee for fetching feeds.
60+ * @param _feedIds The list of feed ids.
61+ * @return _fee The fee for fetching the feeds.
62+ */
63+ function calculateFeeByIds (bytes21 [] memory _feedIds ) external view returns (uint256 _fee );
4064
4165 /**
4266 * Returns stored data of a feed.
@@ -54,23 +78,6 @@ interface FtsoV2Interface {
5478 uint64 _timestamp
5579 );
5680
57- /**
58- * Returns stored data of each feed.
59- * A fee (calculated by the FeeCalculator contract) may need to be paid.
60- * @param _indices Indices of the feeds, corresponding to feed ids in
61- * the FastUpdatesConfiguration contract.
62- * @return _values The list of values for the requested feeds.
63- * @return _decimals The list of decimal places for the requested feeds.
64- * @return _timestamp The timestamp of the last update.
65- */
66- function getFeedsByIndex (uint256 [] calldata _indices )
67- external payable
68- returns (
69- uint256 [] memory _values ,
70- int8 [] memory _decimals ,
71- uint64 _timestamp
72- );
73-
7481 /**
7582 * Returns stored data of each feed.
7683 * A fee (calculated by the FeeCalculator contract) may need to be paid.
@@ -79,31 +86,14 @@ interface FtsoV2Interface {
7986 * @return _decimals The list of decimal places for the requested feeds.
8087 * @return _timestamp The timestamp of the last update.
8188 */
82- function getFeedsById (bytes21 [] calldata _feedIds )
89+ function getFeedsById (bytes21 [] memory _feedIds )
8390 external payable
8491 returns (
8592 uint256 [] memory _values ,
8693 int8 [] memory _decimals ,
8794 uint64 _timestamp
8895 );
8996
90- /**
91- * Returns value in wei and timestamp of a feed.
92- * A fee (calculated by the FeeCalculator contract) may need to be paid.
93- * @param _index The index of the feed, corresponding to feed id in
94- * the FastUpdatesConfiguration contract.
95- * @return _value The value for the requested feed in wei (i.e. with 18 decimal places).
96- * @return _timestamp The timestamp of the last update.
97- */
98- function getFeedByIndexInWei (
99- uint256 _index
100- )
101- external payable
102- returns (
103- uint256 _value ,
104- uint64 _timestamp
105- );
106-
10797 /**
10898 * Returns value in wei and timestamp of a feed.
10999 * A fee (calculated by the FeeCalculator contract) may need to be paid.
@@ -118,51 +108,23 @@ interface FtsoV2Interface {
118108 uint64 _timestamp
119109 );
120110
121- /** Returns value in wei of each feed and a timestamp.
122- * For some feeds, a fee (calculated by the FeeCalculator contract) may need to be paid.
123- * @param _indices Indices of the feeds, corresponding to feed ids in
124- * the FastUpdatesConfiguration contract.
125- * @return _values The list of values for the requested feeds in wei (i.e. with 18 decimal places).
126- * @return _timestamp The timestamp of the last update.
127- */
128- function getFeedsByIndexInWei (uint256 [] calldata _indices )
129- external payable
130- returns (
131- uint256 [] memory _values ,
132- uint64 _timestamp
133- );
134-
135111 /** Returns value of each feed and a timestamp.
136112 * For some feeds, a fee (calculated by the FeeCalculator contract) may need to be paid.
137113 * @param _feedIds Ids of the feeds.
138114 * @return _values The list of values for the requested feeds in wei (i.e. with 18 decimal places).
139115 * @return _timestamp The timestamp of the last update.
140116 */
141- function getFeedsByIdInWei (bytes21 [] calldata _feedIds )
117+ function getFeedsByIdInWei (bytes21 [] memory _feedIds )
142118 external payable
143119 returns (
144120 uint256 [] memory _values ,
145121 uint64 _timestamp
146122 );
147123
148- /**
149- * Returns the index of a feed.
150- * @param _feedId The feed id.
151- * @return _index The index of the feed.
152- */
153- function getFeedIndex (bytes21 _feedId ) external view returns (uint256 _index );
154-
155- /**
156- * Returns the feed id at a given index. Removed (unused) feed index will return bytes21(0).
157- * @param _index The index.
158- * @return _feedId The feed id.
159- */
160- function getFeedId (uint256 _index ) external view returns (bytes21 _feedId );
161-
162124 /**
163125 * Checks if the feed data is valid (i.e. is part of the confirmed Merkle tree).
164126 * @param _feedData Structure containing data about the feed (FeedData structure) and Merkle proof.
165127 * @return true if the feed data is valid.
166128 */
167129 function verifyFeedData (FeedDataWithProof calldata _feedData ) external view returns (bool );
168- }
130+ }
0 commit comments