Skip to content

Commit 439d57c

Browse files
added all fees
1 parent 3f95fec commit 439d57c

File tree

7 files changed

+256
-66
lines changed

7 files changed

+256
-66
lines changed

crates/brontes-pricing/src/protocols/uniswap_v3/batch_request/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ mod tests {
208208

209209
#[test]
210210
fn test_v3_bytecodes() {
211-
let (token0, token1, fees, tick_spacing) = extract_uni_v3_immutables(V3_WBTC_ETH.into());
211+
let (token0, token1, fees, tick_spacing) = extract_uni_v3_immutables(V3_WBTC_ETH.into()).unwrap();
212212

213213
assert_eq!(
214214
token0,
@@ -221,7 +221,7 @@ mod tests {
221221
assert_eq!(fees, 3000);
222222
assert_eq!(tick_spacing, 60);
223223

224-
let (token0, token1, fees, tick_spacing) = extract_uni_v3_immutables(V3_USDC_ETH.into());
224+
let (token0, token1, fees, tick_spacing) = extract_uni_v3_immutables(V3_USDC_ETH.into()).unwrap();
225225

226226
assert_eq!(
227227
token0,
@@ -242,7 +242,7 @@ mod tests {
242242
#[test]
243243
#[should_panic(expected = "ParseIntError")]
244244
fn test_fail_v2_bytecode() {
245-
let (token0, token1, _fees, _tick_spacing) = extract_uni_v3_immutables(V2_DAI_MKR.into());
245+
let (token0, token1, _fees, _tick_spacing) = extract_uni_v3_immutables(V2_DAI_MKR.into()).unwrap();
246246

247247
assert_eq!(
248248
token0,

crates/brontes-types/src/constants.rs

+44
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,50 @@ pub const EURT_ADDRESS: Address = Address::new(hex!("c581b735a1688071a1746c968e0
4040
pub const LINK_ADDRESS: Address = Address::new(hex!("514910771af9ca656af840dff83e8264ecf986ca"));
4141
pub const UNI_TOKEN: Address = Address::new(hex!("1f9840a85d5af5bf1d1762f925bdaddc4201f984"));
4242
pub const XAUT_ADDRESS: Address = Address::new(hex!("68749665ff8d2d112fa859aa293f07a622782f38"));
43+
pub const ACE_ADDRESS: Address = Address::new(hex!("ec5483804e637d45cde22fa0869656b64b5ab1ab"));
44+
pub const ADA_ADDRESS: Address = Address::new(hex!("43110D4f2113D50574412E852EBD96F1593179e4"));
45+
pub const AEVO_ADDRESS: Address = Address::new(hex!("b528edbef013aff855ac3c50b381f253af13b997"));
46+
pub const AI_ADDRESS: Address = Address::new(hex!("c91b523a59acc63a64f61fc7bbfb4bfc82dd25f2"));
47+
pub const ALT_ADDRESS: Address = Address::new(hex!("8457ca5040ad67fdebbcc8edce889a335bc0fbfb"));
48+
pub const ARB_ADDRESS: Address = Address::new(hex!("b50721bcf8d664c30412cfbc6cf7a15145234ad1"));
49+
pub const ARKM_ADDRESS: Address = Address::new(hex!("6e2a43be0b1d33b726f0ca3b8de60b3482b8b050"));
50+
pub const AUCTION_ADDRESS: Address = Address::new(hex!("a9b1eb5908cfc3cdf91f9b8b3a74108598009096"));
51+
pub const AXL_ADDRESS: Address = Address::new(hex!("467719ad09025fcc6cf6f8311755809d45a5e5f3"));
52+
pub const BLZ_ADDRESS: Address = Address::new(hex!("5732046a883704404f284ce41ffadd5b007fd668"));
53+
pub const CHZ_ADDRESS: Address = Address::new(hex!("3506424f91fd33084466f402d5d97f05f8e3b4af"));
54+
pub const CYBER_ADDRESS: Address = Address::new(hex!("14778860e937f509e651192a90589de711fb88a9"));
55+
pub const DYDX_ADDRESS: Address = Address::new(hex!("92d6c1e31e14520e676a687f0a93788b716beff5"));
56+
pub const ENA_ADDRESS: Address = Address::new(hex!("57e114b691db790c35207b2e685d4a43181e6061"));
57+
pub const ENS_ADDRESS: Address = Address::new(hex!("c18360217d8f7ab5e7c516566761ea12ce7f9d72"));
58+
pub const ETHFI_ADDRESS: Address = Address::new(hex!("fe0c30065b384f05761f15d0cc899d4f9f9cc0eb"));
59+
pub const FET_ADDRESS: Address = Address::new(hex!("aea46a60368a7bd060eec7df8cba43b7ef41ad85"));
60+
pub const FLOKI_ADDRESS: Address = Address::new(hex!("cf0c122c6b73ff809c693db761e7baebe62b6a2e"));
61+
pub const FTM_ADDRESS: Address = Address::new(hex!("4e15361fd6b4bb609fa63c81a2be19d873717870"));
62+
pub const GALA_ADDRESS: Address = Address::new(hex!("d1d2eb1b1e90b638588728b4130137d262c87cae"));
63+
pub const GRT_ADDRESS: Address = Address::new(hex!("c944e90c64b2c07662a292be6244bdf05cda44a7"));
64+
pub const INJ_ADDRESS: Address = Address::new(hex!("e28b3b32b6c345a34ff64674606124dd5aceca30"));
65+
pub const JUP_ADDRESS: Address = Address::new(hex!("4b1e80cac91e2216eeb63e29b957eb91ae9c2be8"));
66+
pub const LDO_ADDRESS: Address = Address::new(hex!("5a98fcbea516cf06857215779fd812ca3bef1b32"));
67+
pub const MATIC_ADDRESS: Address = Address::new(hex!("7d1afa7b718fb893db30a3abc0cfc608aacfebb0"));
68+
pub const MEME_ADDRESS: Address = Address::new(hex!("b131f4a55907b10d1f0a50d8ab8fa09ec342cd74"));
69+
pub const OMNI_ADDRESS: Address = Address::new(hex!("36e66fbbce51e4cd5bd3c62b637eb411b18949d4"));
70+
pub const PENDLE_ADDRESS: Address = Address::new(hex!("808507121b80c02388fad14726482e061b8da827"));
71+
pub const PEOPLE_ADDRESS: Address = Address::new(hex!("7a58c0be72be218b41c608b7fe7c5bb630736c71"));
72+
pub const PEPE_ADDRESS: Address = Address::new(hex!("6982508145454ce325ddbe47a25d4ec3d2311933"));
73+
pub const PIXEL_ADDRESS: Address = Address::new(hex!("3429d03c6f7521aec737a0bbf2e5ddcef2c3ae31"));
74+
pub const PORTAL_ADDRESS: Address = Address::new(hex!("1bbe973bef3a977fc51cbed703e8ffdefe001fed"));
75+
pub const REZ_ADDRESS: Address = Address::new(hex!("3b50805453023a91a8bf641e279401a0b23fa6f9"));
76+
pub const RNDR_ADDRESS: Address = Address::new(hex!("6de037ef9ad2725eb40118bb1702ebb27e4aeb24"));
77+
pub const SAND_ADDRESS: Address = Address::new(hex!("3845badade8e6dff049820680d1f14bd3903a5d0"));
78+
pub const SHIB_ADDRESS: Address = Address::new(hex!("95ad61b0a150d79219dcf64e1e6cc01f0b64c4ce"));
79+
pub const STRK_ADDRESS: Address = Address::new(hex!("ca14007eff0db1f8135f4c25b34de49ab0d42766"));
80+
pub const SUPER_ADDRESS: Address = Address::new(hex!("e53ec727dbdeb9e2d5456c3be40cff031ab40a55"));
81+
pub const UNI_ADDRESS: Address = Address::new(hex!("1f9840a85d5af5bf1d1762f925bdaddc4201f984"));
82+
pub const W_ADDRESS: Address = Address::new(hex!("b0ffa8000886e57f86dd5264b9582b2ad87b2b91"));
83+
pub const WLD_ADDRESS: Address = Address::new(hex!("163f8c2467924be0ae7b5347228cabf260318753"));
84+
pub const AEUR_ADDRESS: Address = Address::new(hex!("a40640458fbc27b6eefedea1e9c9e17d4cee7a21"));
85+
pub const MAV_ADDRESS: Address = Address::new(hex!("7448c7456a97769f6cd04f1e83a4a23ccdc46abd"));
86+
pub const USDP_ADDRESS: Address = Address::new(hex!("8e870d67f660d95d5be530380d0ec0bd388289e1"));
4387

4488
/// The first block where the chainbound mempool data is available.
4589
pub const START_OF_CHAINBOUND_MEMPOOL_DATA: u64 = 17193367;

crates/brontes-types/src/db/cex/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use std::{fmt::Debug, hash::Hash};
22

3+
use malachite::Rational;
34
use strum::Display;
45
pub mod cex_symbols;
56
pub mod quotes;
@@ -9,6 +10,8 @@ pub use cex_symbols::*;
910
pub use quotes::*;
1011
pub use trades::*;
1112

13+
use crate::pair::Pair;
14+
1215
#[derive(
1316
Copy,
1417
Display,

crates/brontes-types/src/db/cex/quotes/cex_quotes.rs

+195-55
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ use crate::{
5353
FastHashMap,
5454
};
5555

56+
pub enum SecuritiesClass {
57+
Spot,
58+
Derivative,
59+
}
60+
5661
/// Centralized exchange price map organized by exchange.
5762
///
5863
///
@@ -166,7 +171,7 @@ impl CexPriceMap {
166171
let volume_weighted_bid = volume_price.0 / &cumulative_bbo.0;
167172
let volume_weighted_ask = volume_price.1 / &cumulative_bbo.1;
168173

169-
let fees = exchange.fees();
174+
let fees = exchange.fees(&pair, &SecuritiesClass::Spot);
170175

171176
let fee_adjusted_maker = (
172177
&volume_weighted_bid * (Rational::ONE - &fees.0),
@@ -907,68 +912,203 @@ impl CexExchange {
907912
///
908913
/// TODO: Account for special fee pairs & stableswap rates
909914
/// TODO: Account for futures & spot fee deltas
910-
pub fn fees(&self) -> (Rational, Rational) {
911-
match self {
912-
CexExchange::Binance => (
913-
Rational::from_sci_string("0.00012").unwrap(),
914-
Rational::from_sci_string("0.00024").unwrap(),
915-
),
916-
CexExchange::Bitmex => (
917-
Rational::from_sci_string("-0.00025").unwrap(),
918-
Rational::from_sci_string("0.00075").unwrap(),
919-
),
920-
CexExchange::Deribit => {
921-
(Rational::from_sci_string("0").unwrap(), Rational::from_sci_string("0").unwrap())
922-
}
923-
CexExchange::Okex => (
924-
Rational::from_sci_string("-0.00005").unwrap(),
925-
Rational::from_sci_string("0.00015").unwrap(),
926-
),
927-
CexExchange::Coinbase => (
928-
Rational::from_sci_string("0").unwrap(),
929-
Rational::from_sci_string("0.0005").unwrap(),
930-
),
931-
CexExchange::Kraken => (
932-
Rational::from_sci_string("0").unwrap(),
933-
Rational::from_sci_string("0.001").unwrap(),
934-
),
935-
CexExchange::BybitSpot => (
936-
Rational::from_sci_string("0.00005").unwrap(),
937-
Rational::from_sci_string("0.00015").unwrap(),
938-
),
939-
CexExchange::Kucoin => (
940-
Rational::from_sci_string("-0.00005").unwrap(),
941-
Rational::from_sci_string("0.00025").unwrap(),
942-
),
943-
CexExchange::Upbit => (
944-
Rational::from_sci_string("0.0002").unwrap(),
945-
Rational::from_sci_string("0.0002").unwrap(),
946-
),
947-
CexExchange::Huobi => (
948-
Rational::from_sci_string("0.000097").unwrap(),
949-
Rational::from_sci_string("0.000193").unwrap(),
950-
),
951-
CexExchange::GateIo => (
952-
Rational::from_sci_string("0").unwrap(),
953-
Rational::from_sci_string("0.0002").unwrap(),
954-
),
955-
CexExchange::Bitstamp => (
956-
Rational::from_sci_string("0").unwrap(),
957-
Rational::from_sci_string("0.0003").unwrap(),
958-
),
959-
CexExchange::Gemini => (
960-
Rational::from_sci_string("0").unwrap(),
961-
Rational::from_sci_string("0.0003").unwrap(),
962-
),
915+
pub fn fees(&self, pair: &Pair, trade_type: &SecuritiesClass) -> (Rational, Rational) {
916+
let (maker, taker) = match self {
917+
CexExchange::Binance => {
918+
match trade_type {
919+
SecuritiesClass::Spot =>
920+
if Self::BINANCE_SPOT_PROMO_FEE_TYPE1_PAIRS.iter().any(|p| p.eq_ordered(pair)) {
921+
("0.0", "0.0") // https://www.binance.com/en/fee/tradingPromote
922+
} else if Self::BINANCE_SPOT_PROMO_FEE_TYPE2_PAIRS.iter().any(|p| p.eq_ordered(pair)) {
923+
("0.0", "0.00024") // https://www.binance.com/en/fee/tradingPromote
924+
925+
} else if pair.0 == USDC_ADDRESS || pair.1 == USDC_ADDRESS {
926+
("0.00012", "0.0001425") // https://www.binance.com/en/fee/trading
927+
} else {
928+
("0.00012", "0.00024") // https://www.binance.com/en/fee/trading
929+
},
930+
SecuritiesClass::Derivative => ("0.0003", "0.0003"), // https://www.binance.com/en/fee/optionsTrading
931+
}
932+
},
933+
CexExchange::Bitmex =>
934+
match trade_type {
935+
SecuritiesClass::Spot => ("0.001", "0.001"), // https://www.bitmex.com/wallet/fees/spot
936+
SecuritiesClass::Derivative => ("-0.000125", "0.000175"), // https://www.bitmex.com/wallet/fees/derivatives
937+
938+
}
939+
CexExchange::Deribit =>
940+
match trade_type {
941+
SecuritiesClass::Spot => ("0.0", "0.0"), // https://www.deribit.com/kb/fees
942+
SecuritiesClass::Derivative => ("-0.0001", "0.0005"), // https://www.deribit.com/kb/fees
943+
}
944+
CexExchange::Okex => ("-0.0001", "0.00015"), // https://tr.okx.com/fees
945+
CexExchange::Coinbase =>
946+
// https://help.coinbase.com/en/exchange/trading-and-funding/exchange-fees
947+
if USD_STABLES_BY_ADDRESS.iter().any(|a| pair.0 == *a || pair.1 == *a) ||
948+
WBTC_ADDRESS == pair.0 || WBTC_ADDRESS == pair.1 {
949+
("0.0", "0.00001")
950+
} else {
951+
("0", "0.0005")
952+
},
953+
CexExchange::Kraken =>
954+
match trade_type {
955+
SecuritiesClass::Spot => ("0.0", "0.001"), // https://www.kraken.com/features/fee-schedule#spot-crypto
956+
SecuritiesClass::Derivative => ("0.0", "0.0001"), // https://www.kraken.com/features/fee-schedule#futures
957+
},
958+
CexExchange::BybitSpot =>
959+
// https://www.bybit.com/en/help-center/article/Trading-Fee-Structure
960+
match trade_type {
961+
SecuritiesClass::Spot => ("0.00005", "0.00015"),
962+
SecuritiesClass::Derivative => if USDC_ADDRESS == pair.0 || USDC_ADDRESS == pair.1 {
963+
("0.0", "0.0001")
964+
} else {
965+
("0.0", "0.00025")
966+
}
967+
}
968+
CexExchange::Kucoin =>
969+
// https://www.kucoin.com/vip/privilege
970+
match trade_type {
971+
SecuritiesClass::Spot =>
972+
if Self::KUCOIN_CLASS_C_BASE_COINS.iter().any(|a| pair.0 == *a) {
973+
("-0.00005", "0.00075")
974+
} else if Self::KUCOIN_CLASS_B_BASE_COINS.iter().any(|a| pair.0 == *a) {
975+
("-0.00005", "0.0005")
976+
} else if Self::KUCOIN_CLASS_A_BASE_COINS.iter().any(|a| pair.0 == *a) {
977+
("-0.00005", "0.00025")
978+
} else if Self::KUCOIN_TOP_BASE_COINS.iter().any(|a| pair.0 == *a) {
979+
("-0.00005", "0.00025")
980+
} else {
981+
("-0.00005", "0.00025")
982+
},
983+
SecuritiesClass::Derivative => ("-0.00008", "0.00025"),
984+
},
985+
CexExchange::Upbit => ("0.0002", "0.0002"), // https://sg.upbit.com/service_center/guide
986+
CexExchange::Huobi =>
987+
match trade_type {
988+
SecuritiesClass::Spot => ("0.000097", "0.000193"), // https://www.htx.com/zh-cn/support/360000312282
989+
SecuritiesClass::Derivative => ("-0.00005", "0.0002"), // https://www.htx.com/zh-cn/support/360000113122
990+
}
991+
CexExchange::GateIo => ("0.0", "0.0002"), // https://www.gate.io/fee (curl, search for spot_feelist)
992+
CexExchange::Bitstamp => ("0", "0.0003"), // https://www.bitstamp.net/fee-schedule/
993+
CexExchange::Gemini => ("0", "0.0003"), // https://www.gemini.com/fees/api-fee-schedule#section-gemini-stablecoin-fee-schedule
963994
CexExchange::Average => {
964995
unreachable!("Cannot get fees for cross exchange average quote")
965996
}
966997
CexExchange::Unknown => unreachable!("Unknown cex exchange"),
967998
CexExchange::VWAP | CexExchange::OptimisticVWAP => {
968999
unreachable!("Cannot get fees for VWAP")
9691000
}
970-
}
1001+
};
1002+
(Rational::from_sci_string(maker).unwrap(), Rational::from_sci_string(taker).unwrap())
9711003
}
1004+
1005+
// https://www.binance.com/en/fee/tradingPromote
1006+
const BINANCE_SPOT_PROMO_FEE_TYPE1_PAIRS: [Pair; 8] = [
1007+
Pair(WBTC_ADDRESS, FDUSD_ADDRESS),
1008+
Pair(FDUSD_ADDRESS, USDT_ADDRESS),
1009+
Pair(ETH_ADDRESS, FDUSD_ADDRESS),
1010+
Pair(LINK_ADDRESS, FDUSD_ADDRESS),
1011+
Pair(AEUR_ADDRESS, USDT_ADDRESS),
1012+
Pair(TUSD_ADDRESS, USDT_ADDRESS),
1013+
Pair(USDC_ADDRESS, USDT_ADDRESS),
1014+
Pair(USDP_ADDRESS, USDT_ADDRESS),
1015+
];
1016+
1017+
// https://www.binance.com/en/fee/tradingPromote
1018+
const BINANCE_SPOT_PROMO_FEE_TYPE2_PAIRS: [Pair; 50] = [
1019+
Pair(ACE_ADDRESS, FDUSD_ADDRESS),
1020+
Pair(ADA_ADDRESS, FDUSD_ADDRESS),
1021+
Pair(AEVO_ADDRESS, FDUSD_ADDRESS),
1022+
Pair(AI_ADDRESS, FDUSD_ADDRESS),
1023+
Pair(ALT_ADDRESS, FDUSD_ADDRESS),
1024+
Pair(ARB_ADDRESS, FDUSD_ADDRESS),
1025+
Pair(ARKM_ADDRESS, FDUSD_ADDRESS),
1026+
Pair(AUCTION_ADDRESS, FDUSD_ADDRESS),
1027+
Pair(AXL_ADDRESS, FDUSD_ADDRESS),
1028+
Pair(BLZ_ADDRESS, FDUSD_ADDRESS),
1029+
Pair(CHZ_ADDRESS, FDUSD_ADDRESS),
1030+
Pair(CYBER_ADDRESS, FDUSD_ADDRESS),
1031+
Pair(DYDX_ADDRESS, FDUSD_ADDRESS),
1032+
Pair(ENA_ADDRESS, FDUSD_ADDRESS),
1033+
Pair(ENS_ADDRESS, FDUSD_ADDRESS),
1034+
Pair(ETHFI_ADDRESS, FDUSD_ADDRESS),
1035+
Pair(FET_ADDRESS, FDUSD_ADDRESS),
1036+
Pair(FLOKI_ADDRESS, FDUSD_ADDRESS),
1037+
Pair(FTM_ADDRESS, FDUSD_ADDRESS),
1038+
Pair(GALA_ADDRESS, FDUSD_ADDRESS),
1039+
Pair(GRT_ADDRESS, FDUSD_ADDRESS),
1040+
Pair(INJ_ADDRESS, FDUSD_ADDRESS),
1041+
Pair(JUP_ADDRESS, FDUSD_ADDRESS),
1042+
Pair(LDO_ADDRESS, FDUSD_ADDRESS),
1043+
Pair(MATIC_ADDRESS, FDUSD_ADDRESS),
1044+
Pair(MEME_ADDRESS, FDUSD_ADDRESS),
1045+
Pair(OMNI_ADDRESS, FDUSD_ADDRESS),
1046+
Pair(PENDLE_ADDRESS, FDUSD_ADDRESS),
1047+
Pair(PEOPLE_ADDRESS, FDUSD_ADDRESS),
1048+
Pair(PEPE_ADDRESS, FDUSD_ADDRESS),
1049+
Pair(PIXEL_ADDRESS, FDUSD_ADDRESS),
1050+
Pair(PORTAL_ADDRESS, FDUSD_ADDRESS),
1051+
Pair(REZ_ADDRESS, FDUSD_ADDRESS),
1052+
Pair(RNDR_ADDRESS, FDUSD_ADDRESS),
1053+
Pair(SAND_ADDRESS, FDUSD_ADDRESS),
1054+
Pair(SHIB_ADDRESS, FDUSD_ADDRESS),
1055+
Pair(STRK_ADDRESS, FDUSD_ADDRESS),
1056+
Pair(SUPER_ADDRESS, FDUSD_ADDRESS),
1057+
Pair(UNI_ADDRESS, FDUSD_ADDRESS),
1058+
Pair(W_ADDRESS, FDUSD_ADDRESS),
1059+
Pair(WLD_ADDRESS, FDUSD_ADDRESS),
1060+
Pair(ADA_ADDRESS, TUSD_ADDRESS),
1061+
Pair(ARB_ADDRESS, TUSD_ADDRESS),
1062+
Pair(ARKM_ADDRESS, TUSD_ADDRESS),
1063+
Pair(WBTC_ADDRESS, TUSD_ADDRESS),
1064+
Pair(CYBER_ADDRESS, TUSD_ADDRESS),
1065+
Pair(ETH_ADDRESS, TUSD_ADDRESS),
1066+
Pair(MATIC_ADDRESS, TUSD_ADDRESS),
1067+
Pair(MAV_ADDRESS, TUSD_ADDRESS),
1068+
Pair(PEPE_ADDRESS, TUSD_ADDRESS),
1069+
];
1070+
1071+
const KUCOIN_TOP_BASE_COINS: [Address; 12] = [
1072+
WBTC_ADDRESS,
1073+
ETH_ADDRESS,
1074+
// XRP_ADDRESS,
1075+
// SOL_ADDRESS,
1076+
ADA_ADDRESS,
1077+
// DOGE_ADDRESS,
1078+
// TRX_ADDRESS,
1079+
// AVAX_ADDRESS,
1080+
MATIC_ADDRESS,
1081+
LINK_ADDRESS,
1082+
// DOT_ADDRESS,
1083+
// LTC_ADDRESS,
1084+
SHIB_ADDRESS,
1085+
// BCH_ADDRESS,
1086+
// ATOM_ADDRESS,
1087+
UNI_ADDRESS,
1088+
// XMR_ADDRESS,
1089+
// ETC_ADDRESS,
1090+
// LUNC_ADDRESS,
1091+
// TON_ADDRESS,
1092+
DAI_ADDRESS,
1093+
KCS_ADDRESS,
1094+
USDT_ADDRESS,
1095+
USDC_ADDRESS,
1096+
USDP_ADDRESS,
1097+
];
1098+
1099+
const KUCOIN_CLASS_A_BASE_COINS: [Address; 39] = [
1100+
AEVO_ADDRESS, ARB_ADDRESS, ARKM_ADDRESS, AUCTION_ADDRESS, BLZ_ADDRESS, BNB_ADDRESS, CHZ_ADDRESS, CYBER_ADDRESS,
1101+
DYDX_ADDRESS, ENA_ADDRESS, ENS_ADDRESS, ETHFI_ADDRESS, FET_ADDRESS, FLOKI_ADDRESS, FTM_ADDRESS, GRT_ADDRESS,
1102+
INJ_ADDRESS, JUP_ADDRESS, LDO_ADDRESS, MAV_ADDRESS, MEME_ADDRESS, OMNI_ADDRESS, PAXG_ADDRESS, PENDLE_ADDRESS,
1103+
PEOPLE_ADDRESS, PEPE_ADDRESS, PIXEL_ADDRESS, PORTAL_ADDRESS, PYUSD_ADDRESS, REZ_ADDRESS, SAND_ADDRESS, STRK_ADDRESS,
1104+
SUPER_ADDRESS, TUSD_ADDRESS, USDD_ADDRESS, USTC_ADDRESS, W_ADDRESS, WBTC_ADDRESS, WLD_ADDRESS,
1105+
];
1106+
1107+
const KUCOIN_CLASS_B_BASE_COINS: [Address; 5] = [
1108+
ACE_ADDRESS, AI_ADDRESS, ALT_ADDRESS, RNDR_ADDRESS, USDE_ADDRESS,
1109+
];
1110+
1111+
const KUCOIN_CLASS_C_BASE_COINS: [Address; 0] = [];
9721112
}
9731113

9741114
#[cfg(test)]

crates/brontes-types/src/db/cex/trades/time_window_vwam.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,11 @@ use malachite::{
1616
use tracing::trace;
1717

1818
use super::{
19-
config::CexDexTradeConfig,
20-
utils::{log_insufficient_trade_volume, log_missing_trade_data, PairTradeWalker},
21-
CexTrades,
19+
config::CexDexTradeConfig, utils::{log_insufficient_trade_volume, log_missing_trade_data, PairTradeWalker}, CexTrades
2220
};
2321
use crate::{
2422
constants::{USDC_ADDRESS, USDT_ADDRESS},
25-
db::cex::CexExchange,
23+
db::cex::{CexExchange, SecuritiesClass},
2624
normalized_actions::NormalizedSwap,
2725
pair::Pair,
2826
FastHashMap, FastHashSet,
@@ -334,7 +332,7 @@ impl<'a> TimeWindowTrades<'a> {
334332
let trades = walker.get_trades_for_window();
335333
for trade in trades {
336334
let trade = trade.get();
337-
let (m_fee, t_fee) = trade.exchange.fees();
335+
let (m_fee, t_fee) = trade.exchange.fees(&pair, &SecuritiesClass::Spot);
338336
let weight = calculate_weight(block_timestamp, trade.timestamp);
339337

340338
let (

0 commit comments

Comments
 (0)