From 1b19428eb6c6affeddbdbc42fdfddaf2ef1bf3f8 Mon Sep 17 00:00:00 2001 From: Felix Leupold Date: Wed, 11 Oct 2023 16:51:37 +0200 Subject: [PATCH] [Trivial] Set Paraswap partner in price query (#1942) # Description We are seeing a lot of rate limits in the Paraswap solver likely because we are not setting the partner in the price query. This PR fixes this. We were already setting it in the transaction query. --- crates/solvers/src/infra/dex/paraswap/dto.rs | 4 ++++ crates/solvers/src/tests/paraswap/market_order.rs | 4 ++-- crates/solvers/src/tests/paraswap/out_of_price.rs | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/crates/solvers/src/infra/dex/paraswap/dto.rs b/crates/solvers/src/infra/dex/paraswap/dto.rs index 79c11c13f2..4b061d143d 100644 --- a/crates/solvers/src/infra/dex/paraswap/dto.rs +++ b/crates/solvers/src/infra/dex/paraswap/dto.rs @@ -46,6 +46,9 @@ pub struct PriceQuery { /// The network ID. pub network: String, + + /// The partner name + pub partner: String, } impl PriceQuery { @@ -70,6 +73,7 @@ impl PriceQuery { amount: order.amount.get(), exclude_dexs: config.exclude_dexs.clone(), network: "1".to_owned(), + partner: config.partner.clone(), }) } } diff --git a/crates/solvers/src/tests/paraswap/market_order.rs b/crates/solvers/src/tests/paraswap/market_order.rs index 108e13958c..02f67e7556 100644 --- a/crates/solvers/src/tests/paraswap/market_order.rs +++ b/crates/solvers/src/tests/paraswap/market_order.rs @@ -11,7 +11,7 @@ async fn sell() { let api = mock::http::setup(vec![ mock::http::Expectation::Get { path: mock::http::Path::exact( - "prices?srcToken=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2&destToken=0xe41d2489571d322189246dafa5ebde1f4699f498&srcDecimals=18&destDecimals=18&amount=1000000000000000000&side=SELL&excludeDexs=UniswapV2&network=1", + "prices?srcToken=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2&destToken=0xe41d2489571d322189246dafa5ebde1f4699f498&srcDecimals=18&destDecimals=18&amount=1000000000000000000&side=SELL&excludeDexs=UniswapV2&network=1&partner=cow", ), res: json!({ "priceRoute": { @@ -249,7 +249,7 @@ async fn buy() { let api = mock::http::setup(vec![ mock::http::Expectation::Get { path: mock::http::Path::exact( - "prices?srcToken=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2&destToken=0xe41d2489571d322189246dafa5ebde1f4699f498&srcDecimals=18&destDecimals=18&amount=1000000000000000000000&side=BUY&excludeDexs=UniswapV2&network=1", + "prices?srcToken=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2&destToken=0xe41d2489571d322189246dafa5ebde1f4699f498&srcDecimals=18&destDecimals=18&amount=1000000000000000000000&side=BUY&excludeDexs=UniswapV2&network=1&partner=cow", ), res: json!({ "priceRoute": { diff --git a/crates/solvers/src/tests/paraswap/out_of_price.rs b/crates/solvers/src/tests/paraswap/out_of_price.rs index 14b53e6b8a..fe78fdb580 100644 --- a/crates/solvers/src/tests/paraswap/out_of_price.rs +++ b/crates/solvers/src/tests/paraswap/out_of_price.rs @@ -14,7 +14,7 @@ async fn sell() { let api = mock::http::setup(vec![ mock::http::Expectation::Get { path: mock::http::Path::exact( - "prices?srcToken=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2&destToken=0xe41d2489571d322189246dafa5ebde1f4699f498&srcDecimals=18&destDecimals=18&amount=1000000000000000000&side=SELL&excludeDexs=UniswapV2&network=1", + "prices?srcToken=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2&destToken=0xe41d2489571d322189246dafa5ebde1f4699f498&srcDecimals=18&destDecimals=18&amount=1000000000000000000&side=SELL&excludeDexs=UniswapV2&network=1&partner=cow", ), res: json!({ "priceRoute": { @@ -207,7 +207,7 @@ async fn buy() { let api = mock::http::setup(vec![ mock::http::Expectation::Get { path: mock::http::Path::exact( - "prices?srcToken=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2&destToken=0xe41d2489571d322189246dafa5ebde1f4699f498&srcDecimals=18&destDecimals=18&amount=1000000000000000000000&side=BUY&excludeDexs=UniswapV2&network=1", + "prices?srcToken=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2&destToken=0xe41d2489571d322189246dafa5ebde1f4699f498&srcDecimals=18&destDecimals=18&amount=1000000000000000000000&side=BUY&excludeDexs=UniswapV2&network=1&partner=cow", ), res: json!({ "priceRoute": {