Skip to content

Commit

Permalink
[Trivial] Set Paraswap partner in price query (#1942)
Browse files Browse the repository at this point in the history
# 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.
  • Loading branch information
fleupold authored Oct 11, 2023
1 parent 0ac7c81 commit 1b19428
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions crates/solvers/src/infra/dex/paraswap/dto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ pub struct PriceQuery {

/// The network ID.
pub network: String,

/// The partner name
pub partner: String,
}

impl PriceQuery {
Expand All @@ -70,6 +73,7 @@ impl PriceQuery {
amount: order.amount.get(),
exclude_dexs: config.exclude_dexs.clone(),
network: "1".to_owned(),
partner: config.partner.clone(),
})
}
}
Expand Down
4 changes: 2 additions & 2 deletions crates/solvers/src/tests/paraswap/market_order.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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": {
Expand Down
4 changes: 2 additions & 2 deletions crates/solvers/src/tests/paraswap/out_of_price.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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": {
Expand Down

0 comments on commit 1b19428

Please sign in to comment.