-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fetch 0x limit orders liquidity (#2210)
# Description Adds 0x liquidity fetcher # Changes - New config for the fetcher - Requires changes in `infra` to provide api-key ## How to test TBD ## Related Issues Fixes #1666
- Loading branch information
1 parent
e197242
commit 0c2973e
Showing
7 changed files
with
91 additions
and
10 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
use { | ||
crate::{infra, infra::Ethereum}, | ||
ethrpc::current_block::CurrentBlockStream, | ||
shared::{http_client::HttpClientFactory, zeroex_api::DefaultZeroExApi}, | ||
solver::{liquidity::zeroex::ZeroExLiquidity, liquidity_collector::LiquidityCollecting}, | ||
std::sync::Arc, | ||
}; | ||
|
||
pub async fn collector( | ||
eth: &Ethereum, | ||
blocks: CurrentBlockStream, | ||
config: &infra::liquidity::config::ZeroEx, | ||
) -> anyhow::Result<Box<dyn LiquidityCollecting>> { | ||
let settlement = eth.contracts().settlement().clone(); | ||
let web3 = settlement.raw_instance().web3().clone(); | ||
let contract = contracts::IZeroEx::deployed(&web3).await?; | ||
let http_client_factory = &HttpClientFactory::new(&shared::http_client::Arguments { | ||
http_timeout: config.http_timeout, | ||
}); | ||
let api = Arc::new(DefaultZeroExApi::new( | ||
http_client_factory, | ||
config.base_url.clone(), | ||
config.api_key.clone(), | ||
blocks, | ||
)?); | ||
Ok(Box::new(ZeroExLiquidity::new( | ||
web3, api, contract, settlement, | ||
))) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters