11use ethabi;
22
33use graph:: {
4- data:: store:: { self , scalar:: Timestamp } ,
4+ data:: {
5+ store:: { self , scalar:: Timestamp } ,
6+ subgraph:: API_VERSION_0_0_4 ,
7+ } ,
58 runtime:: {
69 gas:: GasCounter , AscHeap , AscIndexId , AscType , AscValue , HostExportError ,
710 IndexForAscTypeId , ToAscObj ,
@@ -27,10 +30,10 @@ pub enum ArrayBuffer {
2730impl ArrayBuffer {
2831 pub ( crate ) fn new < T : AscType > (
2932 values : & [ T ] ,
30- api_version : Version ,
33+ api_version : & Version ,
3134 ) -> Result < Self , DeterministicHostError > {
3235 match api_version {
33- version if version <= Version :: new ( 0 , 0 , 4 ) => {
36+ version if version <= & API_VERSION_0_0_4 => {
3437 Ok ( Self :: ApiVersion0_0_4 ( v0_0_4:: ArrayBuffer :: new ( values) ?) )
3538 }
3639 _ => Ok ( Self :: ApiVersion0_0_5 ( v0_0_5:: ArrayBuffer :: new ( values) ?) ) ,
@@ -95,7 +98,7 @@ impl<T: AscValue> TypedArray<T> {
9598 gas : & GasCounter ,
9699 ) -> Result < Self , HostExportError > {
97100 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 (
99102 v0_0_4:: TypedArray :: new ( content, heap, gas) ?,
100103 ) ) ,
101104 _ => Ok ( Self :: ApiVersion0_0_5 ( v0_0_5:: TypedArray :: new (
@@ -201,9 +204,9 @@ pub enum AscString {
201204}
202205
203206impl 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 > {
205208 match api_version {
206- version if version <= Version :: new ( 0 , 0 , 4 ) => {
209+ version if version <= & API_VERSION_0_0_4 => {
207210 Ok ( Self :: ApiVersion0_0_4 ( v0_0_4:: AscString :: new ( content) ?) )
208211 }
209212 _ => Ok ( Self :: ApiVersion0_0_5 ( v0_0_5:: AscString :: new ( content) ?) ) ,
@@ -275,7 +278,7 @@ impl<T: AscValue> Array<T> {
275278 gas : & GasCounter ,
276279 ) -> Result < Self , HostExportError > {
277280 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 (
279282 v0_0_4:: Array :: new ( content, heap, gas) ?,
280283 ) ) ,
281284 _ => Ok ( Self :: ApiVersion0_0_5 ( v0_0_5:: Array :: new (
0 commit comments