Skip to content

Commit

Permalink
adding btc
Browse files Browse the repository at this point in the history
  • Loading branch information
gaetbout committed Mar 11, 2024
1 parent 4e043b9 commit d99cce3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
2 changes: 2 additions & 0 deletions crates/starkwhale-alert/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ pub async fn fetch_coin(coin_id: &str) -> Result<f64, reqwest::Error> {
.await?
.json()
.await?;

Ok(coin_info
.data
.values()
Expand Down Expand Up @@ -106,6 +107,7 @@ mod tests {
#[case("tether")]
#[case("multi-collateral-dai")]
#[case("starknet-token")]
#[case("wrapped-bitcoin")]
#[tokio::test]
async fn test_fetch_coin(#[case] coin: &str) {
let value = fetch_coin(coin).await.unwrap();
Expand Down
17 changes: 13 additions & 4 deletions crates/starkwhale-alert/src/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub const TOKENS: &[Token] = &[
decimals: 18,
symbol: "ETH",
selector: "Transfer",
threshold: 100,
threshold: 300,
logo: "♦",
rate_api_id: Some("ethereum"),
},
Expand All @@ -23,7 +23,7 @@ pub const TOKENS: &[Token] = &[
decimals: 6,
symbol: "USDC",
selector: "Transfer",
threshold: 200_000,
threshold: 800_000,
logo: "$",
rate_api_id: Some("usd-coin"),
},
Expand All @@ -32,7 +32,7 @@ pub const TOKENS: &[Token] = &[
decimals: 6,
symbol: "USDT",
selector: "Transfer",
threshold: 200_000,
threshold: 800_000,
logo: "$",
rate_api_id: Some("tether"),
},
Expand All @@ -41,7 +41,7 @@ pub const TOKENS: &[Token] = &[
decimals: 18,
symbol: "DAI",
selector: "Transfer",
threshold: 200_000,
threshold: 100_000,
logo: "D",
rate_api_id: Some("multi-collateral-dai"),
},
Expand All @@ -54,6 +54,15 @@ pub const TOKENS: &[Token] = &[
logo: "",
rate_api_id: Some("starknet-token"),
},
Token {
address: "0x03fe2b97c1fd336e750087d68b9b867997fd64a2661ff3ca5a7c771641e8e7ac",
decimals: 8,
symbol: "wBTC",
selector: "Transfer",
threshold: 2,
logo: "B",
rate_api_id: Some("wrapped-bitcoin"),
},
];

pub const ADDRESS_LIST: &[AddressToName] = &[
Expand Down
2 changes: 1 addition & 1 deletion crates/starkwhale-alert/src/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ impl log::Log for SimpleLogger {
}

fn date() -> String {
let offset = chrono::FixedOffset::east_opt(7200).unwrap();
let offset = chrono::FixedOffset::east_opt(3600).unwrap();
let timezone: chrono::FixedOffset = chrono::offset::TimeZone::from_offset(&offset);
let current_time = chrono::Utc::now().with_timezone(&timezone);
current_time.format("%F %T").to_string()
Expand Down

0 comments on commit d99cce3

Please sign in to comment.