1
1
use ethabi;
2
2
3
3
use graph:: {
4
- data:: store:: { self , scalar:: Timestamp } ,
4
+ data:: {
5
+ store:: { self , scalar:: Timestamp } ,
6
+ subgraph:: API_VERSION_0_0_4 ,
7
+ } ,
5
8
runtime:: {
6
9
gas:: GasCounter , AscHeap , AscIndexId , AscType , AscValue , HostExportError ,
7
10
IndexForAscTypeId , ToAscObj ,
@@ -27,10 +30,10 @@ pub enum ArrayBuffer {
27
30
impl ArrayBuffer {
28
31
pub ( crate ) fn new < T : AscType > (
29
32
values : & [ T ] ,
30
- api_version : Version ,
33
+ api_version : & Version ,
31
34
) -> Result < Self , DeterministicHostError > {
32
35
match api_version {
33
- version if version <= Version :: new ( 0 , 0 , 4 ) => {
36
+ version if version <= & API_VERSION_0_0_4 => {
34
37
Ok ( Self :: ApiVersion0_0_4 ( v0_0_4:: ArrayBuffer :: new ( values) ?) )
35
38
}
36
39
_ => Ok ( Self :: ApiVersion0_0_5 ( v0_0_5:: ArrayBuffer :: new ( values) ?) ) ,
@@ -95,7 +98,7 @@ impl<T: AscValue> TypedArray<T> {
95
98
gas : & GasCounter ,
96
99
) -> Result < Self , HostExportError > {
97
100
match heap. api_version ( ) {
98
- version if version <= Version :: new ( 0 , 0 , 4 ) => Ok ( Self :: ApiVersion0_0_4 (
101
+ version if version <= & API_VERSION_0_0_4 => Ok ( Self :: ApiVersion0_0_4 (
99
102
v0_0_4:: TypedArray :: new ( content, heap, gas) ?,
100
103
) ) ,
101
104
_ => Ok ( Self :: ApiVersion0_0_5 ( v0_0_5:: TypedArray :: new (
@@ -201,9 +204,9 @@ pub enum AscString {
201
204
}
202
205
203
206
impl AscString {
204
- pub fn new ( content : & [ u16 ] , api_version : Version ) -> Result < Self , DeterministicHostError > {
207
+ pub fn new ( content : & [ u16 ] , api_version : & Version ) -> Result < Self , DeterministicHostError > {
205
208
match api_version {
206
- version if version <= Version :: new ( 0 , 0 , 4 ) => {
209
+ version if version <= & API_VERSION_0_0_4 => {
207
210
Ok ( Self :: ApiVersion0_0_4 ( v0_0_4:: AscString :: new ( content) ?) )
208
211
}
209
212
_ => Ok ( Self :: ApiVersion0_0_5 ( v0_0_5:: AscString :: new ( content) ?) ) ,
@@ -275,7 +278,7 @@ impl<T: AscValue> Array<T> {
275
278
gas : & GasCounter ,
276
279
) -> Result < Self , HostExportError > {
277
280
match heap. api_version ( ) {
278
- version if version <= Version :: new ( 0 , 0 , 4 ) => Ok ( Self :: ApiVersion0_0_4 (
281
+ version if version <= & API_VERSION_0_0_4 => Ok ( Self :: ApiVersion0_0_4 (
279
282
v0_0_4:: Array :: new ( content, heap, gas) ?,
280
283
) ) ,
281
284
_ => Ok ( Self :: ApiVersion0_0_5 ( v0_0_5:: Array :: new (
0 commit comments