Skip to content

Commit 942f5ed

Browse files
committed
v0.1.20
1 parent ef98a99 commit 942f5ed

File tree

6 files changed

+198
-0
lines changed

6 files changed

+198
-0
lines changed

src/coston/ContractRegistry.sol

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ import {RewardsV2Interface} from "./RewardsV2Interface.sol";
4141
import {IFdcVerification} from "./IFdcVerification.sol";
4242
import {IFdcHub} from "./IFdcHub.sol";
4343
import {IFdcRequestFeeConfigurations} from "./IFdcRequestFeeConfigurations.sol";
44+
import {IJsonApiVerification} from "./IJsonApiVerification.sol";
4445
// END AUTO GENERATED - DO NOT EDIT ABOVE THIS LINE
4546

4647
// Library is intended to be used inline, so the strings are all memory allocated (instead of calldata)
@@ -480,5 +481,14 @@ library ContractRegistry {
480481
);
481482
}
482483

484+
// Returns hardcoded unofficial deployment instances of Flare core contracts
485+
function auxiliaryGetIJsonApiVerification()
486+
internal
487+
pure
488+
returns (IJsonApiVerification)
489+
{
490+
return IJsonApiVerification(0x206D83e3a24523De1E43Ab56AC8f7b9b10f6ab89);
491+
}
492+
483493
// END AUTO GENERATED - DO NOT EDIT ABOVE THIS LINE
484494
}

src/coston/IJsonApi.sol

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity >=0.7.6 <0.9;
3+
4+
/**
5+
* @custom:name IJsonApi
6+
* @custom:supported WEB2
7+
* @author Flare
8+
* @notice An attestation request that fetches data from the given url and then edits the information with a
9+
* jq transformation.
10+
* @custom:verification Data is fetched from an url `url`. The received data is then processed with jq as
11+
* the `postprocessJq` states. The structure of the final json is written in the `abi_signature`.
12+
*
13+
* The response contains an abi encoding of the final data.
14+
* @custom:lut `0xffffffffffffffff`
15+
* @custom:lut-limit `0xffffffffffffffff`
16+
*/
17+
interface IJsonApi {
18+
/**
19+
* @notice Toplevel request
20+
* @param attestationType ID of the attestation type.
21+
* @param sourceId ID of the data source.
22+
* @param messageIntegrityCode `MessageIntegrityCode` that is derived from the expected response.
23+
* @param requestBody Data defining the request. Type (struct) and interpretation is determined
24+
* by the `attestationType`.
25+
*/
26+
struct Request {
27+
bytes32 attestationType;
28+
bytes32 sourceId;
29+
bytes32 messageIntegrityCode;
30+
RequestBody requestBody;
31+
}
32+
33+
/**
34+
* @notice Toplevel response
35+
* @param attestationType Extracted from the request.
36+
* @param sourceId Extracted from the request.
37+
* @param votingRound The ID of the State Connector round in which the request was considered.
38+
* @param lowestUsedTimestamp The lowest timestamp used to generate the response.
39+
* @param requestBody Extracted from the request.
40+
* @param responseBody Data defining the response. The verification rules for the construction
41+
* of the response body and the type are defined per specific `attestationType`.
42+
*/
43+
struct Response {
44+
bytes32 attestationType;
45+
bytes32 sourceId;
46+
uint64 votingRound;
47+
uint64 lowestUsedTimestamp;
48+
RequestBody requestBody;
49+
ResponseBody responseBody;
50+
}
51+
52+
/**
53+
* @notice Toplevel proof
54+
* @param merkleProof Merkle proof corresponding to the attestation response.
55+
* @param data Attestation response.
56+
*/
57+
struct Proof {
58+
bytes32[] merkleProof;
59+
Response data;
60+
}
61+
62+
/**
63+
* @notice Request body for Payment attestation type
64+
* @param url URL of the data source
65+
* @param postprocessJq jq filter to postprocess the data
66+
* @param abi_signature ABI signature of the data
67+
*/
68+
struct RequestBody {
69+
string url;
70+
string postprocessJq;
71+
string abi_signature;
72+
}
73+
74+
/**
75+
* @notice Response body for Payment attestation type
76+
* @param abi_encoded_data ABI encoded data
77+
*/
78+
struct ResponseBody {
79+
bytes abi_encoded_data;
80+
}
81+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity 0.8.20;
3+
4+
import "./IJsonApi.sol";
5+
6+
interface IJsonApiVerification {
7+
function verifyJsonApi(IJsonApi.Proof calldata _proof) external view returns (bool _proved);
8+
}

src/coston2/ContractRegistry.sol

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ import {RewardsV2Interface} from "./RewardsV2Interface.sol";
4949
import {IFdcVerification} from "./IFdcVerification.sol";
5050
import {IFdcHub} from "./IFdcHub.sol";
5151
import {IFdcRequestFeeConfigurations} from "./IFdcRequestFeeConfigurations.sol";
52+
import {IJsonApiVerification} from "./IJsonApiVerification.sol";
5253
// END AUTO GENERATED - DO NOT EDIT ABOVE THIS LINE
5354

5455
// Library is intended to be used inline, so the strings are all memory allocated (instead of calldata)
@@ -576,5 +577,14 @@ library ContractRegistry {
576577
);
577578
}
578579

