From bdd997e0a94f296f524fe6d13a6cd8ca3ae542be Mon Sep 17 00:00:00 2001 From: gaetbout Date: Sat, 9 Sep 2023 18:58:16 +0200 Subject: [PATCH] adding addressList --- db/block.json | 2 +- src/main.rs | 134 +++++++++++++++++++++++++++++++++++++------------- 2 files changed, 101 insertions(+), 35 deletions(-) diff --git a/db/block.json b/db/block.json index 6edd56c..3821385 100644 --- a/db/block.json +++ b/db/block.json @@ -1,3 +1,3 @@ { - "last_processsed_block": 209111 + "last_processsed_block": 209126 } \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 944682d..0fa221f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,4 @@ -use api::Token; +use api::{fetch_events, Token}; use dotenv::dotenv; use log::info; use num_bigint::{BigUint, ToBigInt}; @@ -6,7 +6,6 @@ use reqwest::Url; use starknet::providers::{jsonrpc::HttpTransport, JsonRpcClient, Provider}; use std::error::Error; -use crate::api::fetch_events; #[macro_use] extern crate dotenv_codegen; @@ -15,38 +14,6 @@ mod db; mod logger; mod twitter; -const ETH: Token = Token { - address: "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7", - decimals: 18, - symbol: "ETH", - selector: "Transfer", - threshold: 50, - logo: "♦", - rate_api_id: "ethereum", -}; - -const USDC: Token = Token { - address: "0x053c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8", - decimals: 6, - symbol: "USDC", - selector: "Transfer", - threshold: 60_000, - logo: "$", - rate_api_id: "usd-coin", -}; - -const USDT: Token = Token { - address: "0x068f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8", - decimals: 6, - symbol: "USDT", - selector: "Transfer", - threshold: 60_000, - logo: "$", - rate_api_id: "tether", -}; - -const TOKENS: &'static [Token] = &[ETH, USDC, USDT]; - #[tokio::main] async fn main() -> Result<(), Box> { logger::init(); @@ -119,6 +86,105 @@ fn to_u256(low: u128, high: u128) -> BigUint { BigUint::new(low_vec) } +const ETH: Token = Token { + address: "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7", + decimals: 18, + symbol: "ETH", + selector: "Transfer", + threshold: 50, + logo: "♦", + rate_api_id: "ethereum", +}; + +const USDC: Token = Token { + address: "0x053c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8", + decimals: 6, + symbol: "USDC", + selector: "Transfer", + threshold: 60_000, + logo: "$", + rate_api_id: "usd-coin", +}; + +const USDT: Token = Token { + address: "0x068f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8", + decimals: 6, + symbol: "USDT", + selector: "Transfer", + threshold: 60_000, + logo: "$", + rate_api_id: "tether", +}; + +pub struct AddressToName { + address: &'static str, + name: &'static str, +} + +const LAYER_SWAP: AddressToName = AddressToName { + address: "19252b1deef483477c4d30cfcc3e5ed9c82fafea44669c182a45a01b4fdb97a", + name: "Layerswap", +}; + +const ZKLEND_MARKET: AddressToName = AddressToName { + address: "4c0a5193d58f74fbace4b74dcf65481e734ed1714121bdc571da345540efa05", + name: "zkLend: Market", +}; + +const BRIQ_FACTORY: AddressToName = AddressToName { + address: "5b021b6743c4f420e20786baa7fb9add1d711302c267afbc171252a74687376", + name: "The Fucking Briq", +}; + +const STARKNET_DEPLOYER: AddressToName = AddressToName { + address: "1176a1bd84444c89232ec27754698e5d2e7e1a7f1539f12027f28b23ec9f3d8", + name: "Starknet deployer", +}; + +const MY_SWAP_AMM: AddressToName = AddressToName { + address: "10884171baf1914edc28d7afb619b40a4051cfae78a094a55d230f19e944a28", + name: "mySwap: AMM Swap", +}; + +const JEDI_SWAP_ETH_USDC: AddressToName = AddressToName { + address: "4d0390b777b424e43839cd1e744799f3de6c176c7e32c1812a41dbd9c19db6a", + name: "JediSwap: ETH/USDC Pair", +}; + +const TENK_SWAP_ETH_USD: AddressToName = AddressToName { + address: "23c72abdf49dffc85ae3ede714f2168ad384cc67d08524732acea90df325", + name: "10KSwap: ETH-USDC Pair", +}; + +const ORBITER_FINANCE_BRIDGE_1: AddressToName = AddressToName { + address: "7b393627bd514d2aa4c83e9f0c468939df15ea3c29980cd8e7be3ec847795f0", + name: "Orbiter Finance Bridge 1", +}; + +const ORBITER_FINANCE_BRIDGE_4: AddressToName = AddressToName { + address: "6e18dd81378fd5240704204bccc546f6dfad3d08c4a3a44347bd274659ff328", + name: "Orbiter Finance Bridge 4", +}; + +const ORBITER_FINANCE_BRIDGE_2: AddressToName = AddressToName { + address: "64a24243f2aabae8d2148fa878276e6e6e452e3941b417f3c33b1649ea83e11", + name: "Orbiter Finance Bridge 2", +}; + +const TOKENS: &'static [Token] = &[ETH, USDC, USDT]; +const address_list: &'static [AddressToName] = &[ + LAYER_SWAP, + ZKLEND_MARKET, + BRIQ_FACTORY, + STARKNET_DEPLOYER, + MY_SWAP_AMM, + JEDI_SWAP_ETH_USDC, + TENK_SWAP_ETH_USD, + ORBITER_FINANCE_BRIDGE_1, + ORBITER_FINANCE_BRIDGE_2, + ORBITER_FINANCE_BRIDGE_4, +]; + #[cfg(test)] mod tests { use num_bigint::BigUint;