feat: upgrade tycho deps in protocol-testing
This commit is contained in:
42
protocol-testing/Cargo.lock
generated
42
protocol-testing/Cargo.lock
generated
@@ -2809,7 +2809,7 @@ dependencies = [
|
|||||||
"libc",
|
"libc",
|
||||||
"option-ext",
|
"option-ext",
|
||||||
"redox_users",
|
"redox_users",
|
||||||
"windows-sys 0.59.0",
|
"windows-sys 0.60.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -4590,7 +4590,7 @@ checksum = "e04d7f318608d35d4b61ddd75cbdaee86b023ebe2bd5a66ee0915f0bf93095a9"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"hermit-abi 0.5.2",
|
"hermit-abi 0.5.2",
|
||||||
"libc",
|
"libc",
|
||||||
"windows-sys 0.52.0",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -4650,7 +4650,7 @@ dependencies = [
|
|||||||
"portable-atomic",
|
"portable-atomic",
|
||||||
"portable-atomic-util",
|
"portable-atomic-util",
|
||||||
"serde",
|
"serde",
|
||||||
"windows-sys 0.52.0",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -5891,7 +5891,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "8a56d757972c98b346a9b766e3f02746cde6dd1cd1d1d563472929fdd74bec4d"
|
checksum = "8a56d757972c98b346a9b766e3f02746cde6dd1cd1d1d563472929fdd74bec4d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"itertools 0.10.5",
|
"itertools 0.14.0",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.99",
|
"syn 2.0.99",
|
||||||
@@ -5904,7 +5904,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "9120690fafc389a67ba3803df527d0ec9cbbc9cc45e4cc20b332996dfb672425"
|
checksum = "9120690fafc389a67ba3803df527d0ec9cbbc9cc45e4cc20b332996dfb672425"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"itertools 0.10.5",
|
"itertools 0.14.0",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.99",
|
"syn 2.0.99",
|
||||||
@@ -6008,7 +6008,7 @@ dependencies = [
|
|||||||
"quinn-udp",
|
"quinn-udp",
|
||||||
"rustc-hash",
|
"rustc-hash",
|
||||||
"rustls",
|
"rustls",
|
||||||
"socket2 0.5.8",
|
"socket2 0.6.0",
|
||||||
"thiserror 2.0.12",
|
"thiserror 2.0.12",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tracing",
|
"tracing",
|
||||||
@@ -6045,9 +6045,9 @@ dependencies = [
|
|||||||
"cfg_aliases",
|
"cfg_aliases",
|
||||||
"libc",
|
"libc",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"socket2 0.5.8",
|
"socket2 0.6.0",
|
||||||
"tracing",
|
"tracing",
|
||||||
"windows-sys 0.52.0",
|
"windows-sys 0.60.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -7343,7 +7343,7 @@ dependencies = [
|
|||||||
"derive_more",
|
"derive_more",
|
||||||
"dunce",
|
"dunce",
|
||||||
"inturn",
|
"inturn",
|
||||||
"itertools 0.10.5",
|
"itertools 0.14.0",
|
||||||
"itoa",
|
"itoa",
|
||||||
"match_cfg",
|
"match_cfg",
|
||||||
"normalize-path",
|
"normalize-path",
|
||||||
@@ -7352,7 +7352,7 @@ dependencies = [
|
|||||||
"solar-config",
|
"solar-config",
|
||||||
"solar-data-structures",
|
"solar-data-structures",
|
||||||
"solar-macros",
|
"solar-macros",
|
||||||
"thiserror 1.0.69",
|
"thiserror 2.0.12",
|
||||||
"tracing",
|
"tracing",
|
||||||
"unicode-width 0.2.0",
|
"unicode-width 0.2.0",
|
||||||
]
|
]
|
||||||
@@ -7377,7 +7377,7 @@ dependencies = [
|
|||||||
"alloy-primitives",
|
"alloy-primitives",
|
||||||
"bitflags 2.9.4",
|
"bitflags 2.9.4",
|
||||||
"bumpalo",
|
"bumpalo",
|
||||||
"itertools 0.10.5",
|
"itertools 0.14.0",
|
||||||
"memchr",
|
"memchr",
|
||||||
"num-bigint",
|
"num-bigint",
|
||||||
"num-rational",
|
"num-rational",
|
||||||
@@ -7647,7 +7647,7 @@ dependencies = [
|
|||||||
"serde_json",
|
"serde_json",
|
||||||
"sha2 0.10.9",
|
"sha2 0.10.9",
|
||||||
"tempfile",
|
"tempfile",
|
||||||
"thiserror 1.0.69",
|
"thiserror 2.0.12",
|
||||||
"url",
|
"url",
|
||||||
"zip",
|
"zip",
|
||||||
]
|
]
|
||||||
@@ -8380,9 +8380,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tycho-client"
|
name = "tycho-client"
|
||||||
version = "0.82.0"
|
version = "0.83.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "19a7ed885ea7e01efc3c98135b1be5c0472e81ada6455517f61ca67313271587"
|
checksum = "3da113f5301ba1fb8e4441df405afa1e7b728a83017681b94851c5bc36d758dc"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
@@ -8407,9 +8407,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tycho-common"
|
name = "tycho-common"
|
||||||
version = "0.82.0"
|
version = "0.83.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "096c87ebe011785fcd7ed59ec501ac12b465a64fbd2914b8c0c57125c253682b"
|
checksum = "75ecbbf6f701a01569e351d19ee3a3e36418e8d1be539fd6ed925137eb84a2b2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
@@ -8432,9 +8432,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tycho-execution"
|
name = "tycho-execution"
|
||||||
version = "0.122.0"
|
version = "0.124.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "81e88fe8ee0d32032e0270804c8fd8d4b56fa5055daa6a64720cd4c39c3984e1"
|
checksum = "9da3bca6f82da18f6e59a995ba1dfe416a070a0e0a1dc58ef5bc5a9f288de783"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"alloy",
|
"alloy",
|
||||||
"chrono",
|
"chrono",
|
||||||
@@ -8454,8 +8454,8 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tycho-simulation"
|
name = "tycho-simulation"
|
||||||
version = "0.157.1"
|
version = "0.158.0"
|
||||||
source = "git+https://github.com/propeller-heads/tycho-simulation.git?tag=0.157.1#02ef8fbdfde4cc0f65f08880e108f292643acb64"
|
source = "git+https://github.com/propeller-heads/tycho-simulation.git?tag=0.158.0#bf864f437c9eb3014449146b86628c2251adce61"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"alloy",
|
"alloy",
|
||||||
"async-stream",
|
"async-stream",
|
||||||
@@ -9053,7 +9053,7 @@ version = "0.1.11"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
|
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-sys 0.52.0",
|
"windows-sys 0.60.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ miette = { version = "7.6.0", features = ["fancy"] }
|
|||||||
# Logging & Tracing
|
# Logging & Tracing
|
||||||
tracing = "0.1.37"
|
tracing = "0.1.37"
|
||||||
# Tycho dependencies
|
# Tycho dependencies
|
||||||
tycho-common = "0.82.0"
|
tycho-common = "0.83.4"
|
||||||
tycho-client = "0.82.0"
|
tycho-client = "0.83.4"
|
||||||
tycho-simulation = { git = "https://github.com/propeller-heads/tycho-simulation.git", tag = "0.157.1", features = ["evm"] }
|
tycho-simulation = { git = "https://github.com/propeller-heads/tycho-simulation.git", tag = "0.158.0", features = ["evm"] }
|
||||||
## TODO: for local development
|
## TODO: for local development
|
||||||
#tycho-simulation = { path = "../../tycho-simulation" }
|
#tycho-simulation = { path = "../../tycho-simulation" }
|
||||||
num-bigint = "0.4"
|
num-bigint = "0.4"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ FROM rust:1.89-bookworm AS tycho-indexer-builder
|
|||||||
WORKDIR /build
|
WORKDIR /build
|
||||||
RUN apt-get update && apt-get install -y git
|
RUN apt-get update && apt-get install -y git
|
||||||
|
|
||||||
RUN git clone --depth 1 --branch "0.83.3" https://github.com/propeller-heads/tycho-indexer.git
|
RUN git clone --depth 1 --branch "0.83.4" https://github.com/propeller-heads/tycho-indexer.git
|
||||||
WORKDIR /build/tycho-indexer
|
WORKDIR /build/tycho-indexer
|
||||||
RUN cargo build --release --bin tycho-indexer
|
RUN cargo build --release --bin tycho-indexer
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
use alloy::{primitives::Keccak256, sol_types::SolValue};
|
use alloy::{primitives::Keccak256, sol_types::SolValue};
|
||||||
|
use miette::{miette, IntoDiagnostic, WrapErr};
|
||||||
use num_bigint::BigUint;
|
use num_bigint::BigUint;
|
||||||
use tycho_common::{dto::Chain, Bytes};
|
use tycho_common::{dto::Chain, Bytes};
|
||||||
use tycho_simulation::{
|
use tycho_simulation::{
|
||||||
@@ -17,35 +18,36 @@ use tycho_simulation::{
|
|||||||
|
|
||||||
/// Encodes swap data for the Tycho router.
|
/// Encodes swap data for the Tycho router.
|
||||||
///
|
///
|
||||||
/// Assumes a single swap solution and encodes the data ready to be used by the Tycho router directly.
|
/// Assumes a single swap solution and encodes the data ready to be used by the Tycho router
|
||||||
|
/// directly.
|
||||||
///
|
///
|
||||||
/// # Parameters
|
/// # Parameters
|
||||||
/// - `component`: The protocol component to swap through
|
/// - `component`: The protocol component to swap through
|
||||||
/// - `token_in`: Input token address
|
/// - `token_in`: Input token address
|
||||||
/// - `token_out`: Output token address
|
/// - `token_out`: Output token address
|
||||||
/// - `amount_in`: Amount of input token to swap
|
/// - `amount_in`: Amount of input token to swap
|
||||||
/// - `amount_out`: Expected amount of output token
|
/// - `amount_out`: Expected amount of output token
|
||||||
///
|
///
|
||||||
/// # Returns
|
/// # Returns
|
||||||
/// A `Result<Transaction, EncodingError>` containing the encoded transaction data for the Tycho router,
|
/// A `Result<Transaction>` containing the encoded transaction data for the Tycho
|
||||||
/// or an error if encoding fails.
|
/// router, or an error if encoding fails.
|
||||||
pub fn encode_swap(
|
pub fn encode_swap(
|
||||||
component: ProtocolComponent,
|
component: ProtocolComponent,
|
||||||
token_in: Bytes,
|
token_in: Bytes,
|
||||||
token_out: Bytes,
|
token_out: Bytes,
|
||||||
amount_in: BigUint,
|
amount_in: BigUint,
|
||||||
amount_out: BigUint,
|
amount_out: BigUint,
|
||||||
) -> Result<Transaction, EncodingError> {
|
) -> miette::Result<Transaction> {
|
||||||
let chain: tycho_common::models::Chain = Chain::Ethereum.into();
|
let chain: tycho_common::models::Chain = Chain::Ethereum.into();
|
||||||
let alice_address =
|
let alice_address = Bytes::from_str("0xcd09f75E2BF2A4d11F3AB23f1389FcC1621c0cc2")
|
||||||
Bytes::from_str("0xcd09f75E2BF2A4d11F3AB23f1389FcC1621c0cc2").map_err(|_| {
|
.into_diagnostic()
|
||||||
EncodingError::FatalError("Alice's address can't be converted to Bytes".to_string())
|
.wrap_err(miette!("Failed to parse Alice's address for Tycho router encoding"))?;
|
||||||
})?;
|
|
||||||
let encoder = TychoRouterEncoderBuilder::new()
|
let encoder = TychoRouterEncoderBuilder::new()
|
||||||
.chain(chain)
|
.chain(chain)
|
||||||
.user_transfer_type(UserTransferType::TransferFrom)
|
.user_transfer_type(UserTransferType::TransferFrom)
|
||||||
.build()
|
.build()
|
||||||
.expect("Failed to build encoder");
|
.into_diagnostic()
|
||||||
|
.wrap_err(miette!("Failed to build encoder"))?;
|
||||||
|
|
||||||
let swap = SwapBuilder::new(component, token_in.clone(), token_out.clone()).build();
|
let swap = SwapBuilder::new(component, token_in.clone(), token_out.clone()).build();
|
||||||
|
|
||||||
@@ -69,10 +71,12 @@ pub fn encode_swap(
|
|||||||
|
|
||||||
let encoded_solution = encoder
|
let encoded_solution = encoder
|
||||||
.encode_solutions(vec![solution.clone()])
|
.encode_solutions(vec![solution.clone()])
|
||||||
.expect("Failed to encode router calldata")[0]
|
.into_diagnostic()
|
||||||
|
.wrap_err(miette!("Failed to encode router calldata"))?[0]
|
||||||
.clone();
|
.clone();
|
||||||
|
|
||||||
encode_tycho_router_call(encoded_solution, &solution, &chain.wrapped_native_token().address)
|
encode_tycho_router_call(encoded_solution, &solution, &chain.wrapped_native_token().address)
|
||||||
|
.into_diagnostic()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Encodes a transaction for the Tycho Router using `singleSwap` method and regular token
|
/// Encodes a transaction for the Tycho Router using `singleSwap` method and regular token
|
||||||
|
|||||||
@@ -533,13 +533,13 @@ fn validate_state(
|
|||||||
|
|
||||||
let protocol_component = block_msg.new_pairs.get(id);
|
let protocol_component = block_msg.new_pairs.get(id);
|
||||||
if let Some(pc) = protocol_component {
|
if let Some(pc) = protocol_component {
|
||||||
let calldata = encode_swap(
|
encode_swap(
|
||||||
pc.clone(),
|
pc.clone(),
|
||||||
token_in.address.clone(),
|
token_in.address.clone(),
|
||||||
token_out.address.clone(),
|
token_out.address.clone(),
|
||||||
amount_in,
|
amount_in,
|
||||||
amount_out_result.amount,
|
amount_out_result.amount,
|
||||||
);
|
)?;
|
||||||
info!("Encoded swap successfully");
|
info!("Encoded swap successfully");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user