Merge pull request #89 from propeller-heads/lp/uniswap-v2-be-encoding
feat: Convert uniswap v2 attributes to big endian encoding
This commit is contained in:
6
.github/workflows/substream.cd.yaml
vendored
6
.github/workflows/substream.cd.yaml
vendored
@@ -9,6 +9,10 @@ on:
|
|||||||
package:
|
package:
|
||||||
required: true
|
required: true
|
||||||
description: "Package to build"
|
description: "Package to build"
|
||||||
|
config_file:
|
||||||
|
required: false
|
||||||
|
description: "Path to the substreams configuration file"
|
||||||
|
default: "substreams.yaml"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Release:
|
Release:
|
||||||
@@ -42,4 +46,4 @@ jobs:
|
|||||||
- name: Run checks
|
- name: Run checks
|
||||||
run: |
|
run: |
|
||||||
cd substreams
|
cd substreams
|
||||||
./release.sh ${{ inputs.package }}
|
./release.sh ${{ inputs.package }} ${{ inputs.config_file }}
|
||||||
|
|||||||
38
substreams/Cargo.lock
generated
38
substreams/Cargo.lock
generated
@@ -288,6 +288,25 @@ dependencies = [
|
|||||||
"uint",
|
"uint",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ethereum-uniswap-v2"
|
||||||
|
version = "0.3.0"
|
||||||
|
dependencies = [
|
||||||
|
"anyhow",
|
||||||
|
"ethabi 18.0.0",
|
||||||
|
"getrandom",
|
||||||
|
"hex-literal 0.4.1",
|
||||||
|
"itertools 0.12.1",
|
||||||
|
"num-bigint",
|
||||||
|
"prost 0.11.9",
|
||||||
|
"serde",
|
||||||
|
"serde_qs",
|
||||||
|
"substreams",
|
||||||
|
"substreams-ethereum",
|
||||||
|
"substreams-helper",
|
||||||
|
"tycho-substreams",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fastrand"
|
name = "fastrand"
|
||||||
version = "2.0.1"
|
version = "2.0.1"
|
||||||
@@ -1039,25 +1058,6 @@ dependencies = [
|
|||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "substreams-ethereum-uniswap-v2"
|
|
||||||
version = "0.2.1"
|
|
||||||
dependencies = [
|
|
||||||
"anyhow",
|
|
||||||
"ethabi 18.0.0",
|
|
||||||
"getrandom",
|
|
||||||
"hex-literal 0.4.1",
|
|
||||||
"itertools 0.12.1",
|
|
||||||
"num-bigint",
|
|
||||||
"prost 0.11.9",
|
|
||||||
"serde",
|
|
||||||
"serde_qs",
|
|
||||||
"substreams",
|
|
||||||
"substreams-ethereum",
|
|
||||||
"substreams-helper",
|
|
||||||
"tycho-substreams",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "substreams-ethereum-uniswap-v3"
|
name = "substreams-ethereum-uniswap-v3"
|
||||||
version = "0.2.1"
|
version = "0.2.1"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "substreams-ethereum-uniswap-v2"
|
name = "ethereum-uniswap-v2"
|
||||||
version = "0.2.1"
|
version = "0.3.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
specVersion: v0.1.0
|
specVersion: v0.1.0
|
||||||
package:
|
package:
|
||||||
name: "ethereum_uniswap_v2"
|
name: "ethereum_uniswap_v2"
|
||||||
version: v0.2.1
|
version: v0.3.0
|
||||||
|
|
||||||
protobuf:
|
protobuf:
|
||||||
files:
|
files:
|
||||||
@@ -15,7 +15,7 @@ protobuf:
|
|||||||
binaries:
|
binaries:
|
||||||
default:
|
default:
|
||||||
type: wasm/rust-v1
|
type: wasm/rust-v1
|
||||||
file: ../../target/wasm32-unknown-unknown/substreams/ethereum_uniswap_v2.wasm
|
file: ../target/wasm32-unknown-unknown/release/ethereum_uniswap_v2.wasm
|
||||||
|
|
||||||
modules:
|
modules:
|
||||||
- name: map_pools_created
|
- name: map_pools_created
|
||||||
|
|||||||
@@ -46,12 +46,12 @@ fn get_pools(block: ð::Block, new_pools: &mut Vec<TransactionChanges>, params
|
|||||||
attributes: vec![
|
attributes: vec![
|
||||||
Attribute {
|
Attribute {
|
||||||
name: "reserve0".to_string(),
|
name: "reserve0".to_string(),
|
||||||
value: BigInt::from(0).to_signed_bytes_le(),
|
value: BigInt::from(0).to_signed_bytes_be(),
|
||||||
change: ChangeType::Creation.into(),
|
change: ChangeType::Creation.into(),
|
||||||
},
|
},
|
||||||
Attribute {
|
Attribute {
|
||||||
name: "reserve1".to_string(),
|
name: "reserve1".to_string(),
|
||||||
value: BigInt::from(0).to_signed_bytes_le(),
|
value: BigInt::from(0).to_signed_bytes_be(),
|
||||||
change: ChangeType::Creation.into(),
|
change: ChangeType::Creation.into(),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -64,7 +64,7 @@ fn get_pools(block: ð::Block, new_pools: &mut Vec<TransactionChanges>, params
|
|||||||
// Trading Fee is hardcoded to 0.3%, saved as int in bps (basis points)
|
// Trading Fee is hardcoded to 0.3%, saved as int in bps (basis points)
|
||||||
Attribute {
|
Attribute {
|
||||||
name: "fee".to_string(),
|
name: "fee".to_string(),
|
||||||
value: BigInt::from(30).to_signed_bytes_le(),
|
value: BigInt::from(30).to_signed_bytes_be(),
|
||||||
change: ChangeType::Creation.into(),
|
change: ChangeType::Creation.into(),
|
||||||
},
|
},
|
||||||
Attribute {
|
Attribute {
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ fn handle_sync(
|
|||||||
name: attribute_name,
|
name: attribute_name,
|
||||||
value: reserve_bytes
|
value: reserve_bytes
|
||||||
.clone()
|
.clone()
|
||||||
.to_signed_bytes_le(), //TODO: Unify bytes encoding (either be or le)
|
.to_signed_bytes_be(),
|
||||||
change: ChangeType::Update.into(),
|
change: ChangeType::Update.into(),
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ if [ -n "$current_tag" ]; then
|
|||||||
# Semantic version
|
# Semantic version
|
||||||
version="${BASH_REMATCH[2]}"
|
version="${BASH_REMATCH[2]}"
|
||||||
|
|
||||||
cargo_version=$(cargo pkgid -p ethereum-balancer | cut -d# -f2 | cut -d: -f2)
|
cargo_version=$(cargo pkgid -p "$package" | cut -d# -f2 | cut -d: -f2)
|
||||||
if [[ "$cargo_version" != "$version" ]]; then
|
if [[ "$cargo_version" != "$version" ]]; then
|
||||||
echo "Error: Cargo version: ${cargo_version} does not match tag version: ${version}!"
|
echo "Error: Cargo version: ${cargo_version} does not match tag version: ${version}!"
|
||||||
exit 1
|
exit 1
|
||||||
@@ -52,9 +52,18 @@ fi
|
|||||||
REPOSITORY=${REPOSITORY:-"s3://repo.propellerheads/substreams"}
|
REPOSITORY=${REPOSITORY:-"s3://repo.propellerheads/substreams"}
|
||||||
repository_path="$REPOSITORY/$package/$package-$version.spkg"
|
repository_path="$REPOSITORY/$package/$package-$version.spkg"
|
||||||
|
|
||||||
|
# Optional input for yaml file; defaults to substreams.yaml if not provided
|
||||||
|
yaml_file=${2:-"substreams.yaml"}
|
||||||
|
|
||||||
|
if [[ ! -f "$package/$yaml_file" ]]; then
|
||||||
|
echo "Error: manifest reader: unable to stat input file $yaml_file: file does not exist."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
set -e # Exit the script if any command fails
|
||||||
cargo build --target wasm32-unknown-unknown --release -p "$package"
|
cargo build --target wasm32-unknown-unknown --release -p "$package"
|
||||||
mkdir -p ./target/spkg/
|
mkdir -p ./target/spkg/
|
||||||
substreams pack $package/substreams.yaml -o ./target/spkg/$package-$version.spkg
|
substreams pack "$package/$yaml_file" -o ./target/spkg/$package-$version.spkg
|
||||||
aws s3 cp ./target/spkg/$package-$version.spkg $repository_path
|
aws s3 cp ./target/spkg/$package-$version.spkg $repository_path
|
||||||
|
|
||||||
echo "Released substreams package: '$repository_path'"
|
echo "Released substreams package: '$repository_path'"
|
||||||
|
|||||||
Reference in New Issue
Block a user