Create a workspace and make clippy happy.
This commit is contained in:
@@ -13,9 +13,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anyhow"
|
name = "anyhow"
|
||||||
version = "1.0.80"
|
version = "1.0.81"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5ad32ce52e4161730f7098c077cd2ed6229b5804ccf99e5366be1ab72a98b4e1"
|
checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "arrayvec"
|
name = "arrayvec"
|
||||||
@@ -154,7 +154,24 @@ version = "17.2.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e4966fba78396ff92db3b817ee71143eccd98acf0f876b8d600e585a670c5d1b"
|
checksum = "e4966fba78396ff92db3b817ee71143eccd98acf0f876b8d600e585a670c5d1b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ethereum-types",
|
"ethereum-types 0.13.1",
|
||||||
|
"hex",
|
||||||
|
"once_cell",
|
||||||
|
"regex",
|
||||||
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
"sha3",
|
||||||
|
"thiserror",
|
||||||
|
"uint",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ethabi"
|
||||||
|
version = "18.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7413c5f74cc903ea37386a8965a936cbeb334bd270862fdece542c1b2dcbc898"
|
||||||
|
dependencies = [
|
||||||
|
"ethereum-types 0.14.1",
|
||||||
"hex",
|
"hex",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"regex",
|
"regex",
|
||||||
@@ -172,9 +189,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "11da94e443c60508eb62cf256243a64da87304c2802ac2528847f79d750007ef"
|
checksum = "11da94e443c60508eb62cf256243a64da87304c2802ac2528847f79d750007ef"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"crunchy",
|
"crunchy",
|
||||||
"fixed-hash",
|
"fixed-hash 0.7.0",
|
||||||
"impl-rlp",
|
"impl-rlp",
|
||||||
"impl-serde",
|
"impl-serde 0.3.2",
|
||||||
|
"tiny-keccak",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ethbloom"
|
||||||
|
version = "0.13.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c22d4b5885b6aa2fe5e8b9329fb8d232bf739e434e6b87347c63bdd00c120f60"
|
||||||
|
dependencies = [
|
||||||
|
"crunchy",
|
||||||
|
"fixed-hash 0.8.0",
|
||||||
|
"impl-rlp",
|
||||||
|
"impl-serde 0.4.0",
|
||||||
"tiny-keccak",
|
"tiny-keccak",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -184,11 +214,25 @@ version = "0.13.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b2827b94c556145446fcce834ca86b7abf0c39a805883fe20e72c5bfdb5a0dc6"
|
checksum = "b2827b94c556145446fcce834ca86b7abf0c39a805883fe20e72c5bfdb5a0dc6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ethbloom",
|
"ethbloom 0.12.1",
|
||||||
"fixed-hash",
|
"fixed-hash 0.7.0",
|
||||||
"impl-rlp",
|
"impl-rlp",
|
||||||
"impl-serde",
|
"impl-serde 0.3.2",
|
||||||
"primitive-types",
|
"primitive-types 0.11.1",
|
||||||
|
"uint",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ethereum-types"
|
||||||
|
version = "0.14.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "02d215cbf040552efcbe99a38372fe80ab9d00268e20012b79fcd0f073edd8ee"
|
||||||
|
dependencies = [
|
||||||
|
"ethbloom 0.13.0",
|
||||||
|
"fixed-hash 0.8.0",
|
||||||
|
"impl-rlp",
|
||||||
|
"impl-serde 0.4.0",
|
||||||
|
"primitive-types 0.12.2",
|
||||||
"uint",
|
"uint",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -210,6 +254,18 @@ dependencies = [
|
|||||||
"static_assertions",
|
"static_assertions",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fixed-hash"
|
||||||
|
version = "0.8.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534"
|
||||||
|
dependencies = [
|
||||||
|
"byteorder",
|
||||||
|
"rand",
|
||||||
|
"rustc-hex",
|
||||||
|
"static_assertions",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fixedbitset"
|
name = "fixedbitset"
|
||||||
version = "0.4.2"
|
version = "0.4.2"
|
||||||
@@ -267,6 +323,12 @@ version = "0.3.4"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0"
|
checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hex-literal"
|
||||||
|
version = "0.4.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "home"
|
name = "home"
|
||||||
version = "0.5.9"
|
version = "0.5.9"
|
||||||
@@ -303,6 +365,15 @@ dependencies = [
|
|||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "impl-serde"
|
||||||
|
version = "0.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd"
|
||||||
|
dependencies = [
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "impl-trait-for-tuples"
|
name = "impl-trait-for-tuples"
|
||||||
version = "0.2.2"
|
version = "0.2.2"
|
||||||
@@ -495,10 +566,23 @@ version = "0.11.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e28720988bff275df1f51b171e1b2a18c30d194c4d2b61defdacecd625a5d94a"
|
checksum = "e28720988bff275df1f51b171e1b2a18c30d194c4d2b61defdacecd625a5d94a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"fixed-hash",
|
"fixed-hash 0.7.0",
|
||||||
"impl-codec",
|
"impl-codec",
|
||||||
"impl-rlp",
|
"impl-rlp",
|
||||||
"impl-serde",
|
"impl-serde 0.3.2",
|
||||||
|
"uint",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "primitive-types"
|
||||||
|
version = "0.12.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0b34d9fd68ae0b74a41b21c03c2f62847aa0ffea044eee893b4c140b37e244e2"
|
||||||
|
dependencies = [
|
||||||
|
"fixed-hash 0.8.0",
|
||||||
|
"impl-codec",
|
||||||
|
"impl-rlp",
|
||||||
|
"impl-serde 0.4.0",
|
||||||
"uint",
|
"uint",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -514,9 +598,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
version = "1.0.78"
|
version = "1.0.79"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae"
|
checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"unicode-ident",
|
"unicode-ident",
|
||||||
]
|
]
|
||||||
@@ -528,7 +612,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd"
|
checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"prost-derive",
|
"prost-derive 0.11.9",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "prost"
|
||||||
|
version = "0.12.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "146c289cda302b98a28d40c8b3b90498d6e526dd24ac2ecea73e4e491685b94a"
|
||||||
|
dependencies = [
|
||||||
|
"bytes",
|
||||||
|
"prost-derive 0.12.3",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -545,8 +639,8 @@ dependencies = [
|
|||||||
"multimap",
|
"multimap",
|
||||||
"petgraph",
|
"petgraph",
|
||||||
"prettyplease",
|
"prettyplease",
|
||||||
"prost",
|
"prost 0.11.9",
|
||||||
"prost-types",
|
"prost-types 0.11.9",
|
||||||
"regex",
|
"regex",
|
||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
"tempfile",
|
"tempfile",
|
||||||
@@ -566,13 +660,35 @@ dependencies = [
|
|||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "prost-derive"
|
||||||
|
version = "0.12.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "efb6c9a1dd1def8e2124d17e83a20af56f1570d6c2d2bd9e266ccb768df3840e"
|
||||||
|
dependencies = [
|
||||||
|
"anyhow",
|
||||||
|
"itertools 0.10.5",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn 2.0.52",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "prost-types"
|
name = "prost-types"
|
||||||
version = "0.11.9"
|
version = "0.11.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "213622a1460818959ac1181aaeb2dc9c7f63df720db7d788b3e24eacd1983e13"
|
checksum = "213622a1460818959ac1181aaeb2dc9c7f63df720db7d788b3e24eacd1983e13"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"prost",
|
"prost 0.11.9",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "prost-types"
|
||||||
|
version = "0.12.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "193898f59edcf43c26227dcd4c8427f00d99d61e95dcde58dabd49fa291d470e"
|
||||||
|
dependencies = [
|
||||||
|
"prost 0.12.3",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -740,14 +856,14 @@ dependencies = [
|
|||||||
"anyhow",
|
"anyhow",
|
||||||
"bigdecimal",
|
"bigdecimal",
|
||||||
"hex",
|
"hex",
|
||||||
"hex-literal",
|
"hex-literal 0.3.4",
|
||||||
"num-bigint",
|
"num-bigint",
|
||||||
"num-integer",
|
"num-integer",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
"pad",
|
"pad",
|
||||||
"prost",
|
"prost 0.11.9",
|
||||||
"prost-build",
|
"prost-build",
|
||||||
"prost-types",
|
"prost-types 0.11.9",
|
||||||
"substreams-macro",
|
"substreams-macro",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
]
|
]
|
||||||
@@ -773,7 +889,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "9c04307913a355aaf2a1bb7186d4bc7e36875f3d4aff77b47e83f1b63b24da55"
|
checksum = "9c04307913a355aaf2a1bb7186d4bc7e36875f3d4aff77b47e83f1b63b24da55"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"ethabi",
|
"ethabi 17.2.0",
|
||||||
"heck",
|
"heck",
|
||||||
"hex",
|
"hex",
|
||||||
"prettyplease",
|
"prettyplease",
|
||||||
@@ -783,6 +899,25 @@ dependencies = [
|
|||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "substreams-ethereum-balancer"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"anyhow",
|
||||||
|
"bytes",
|
||||||
|
"ethabi 18.0.0",
|
||||||
|
"getrandom",
|
||||||
|
"hex",
|
||||||
|
"hex-literal 0.4.1",
|
||||||
|
"itertools 0.12.1",
|
||||||
|
"num-bigint",
|
||||||
|
"prost 0.11.9",
|
||||||
|
"prost-types 0.12.3",
|
||||||
|
"substreams",
|
||||||
|
"substreams-ethereum",
|
||||||
|
"tycho-substreams",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "substreams-ethereum-core"
|
name = "substreams-ethereum-core"
|
||||||
version = "0.9.9"
|
version = "0.9.9"
|
||||||
@@ -790,12 +925,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "db9048cc9a66873ab7069ef958c2684994e6ee323da49c186b19156fdb4ca131"
|
checksum = "db9048cc9a66873ab7069ef958c2684994e6ee323da49c186b19156fdb4ca131"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bigdecimal",
|
"bigdecimal",
|
||||||
"ethabi",
|
"ethabi 17.2.0",
|
||||||
"getrandom",
|
"getrandom",
|
||||||
"num-bigint",
|
"num-bigint",
|
||||||
"prost",
|
"prost 0.11.9",
|
||||||
"prost-build",
|
"prost-build",
|
||||||
"prost-types",
|
"prost-types 0.11.9",
|
||||||
"substreams",
|
"substreams",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -805,7 +940,7 @@ version = "0.9.9"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e862928bee8653f5c9291ac619c8dc0da14ca61d8cd8d89b3acdbbde4d0bf304"
|
checksum = "e862928bee8653f5c9291ac619c8dc0da14ca61d8cd8d89b3acdbbde4d0bf304"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ethabi",
|
"ethabi 17.2.0",
|
||||||
"heck",
|
"heck",
|
||||||
"hex",
|
"hex",
|
||||||
"num-bigint",
|
"num-bigint",
|
||||||
@@ -869,18 +1004,18 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thiserror"
|
name = "thiserror"
|
||||||
version = "1.0.57"
|
version = "1.0.58"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b"
|
checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"thiserror-impl",
|
"thiserror-impl",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thiserror-impl"
|
name = "thiserror-impl"
|
||||||
version = "1.0.57"
|
version = "1.0.58"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81"
|
checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -919,7 +1054,7 @@ version = "0.1.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"hex",
|
"hex",
|
||||||
"itertools 0.12.1",
|
"itertools 0.12.1",
|
||||||
"prost",
|
"prost 0.11.9",
|
||||||
"substreams",
|
"substreams",
|
||||||
"substreams-ethereum",
|
"substreams-ethereum",
|
||||||
]
|
]
|
||||||
22
substreams/Cargo.toml
Normal file
22
substreams/Cargo.toml
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
[workspace]
|
||||||
|
members = [
|
||||||
|
"ethereum-balancer",
|
||||||
|
"crates/tycho-substreams",
|
||||||
|
]
|
||||||
|
resolver = "2"
|
||||||
|
|
||||||
|
|
||||||
|
[workspace.dependencies]
|
||||||
|
substreams-ethereum = "0.9.9"
|
||||||
|
substreams = "0.5"
|
||||||
|
prost = "0.11"
|
||||||
|
prost-types = "0.12.3"
|
||||||
|
hex-literal = "0.4.1"
|
||||||
|
hex = "0.4.3"
|
||||||
|
ethabi = "18.0.0"
|
||||||
|
tycho-substreams = {path ="crates/tycho-substreams"}
|
||||||
|
|
||||||
|
[profile.release]
|
||||||
|
lto = true
|
||||||
|
opt-level = 's'
|
||||||
|
strip = "debuginfo"
|
||||||
@@ -4,8 +4,8 @@ version = "0.1.0"
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
substreams-ethereum = "0.9.9"
|
substreams-ethereum.workspace = true
|
||||||
substreams = "0.5"
|
substreams.workspace = true
|
||||||
prost = "0.11"
|
prost.workspace = true
|
||||||
hex = "0.4.3"
|
hex.workspace = true
|
||||||
itertools = "0.12.0"
|
itertools = "0.12.0"
|
||||||
@@ -63,6 +63,8 @@ pub fn store_balance_changes(deltas: BlockBalanceDeltas, store: impl StoreAdd<Bi
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type TxAggregatedBalances = HashMap<Vec<u8>, (Transaction, HashMap<Vec<u8>, BalanceChange>)>;
|
||||||
|
|
||||||
/// Aggregates absolute balances per transaction and token.
|
/// Aggregates absolute balances per transaction and token.
|
||||||
///
|
///
|
||||||
/// ## Arguments
|
/// ## Arguments
|
||||||
@@ -82,7 +84,7 @@ pub fn store_balance_changes(deltas: BlockBalanceDeltas, store: impl StoreAdd<Bi
|
|||||||
pub fn aggregate_balances_changes(
|
pub fn aggregate_balances_changes(
|
||||||
balance_store: StoreDeltas,
|
balance_store: StoreDeltas,
|
||||||
deltas: BlockBalanceDeltas,
|
deltas: BlockBalanceDeltas,
|
||||||
) -> HashMap<Vec<u8>, (Transaction, HashMap<Vec<u8>, BalanceChange>)> {
|
) -> TxAggregatedBalances {
|
||||||
balance_store
|
balance_store
|
||||||
.deltas
|
.deltas
|
||||||
.into_iter()
|
.into_iter()
|
||||||
@@ -207,9 +209,9 @@ mod tests {
|
|||||||
let token_1 = hex::decode("babe00").unwrap();
|
let token_1 = hex::decode("babe00").unwrap();
|
||||||
|
|
||||||
let t0_key =
|
let t0_key =
|
||||||
format!("{}:{}", String::from_utf8(comp_id.clone()).unwrap(), hex::encode(&token_0));
|
format!("{}:{}", String::from_utf8(comp_id.clone()).unwrap(), hex::encode(token_0));
|
||||||
let t1_key =
|
let t1_key =
|
||||||
format!("{}:{}", String::from_utf8(comp_id.clone()).unwrap(), hex::encode(&token_1));
|
format!("{}:{}", String::from_utf8(comp_id.clone()).unwrap(), hex::encode(token_1));
|
||||||
StoreDeltas {
|
StoreDeltas {
|
||||||
deltas: vec![
|
deltas: vec![
|
||||||
StoreDelta {
|
StoreDelta {
|
||||||
@@ -283,12 +285,12 @@ mod tests {
|
|||||||
let res_0 = store.get_last(format!(
|
let res_0 = store.get_last(format!(
|
||||||
"{}:{}",
|
"{}:{}",
|
||||||
String::from_utf8(comp_id.clone()).unwrap(),
|
String::from_utf8(comp_id.clone()).unwrap(),
|
||||||
hex::encode(&token_0)
|
hex::encode(token_0)
|
||||||
));
|
));
|
||||||
let res_1 = store.get_last(format!(
|
let res_1 = store.get_last(format!(
|
||||||
"{}:{}",
|
"{}:{}",
|
||||||
String::from_utf8(comp_id.clone()).unwrap(),
|
String::from_utf8(comp_id.clone()).unwrap(),
|
||||||
hex::encode(&token_1)
|
hex::encode(token_1)
|
||||||
));
|
));
|
||||||
|
|
||||||
assert_eq!(res_0, Some(BigInt::from_str("+999").unwrap()));
|
assert_eq!(res_0, Some(BigInt::from_str("+999").unwrap()));
|
||||||
|
|||||||
@@ -49,11 +49,7 @@ impl InterimContractChange {
|
|||||||
balance: vec![],
|
balance: vec![],
|
||||||
code: vec![],
|
code: vec![],
|
||||||
slots: Default::default(),
|
slots: Default::default(),
|
||||||
change: if creation {
|
change: if creation { tycho::ChangeType::Creation } else { tycho::ChangeType::Update },
|
||||||
tycho::ChangeType::Creation.into()
|
|
||||||
} else {
|
|
||||||
tycho::ChangeType::Update.into()
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,9 +7,11 @@ use std::rc::Rc;
|
|||||||
use substreams::prelude::{BigInt, StoreDelete, StoreGet, StoreNew};
|
use substreams::prelude::{BigInt, StoreDelete, StoreGet, StoreNew};
|
||||||
use substreams::store::StoreAdd;
|
use substreams::store::StoreAdd;
|
||||||
|
|
||||||
|
type BigIntStore = HashMap<String, Vec<(u64, BigInt)>>;
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct MockStore {
|
pub struct MockStore {
|
||||||
data: Rc<RefCell<HashMap<String, Vec<(u64, BigInt)>>>>,
|
data: Rc<RefCell<BigIntStore>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl StoreDelete for MockStore {
|
impl StoreDelete for MockStore {
|
||||||
|
|||||||
1281
substreams/ethereum-balancer/Cargo.lock
generated
1281
substreams/ethereum-balancer/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -8,18 +8,18 @@ name = "substreams_ethereum_balancer"
|
|||||||
crate-type = ["cdylib"]
|
crate-type = ["cdylib"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
substreams = "0.5"
|
substreams.workspace = true
|
||||||
substreams-ethereum = "0.9.9"
|
substreams-ethereum.workspace = true
|
||||||
prost = "0.11"
|
prost.workspace = true
|
||||||
hex-literal = "0.4.1"
|
prost-types.workspace = true
|
||||||
ethabi = "18.0.0"
|
hex-literal.workspace = true
|
||||||
hex = "0.4.2"
|
ethabi.workspace = true
|
||||||
|
hex.workspace = true
|
||||||
bytes = "1.5.0"
|
bytes = "1.5.0"
|
||||||
anyhow = "1.0.75"
|
anyhow = "1.0.75"
|
||||||
prost-types = "0.12.3"
|
|
||||||
num-bigint = "0.4.4"
|
num-bigint = "0.4.4"
|
||||||
itertools = "0.12.0"
|
itertools = "0.12.0"
|
||||||
tycho-substreams = {path ="../crates/tycho-substreams"}
|
tycho-substreams.workspace = true
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
anyhow = "1"
|
anyhow = "1"
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ pub fn map_changes(
|
|||||||
let tx = tx_component.tx.as_ref().unwrap();
|
let tx = tx_component.tx.as_ref().unwrap();
|
||||||
transaction_contract_changes
|
transaction_contract_changes
|
||||||
.entry(tx.index)
|
.entry(tx.index)
|
||||||
.or_insert_with(|| TransactionContractChanges::new(&tx))
|
.or_insert_with(|| TransactionContractChanges::new(tx))
|
||||||
.component_changes
|
.component_changes
|
||||||
.extend_from_slice(&tx_component.components);
|
.extend_from_slice(&tx_component.components);
|
||||||
});
|
});
|
||||||
@@ -188,7 +188,7 @@ pub fn map_changes(
|
|||||||
.entry(tx.index)
|
.entry(tx.index)
|
||||||
.or_insert_with(|| TransactionContractChanges::new(&tx))
|
.or_insert_with(|| TransactionContractChanges::new(&tx))
|
||||||
.balance_changes
|
.balance_changes
|
||||||
.extend(balances.into_iter().map(|(_, change)| change));
|
.extend(balances.into_values());
|
||||||
});
|
});
|
||||||
|
|
||||||
// Extract and insert any storage changes that happened for any of the components.
|
// Extract and insert any storage changes that happened for any of the components.
|
||||||
@@ -196,7 +196,7 @@ pub fn map_changes(
|
|||||||
&block,
|
&block,
|
||||||
|addr| {
|
|addr| {
|
||||||
components_store
|
components_store
|
||||||
.get_last(format!("pool:{0}", hex::encode(&addr)))
|
.get_last(format!("pool:{0}", hex::encode(addr)))
|
||||||
.is_some()
|
.is_some()
|
||||||
},
|
},
|
||||||
&mut transaction_contract_changes,
|
&mut transaction_contract_changes,
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ pub fn address_map(
|
|||||||
abi::weighted_pool_factory::events::PoolCreated::match_and_decode(log)?;
|
abi::weighted_pool_factory::events::PoolCreated::match_and_decode(log)?;
|
||||||
|
|
||||||
Some(
|
Some(
|
||||||
ProtocolComponent::at_contract(&pool_created.pool, &tx)
|
ProtocolComponent::at_contract(&pool_created.pool, tx)
|
||||||
.with_tokens(&create_call.tokens)
|
.with_tokens(&create_call.tokens)
|
||||||
.with_attributes(&[
|
.with_attributes(&[
|
||||||
("pool_type", "WeightedPoolFactory".as_bytes()),
|
("pool_type", "WeightedPoolFactory".as_bytes()),
|
||||||
@@ -72,7 +72,7 @@ pub fn address_map(
|
|||||||
abi::composable_stable_pool_factory::events::PoolCreated::match_and_decode(log)?;
|
abi::composable_stable_pool_factory::events::PoolCreated::match_and_decode(log)?;
|
||||||
|
|
||||||
Some(
|
Some(
|
||||||
ProtocolComponent::at_contract(&pool_created.pool, &tx)
|
ProtocolComponent::at_contract(&pool_created.pool, tx)
|
||||||
.with_tokens(&create_call.tokens)
|
.with_tokens(&create_call.tokens)
|
||||||
.with_attributes(&[("pool_type", "ComposableStablePoolFactory".as_bytes())])
|
.with_attributes(&[("pool_type", "ComposableStablePoolFactory".as_bytes())])
|
||||||
.as_swap_type("balancer_pool", ImplementationType::Vm),
|
.as_swap_type("balancer_pool", ImplementationType::Vm),
|
||||||
@@ -85,7 +85,7 @@ pub fn address_map(
|
|||||||
abi::erc_linear_pool_factory::events::PoolCreated::match_and_decode(log)?;
|
abi::erc_linear_pool_factory::events::PoolCreated::match_and_decode(log)?;
|
||||||
|
|
||||||
Some(
|
Some(
|
||||||
ProtocolComponent::at_contract(&pool_created.pool, &tx)
|
ProtocolComponent::at_contract(&pool_created.pool, tx)
|
||||||
.with_tokens(&[create_call.main_token, create_call.wrapped_token])
|
.with_tokens(&[create_call.main_token, create_call.wrapped_token])
|
||||||
.with_attributes(&[
|
.with_attributes(&[
|
||||||
("pool_type", "ERC4626LinearPoolFactory".as_bytes()),
|
("pool_type", "ERC4626LinearPoolFactory".as_bytes()),
|
||||||
@@ -104,7 +104,7 @@ pub fn address_map(
|
|||||||
abi::euler_linear_pool_factory::events::PoolCreated::match_and_decode(log)?;
|
abi::euler_linear_pool_factory::events::PoolCreated::match_and_decode(log)?;
|
||||||
|
|
||||||
Some(
|
Some(
|
||||||
ProtocolComponent::at_contract(&pool_created.pool, &tx)
|
ProtocolComponent::at_contract(&pool_created.pool, tx)
|
||||||
.with_tokens(&[create_call.main_token, create_call.wrapped_token])
|
.with_tokens(&[create_call.main_token, create_call.wrapped_token])
|
||||||
.with_attributes(&[
|
.with_attributes(&[
|
||||||
("pool_type", "EulerLinearPoolFactory".as_bytes()),
|
("pool_type", "EulerLinearPoolFactory".as_bytes()),
|
||||||
@@ -170,7 +170,7 @@ pub fn address_map(
|
|||||||
abi::silo_linear_pool_factory::events::PoolCreated::match_and_decode(log)?;
|
abi::silo_linear_pool_factory::events::PoolCreated::match_and_decode(log)?;
|
||||||
|
|
||||||
Some(
|
Some(
|
||||||
ProtocolComponent::at_contract(&pool_created.pool, &tx)
|
ProtocolComponent::at_contract(&pool_created.pool, tx)
|
||||||
.with_tokens(&[create_call.main_token, create_call.wrapped_token])
|
.with_tokens(&[create_call.main_token, create_call.wrapped_token])
|
||||||
.with_attributes(&[
|
.with_attributes(&[
|
||||||
("pool_type", "SiloLinearPoolFactory".as_bytes()),
|
("pool_type", "SiloLinearPoolFactory".as_bytes()),
|
||||||
@@ -189,7 +189,7 @@ pub fn address_map(
|
|||||||
abi::yearn_linear_pool_factory::events::PoolCreated::match_and_decode(log)?;
|
abi::yearn_linear_pool_factory::events::PoolCreated::match_and_decode(log)?;
|
||||||
|
|
||||||
Some(
|
Some(
|
||||||
ProtocolComponent::at_contract(&pool_created.pool, &tx)
|
ProtocolComponent::at_contract(&pool_created.pool, tx)
|
||||||
.with_tokens(&[create_call.main_token, create_call.wrapped_token])
|
.with_tokens(&[create_call.main_token, create_call.wrapped_token])
|
||||||
.with_attributes(&[
|
.with_attributes(&[
|
||||||
("pool_type", "YearnLinearPoolFactory".as_bytes()),
|
("pool_type", "YearnLinearPoolFactory".as_bytes()),
|
||||||
@@ -210,7 +210,7 @@ pub fn address_map(
|
|||||||
abi::weighted_pool_tokens_factory::events::PoolCreated::match_and_decode(log)?;
|
abi::weighted_pool_tokens_factory::events::PoolCreated::match_and_decode(log)?;
|
||||||
|
|
||||||
Some(
|
Some(
|
||||||
ProtocolComponent::at_contract(&pool_created.pool, &tx)
|
ProtocolComponent::at_contract(&pool_created.pool, tx)
|
||||||
.with_tokens(&create_call.tokens)
|
.with_tokens(&create_call.tokens)
|
||||||
.with_attributes(&[
|
.with_attributes(&[
|
||||||
("pool_type", "WeightedPool2TokensFactory".as_bytes()),
|
("pool_type", "WeightedPool2TokensFactory".as_bytes()),
|
||||||
|
|||||||
@@ -9,5 +9,6 @@ trailing_semicolon = false
|
|||||||
use_field_init_shorthand = true
|
use_field_init_shorthand = true
|
||||||
chain_width = 40
|
chain_width = 40
|
||||||
ignore = [
|
ignore = [
|
||||||
"src/pb",
|
"*/pb",
|
||||||
|
"*/abi",
|
||||||
]
|
]
|
||||||
Reference in New Issue
Block a user