cowprotocol / dune-bridge

Other
4 stars 3 forks source link

Paresing appdata with json format v3 #11

Closed josojo closed 2 years ago

josojo commented 2 years ago

A new app_data version was introduced, in order to have the quotes stored in the order metadata.

By not going strictly with the new version, but having just some optional fields, we are able to be compatible with all version, without version specific parsing.

Later on, we can introduce a json parsing depending on the different version - maybe with this lib. But I think this complexity is not yet needed.

Testplan:

Use the following distinct_app_data.json:

{
    "app_data": [
        {
            "appdata": "\"0xcb29f9a9c4a32b88f860b55af807040732d8c3730e400648a208c06d63695b97\""
        },
        {
            "appdata": "\"0x0124a4fd6b0d94dcb40bc25b6b41c86f3136f2e4139c6f179d5b8eb99364dd38\""
        }
    ],
    "time_of_download": 1653892135
}

in ./data/app_data. The first app_data has the version 1 and the other has the verison 3. Version 2 test is not needed, as this version was never live and no order was ever created with it

And then run:

cargo run -- --retrys-for-ipfs-file-fetching=3 

and you can inspect the newly created file app_data_referral_relationship for the downloaded data.