Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 48 additions & 4 deletions apps/chain_pusher/pkg/fuel/bindings/fuel_ffi/stork-abi.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@
"concreteTypeId": "9a7f1d3e963c10e0a4ea70a8e20a4813d1dc5682e28f74cb102ae50d32f7f98c",
"metadataTypeId": 13
},
{
"type": "struct std::vec::Vec<b256>",
"concreteTypeId": "32559685d0c9845f059bf9d472a0a38cf77d36c23dfcffe5489e86a65cdd9198",
"metadataTypeId": 16,
"typeArguments": [
"7c5ee1cecf5f8eacd1284feb5f0bf2bdea533a51e2f0c9aabe9236d335989f3b"
]
},
{
"type": "struct std::vec::Vec<struct stork_sway_sdk::interface::TemporalNumericValueInput>",
"concreteTypeId": "e67278f564f3da524afebc87950681dff66e11946370df7f4c68b5f01329590b",
Expand All @@ -62,6 +70,14 @@
"672654baba0e998dd82f818c92c2b544c9275ee09007b0f65f59195a94a916d6"
]
},
{
"type": "struct std::vec::Vec<struct stork_sway_sdk::temporal_numeric_value::TemporalNumericValue>",
"concreteTypeId": "872137d0d4d329e1a5711b34dd5a31a31277c08d54727a431ddc614863a15eda",
"metadataTypeId": 16,
"typeArguments": [
"6972e006137b782c482ffc099e21cc55fce9151a2096dd6582df22c9dc81bd9c"
]
},
{
"type": "struct std::vm::evm::evm_address::EvmAddress",
"concreteTypeId": "05a44d8c3e00faf7ed545823b7a2b32723545d8715d87a0ab3cf65904948e8d2",
Expand Down Expand Up @@ -406,6 +422,24 @@
}
]
},
{
"name": "get_temporal_numeric_values_unchecked_v1",
"inputs": [
{
"name": "ids",
"concreteTypeId": "32559685d0c9845f059bf9d472a0a38cf77d36c23dfcffe5489e86a65cdd9198"
}
],
"output": "872137d0d4d329e1a5711b34dd5a31a31277c08d54727a431ddc614863a15eda",
"attributes": [
{
"name": "storage",
"arguments": [
"read"
]
}
]
},
{
"name": "get_update_fee_v1",
"inputs": [
Expand Down Expand Up @@ -648,6 +682,16 @@
"msg": null
},
"18446744069414584321": {
"pos": {
"pkg": "stork",
"file": "src/main.sw",
"line": 253,
"column": 21
},
"logId": "5142315946124958513",
"msg": null
},
"18446744069414584322": {
"pos": {
"pkg": "stork",
"file": "src/main.sw",
Expand All @@ -657,7 +701,7 @@
"logId": "5142315946124958513",
"msg": null
},
"18446744069414584322": {
"18446744069414584323": {
"pos": {
"pkg": "stork",
"file": "src/main.sw",
Expand All @@ -667,7 +711,7 @@
"logId": "5142315946124958513",
"msg": null
},
"18446744069414584323": {
"18446744069414584324": {
"pos": {
"pkg": "stork",
"file": "src/main.sw",
Expand All @@ -677,7 +721,7 @@
"logId": "5142315946124958513",
"msg": null
},
"18446744069414584324": {
"18446744069414584325": {
"pos": {
"pkg": "stork",
"file": "src/main.sw",
Expand All @@ -688,4 +732,4 @@
"msg": null
}
}
}
}
50 changes: 47 additions & 3 deletions chains/fuel/contracts/stork/artifacts/stork-abi.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@
"concreteTypeId": "9a7f1d3e963c10e0a4ea70a8e20a4813d1dc5682e28f74cb102ae50d32f7f98c",
"metadataTypeId": 13
},
{
"type": "struct std::vec::Vec<b256>",
"concreteTypeId": "32559685d0c9845f059bf9d472a0a38cf77d36c23dfcffe5489e86a65cdd9198",
"metadataTypeId": 16,
"typeArguments": [
"7c5ee1cecf5f8eacd1284feb5f0bf2bdea533a51e2f0c9aabe9236d335989f3b"
]
},
{
"type": "struct std::vec::Vec<struct stork_sway_sdk::interface::TemporalNumericValueInput>",
"concreteTypeId": "e67278f564f3da524afebc87950681dff66e11946370df7f4c68b5f01329590b",
Expand All @@ -62,6 +70,14 @@
"672654baba0e998dd82f818c92c2b544c9275ee09007b0f65f59195a94a916d6"
]
},
{
"type": "struct std::vec::Vec<struct stork_sway_sdk::temporal_numeric_value::TemporalNumericValue>",
"concreteTypeId": "872137d0d4d329e1a5711b34dd5a31a31277c08d54727a431ddc614863a15eda",
"metadataTypeId": 16,
"typeArguments": [
"6972e006137b782c482ffc099e21cc55fce9151a2096dd6582df22c9dc81bd9c"
]
},
{
"type": "struct std::vm::evm::evm_address::EvmAddress",
"concreteTypeId": "05a44d8c3e00faf7ed545823b7a2b32723545d8715d87a0ab3cf65904948e8d2",
Expand Down Expand Up @@ -406,6 +422,24 @@
}
]
},
{
"name": "get_temporal_numeric_values_unchecked_v1",
"inputs": [
{
"name": "ids",
"concreteTypeId": "32559685d0c9845f059bf9d472a0a38cf77d36c23dfcffe5489e86a65cdd9198"
}
],
"output": "872137d0d4d329e1a5711b34dd5a31a31277c08d54727a431ddc614863a15eda",
"attributes": [
{
"name": "storage",
"arguments": [
"read"
]
}
]
},
{
"name": "get_update_fee_v1",
"inputs": [
Expand Down Expand Up @@ -648,6 +682,16 @@
"msg": null
},
"18446744069414584321": {
"pos": {
"pkg": "stork",
"file": "src/main.sw",
"line": 253,
"column": 21
},
"logId": "5142315946124958513",
"msg": null
},
"18446744069414584322": {
"pos": {
"pkg": "stork",
"file": "src/main.sw",
Expand All @@ -657,7 +701,7 @@
"logId": "5142315946124958513",
"msg": null
},
"18446744069414584322": {
"18446744069414584323": {
"pos": {
"pkg": "stork",
"file": "src/main.sw",
Expand All @@ -667,7 +711,7 @@
"logId": "5142315946124958513",
"msg": null
},
"18446744069414584323": {
"18446744069414584324": {
"pos": {
"pkg": "stork",
"file": "src/main.sw",
Expand All @@ -677,7 +721,7 @@
"logId": "5142315946124958513",
"msg": null
},
"18446744069414584324": {
"18446744069414584325": {
"pos": {
"pkg": "stork",
"file": "src/main.sw",
Expand Down
17 changes: 17 additions & 0 deletions chains/fuel/contracts/stork/src/main.sw
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,23 @@ impl Stork for Contract {
latest_value
}

#[storage(read)]
fn get_temporal_numeric_values_unchecked_v1(ids: Vec<b256>) -> Vec<TemporalNumericValue> {
let mut values = Vec::new();
let mut i = 0;
while i < ids.len() {
let id = ids.get(i).unwrap();
values.push(match latest_canonical_temporal_numeric_value(id) {
Ok(value) => value,
Err(error) => {
panic error;
}
});
i += 1;
}
values
}

fn version() -> String {
return String::from_ascii_str("1.0.0");
}
Expand Down
22 changes: 22 additions & 0 deletions chains/fuel/contracts/stork/tests/harness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,17 @@ async fn test_update_temporal_numeric_value_v1_valid() {
.value;
assert_eq!(temporal_numeric_value.timestamp_ns, recv_time);
assert_eq!(temporal_numeric_value.quantized_value, quantized_value);

// get the temporal numeric values
let temporal_numeric_values = stork_instance
.methods()
.get_temporal_numeric_values_unchecked_v1(vec![id])
.call()
.await
.unwrap()
.value;
assert_eq!(temporal_numeric_values[0].timestamp_ns, recv_time);
assert_eq!(temporal_numeric_values[0].quantized_value, quantized_value);
}

#[tokio::test]
Expand Down Expand Up @@ -624,6 +635,17 @@ async fn test_update_temporal_numeric_value_v1_negative() {
.value;
assert_eq!(temporal_numeric_value.timestamp_ns, recv_time);
assert_eq!(temporal_numeric_value.quantized_value, quantized_value);

// get the temporal numeric values
let temporal_numeric_values = stork_instance
.methods()
.get_temporal_numeric_values_unchecked_v1(vec![id])
.call()
.await
.unwrap()
.value;
assert_eq!(temporal_numeric_values[0].timestamp_ns, recv_time);
assert_eq!(temporal_numeric_values[0].quantized_value, quantized_value);
}

#[tokio::test]
Expand Down
3 changes: 3 additions & 0 deletions chains/fuel/sdks/stork_sway_sdk/src/interface.sw
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ abi Stork {
#[storage(read)]
fn get_temporal_numeric_value_unchecked_v1(id: b256) -> TemporalNumericValue;

#[storage(read)]
fn get_temporal_numeric_values_unchecked_v1(ids: Vec<b256>) -> Vec<TemporalNumericValue>;

fn version() -> String;

#[storage(read, write)]
Expand Down
Loading