Skip to content

Commit bdbf91d

Browse files
committed
runtime: Add support for ethabi Tuple with to from asc conversions
1 parent 3bed471 commit bdbf91d

File tree

5 files changed

+13
-6
lines changed

5 files changed

+13
-6
lines changed

Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

graph/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ diesel = { version = "1.3.2", features = ["postgres", "serde_json", "numeric", "
1414
# But, graph-patches also contains Jannis' https://github.com/paritytech/ethabi/pull/140 PR
1515
# to ethabi. Which we believe will not get merged. For now, we shall deviate from ethabi,
1616
# but long term we want to avoid forking off ethabi if possible
17-
ethabi = { git = "https://github.com/graphprotocol/ethabi.git", branch = "graph-patches" }
17+
ethabi = { git = "https://github.com/graphprotocol/ethabi.git", branch = "ford/tuple" }
1818
hex = "0.3.2"
1919
futures = "0.1.21"
2020
graphql-parser = "0.2.1"

runtime/wasm/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ edition = "2018"
99
# But, graph-patches also contains Jannis' https://github.com/paritytech/ethabi/pull/140 PR
1010
# to ethabi. Which we believe will not get merged. For now, we shall deviate from ethabi,
1111
# but long term we want to avoid forking off ethabi if possible
12-
ethabi = { git = "https://github.com/graphprotocol/ethabi.git", branch = "graph-patches" }
12+
ethabi = { git = "https://github.com/graphprotocol/ethabi.git", branch = "ford/tuple" }
1313
futures = "0.1.21"
1414
hex = "0.3.2"
1515
graph = { path = "../../graph" }

runtime/wasm/src/asc_abi/class.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@ pub(crate) enum EthereumValueKind {
311311
String,
312312
FixedArray,
313313
Array,
314+
Tuple,
314315
}
315316

316317
impl EthereumValueKind {
@@ -325,6 +326,7 @@ impl EthereumValueKind {
325326
ethabi::Token::String(_) => EthereumValueKind::String,
326327
ethabi::Token::FixedArray(_) => EthereumValueKind::FixedArray,
327328
ethabi::Token::Array(_) => EthereumValueKind::Array,
329+
ethabi::Token::Tuple(_) => EthereumValueKind::Tuple,
328330
}
329331
}
330332
}

runtime/wasm/src/to_from/external.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ impl ToAscObj<AscEnum<EthereumValueKind>> for ethabi::Token {
9898
Bool(b) => *b as u64,
9999
String(string) => heap.asc_new(&**string).to_payload(),
100100
FixedArray(tokens) | Array(tokens) => heap.asc_new(&**tokens).to_payload(),
101+
Tuple(tokens) => heap.asc_new(&**tokens).to_payload(),
101102
};
102103

103104
AscEnum {
@@ -149,6 +150,10 @@ impl FromAscObj<AscEnum<EthereumValueKind>> for ethabi::Token {
149150
let ptr: AscEnumArray<EthereumValueKind> = AscPtr::from(payload);
150151
Token::Array(heap.asc_get(ptr))
151152
}
153+
EthereumValueKind::Tuple=> {
154+
let ptr: AscEnumArray<EthereumValueKind> = AscPtr::from(payload);
155+
Token::Tuple(heap.asc_get(ptr))
156+
}
152157
}
153158
}
154159
}

0 commit comments

Comments
 (0)