Merge branch 'main' into router/tnl/ENG-4046-static-call-verifier

This commit is contained in:
Tamara
2025-01-27 10:08:39 -05:00
committed by GitHub
4 changed files with 60 additions and 5 deletions

View File

@@ -1,3 +1,15 @@
## [0.16.0](https://github.com/propeller-heads/tycho-execution/compare/0.15.0...0.16.0) (2025-01-27)
### Features
* add balance v2 encoder test ([9cecea8](https://github.com/propeller-heads/tycho-execution/commit/9cecea896833b27ec855f1ea4d981dde64f869ac))
### Bug Fixes
* async ([7c198ff](https://github.com/propeller-heads/tycho-execution/commit/7c198fff92bb6bb8858912008d0bb40364d8bcd6))
## [0.15.0](https://github.com/propeller-heads/tycho-execution/compare/0.14.0...0.15.0) (2025-01-24)

2
Cargo.lock generated
View File

@@ -4163,7 +4163,7 @@ dependencies = [
[[package]]
name = "tycho-execution"
version = "0.15.0"
version = "0.16.0"
dependencies = [
"alloy",
"alloy-primitives",

View File

@@ -1,6 +1,6 @@
[package]
name = "tycho-execution"
version = "0.15.0"
version = "0.16.0"
edition = "2021"
[dependencies]

View File

@@ -106,7 +106,7 @@ impl SwapEncoder for BalancerV2SwapEncoder {
encoding_context.exact_out,
approval_needed,
);
Ok(args.abi_encode())
Ok(args.abi_encode_packed())
}
fn executor_address(&self) -> &str {
@@ -121,8 +121,8 @@ mod tests {
use super::*;
#[tokio::test]
async fn test_encode_uniswap_v2() {
#[test]
fn test_encode_uniswap_v2() {
let usv2_pool = ProtocolComponent {
id: String::from("0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640"),
..Default::default()
@@ -159,4 +159,47 @@ mod tests {
))
);
}
#[test]
fn test_encode_balancer_v2() {
let balancer_pool = ProtocolComponent {
id: String::from("0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640"),
protocol_system: String::from("vm:balancer_v2"),
..Default::default()
};
let swap = Swap {
component: balancer_pool,
token_in: Bytes::from("0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"), // WETH
token_out: Bytes::from("0x6b175474e89094c44da98b954eedeac495271d0f"), // DAI
split: 0f64,
};
let encoding_context = EncodingContext {
receiver: Bytes::from("0x0000000000000000000000000000000000000001"),
exact_out: false,
router_address: Bytes::zero(20),
};
let encoder = BalancerV2SwapEncoder::new(String::from("0x"));
let encoded_swap = encoder
.encode_swap(swap, encoding_context)
.unwrap();
let hex_swap = encode(&encoded_swap);
assert_eq!(
hex_swap,
String::from(concat!(
// token in
"c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
// token out
"6b175474e89094c44da98b954eedeac495271d0f",
// pool id
"307838386536413063326444443236464545623634463033396132633431323936466342336635363430",
// receiver
"0000000000000000000000000000000000000001",
// exact out
"00",
// approval needed
"01"
))
);
}
}