580+
// Returns hardcoded unofficial deployment instances of Flare core contracts
581+
function auxiliaryGetIJsonApiVerification()
582+
internal
583+
pure
584+
returns (IJsonApiVerification)
585+
{
586+
return IJsonApiVerification(0x07ad8508C9173DC845817472Ca0484035AbFA3c8);
587+
}
588+
579589
// END AUTO GENERATED - DO NOT EDIT ABOVE THIS LINE
580590
}

src/coston2/IJsonApi.sol

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity >=0.7.6 <0.9;
3+
4+
/**
5+
* @custom:name IJsonApi
6+
* @custom:supported WEB2
7+
* @author Flare
8+
* @notice An attestation request that fetches data from the given url and then edits the information with a
9+
* jq transformation.
10+
* @custom:verification Data is fetched from an url `url`. The received data is then processed with jq as
11+
* the `postprocessJq` states. The structure of the final json is written in the `abi_signature`.
12+
*
13+
* The response contains an abi encoding of the final data.
14+
* @custom:lut `0xffffffffffffffff`
15+
* @custom:lut-limit `0xffffffffffffffff`
16+
*/
17+
interface IJsonApi {
18+
/**
19+
* @notice Toplevel request
20+
* @param attestationType ID of the attestation type.
21+
* @param sourceId ID of the data source.
22+
* @param messageIntegrityCode `MessageIntegrityCode` that is derived from the expected response.
23+
* @param requestBody Data defining the request. Type (struct) and interpretation is determined
24+
* by the `attestationType`.
25+
*/
26+
struct Request {
27+
bytes32 attestationType;
28+
bytes32 sourceId;
29+
bytes32 messageIntegrityCode;
30+
RequestBody requestBody;
31+
}
32+
33+
/**
34+
* @notice Toplevel response
35+
* @param attestationType Extracted from the request.
36+
* @param sourceId Extracted from the request.
37+
* @param votingRound The ID of the State Connector round in which the request was considered.
38+
* @param lowestUsedTimestamp The lowest timestamp used to generate the response.
39+
* @param requestBody Extracted from the request.
40+
* @param responseBody Data defining the response. The verification rules for the construction
41+
* of the response body and the type are defined per specific `attestationType`.
42+
*/
43+
struct Response {
44+
bytes32 attestationType;
45+
bytes32 sourceId;
46+
uint64 votingRound;
47+
uint64 lowestUsedTimestamp;
48+
RequestBody requestBody;
49+
ResponseBody responseBody;
50+
}
51+
52+
/**
53+
* @notice Toplevel proof
54+
* @param merkleProof Merkle proof corresponding to the attestation response.
55+
* @param data Attestation response.
56+
*/
57+
struct Proof {
58+
bytes32[] merkleProof;
59+
Response data;
60+
}
61+
62+
/**
63+
* @notice Request body for Payment attestation type
64+
* @param url URL of the data source
65+
* @param postprocessJq jq filter to postprocess the data
66+
* @param abi_signature ABI signature of the data
67+
*/
68+
struct RequestBody {
69+
string url;
70+
string postprocessJq;
71+
string abi_signature;
72+
}
73+
74+
/**
75+
* @notice Response body for Payment attestation type
76+
* @param abi_encoded_data ABI encoded data
77+
*/
78+
struct ResponseBody {
79+
bytes abi_encoded_data;
80+
}
81+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity 0.8.20;
3+
4+
import "./IJsonApi.sol";
5+
6+
interface IJsonApiVerification {
7+
function verifyJsonApi(IJsonApi.Proof calldata _proof) external view returns (bool _proved);
8+
}

0 commit comments

Comments
 (0)