Prechádzať zdrojové kódy

#[allow(dead_code)]

skyfffire 2 týždňov pred
rodič
commit
bd6ecc6a5e

+ 2 - 0
src/data_manager.rs

@@ -6,6 +6,7 @@ use serde_json::Value;
 use tracing::{info, warn};
 use crate::utils::response::Response;
 
+#[allow(dead_code)]
 pub struct DataManager {
     pub best_ask: Decimal,
     pub best_bid: Decimal,
@@ -14,6 +15,7 @@ pub struct DataManager {
     pub delay_count: AtomicU64,
 }
 
+#[allow(dead_code)]
 impl DataManager {
     pub fn new() -> Self {
         DataManager {

+ 2 - 0
src/exchange/extended_account.rs

@@ -1,6 +1,7 @@
 use rust_decimal::prelude::Zero;
 
 #[derive(Clone, Debug)]
+#[allow(dead_code)]
 pub struct ExtendedAccount {
     pub api_key: String,
     pub stark_public_key: String,
@@ -8,6 +9,7 @@ pub struct ExtendedAccount {
     pub vault_number: u32,
 }
 
+#[allow(dead_code)]
 impl ExtendedAccount {
     pub fn new(api_key: &str, stark_public_key: &str, stark_private_key: &str, vault_number: u32) -> Self {
         ExtendedAccount {

+ 4 - 1
src/exchange/extended_rest_client.rs

@@ -14,6 +14,7 @@ use crate::utils::lib::{get_order_hash, sign_message};
 use crate::utils::response::Response;
 use crate::utils::rest_utils::RestUtils;
 
+#[allow(dead_code)]
 pub struct Domain {
     name: String,
     version: String,
@@ -21,6 +22,7 @@ pub struct Domain {
     revision: String,
 }
 
+#[allow(dead_code)]
 pub struct ExtendedRestClient {
     pub tag: String,
     pub market: String,
@@ -38,6 +40,7 @@ pub struct ExtendedRestClient {
     avg_delay: i64,
 }
 
+#[allow(dead_code)]
 impl ExtendedRestClient {
     pub async fn new(tag: &str, account: Option<ExtendedAccount>, market: &str, is_testnet: bool) -> Result<Self> {
         let base_url = match is_testnet {
@@ -450,7 +453,7 @@ impl ExtendedRestClient {
         Response::new(self.tag.clone(), 200, "success".to_string(), json_value)
     }
 
-    pub fn on_error_data(&mut self, text: &String, base_url: &String, params: &String) -> Response {
+    pub fn on_error_data(&mut self, text: &String, _base_url: &String, _params: &String) -> Response {
         let json_value = serde_json::from_str::<Value>(&text);
 
         match json_value {

+ 1 - 0
src/exchange/extended_stream_client.rs

@@ -28,6 +28,7 @@ pub struct ExtendedStreamClient {
     heartbeat_time: u64,
 }
 
+#[allow(dead_code)]
 impl ExtendedStreamClient {
     // ============================================= 构造函数 ================================================
     fn new(label: String, account_option: Option<ExtendedAccount>, subscribe_pattern: String, is_testnet: bool) -> ExtendedStreamClient {

+ 1 - 0
src/strategy.rs

@@ -3,6 +3,7 @@ use tracing::info;
 use anyhow::Result;
 use crate::data_manager::DataManager;
 
+#[allow(dead_code)]
 pub struct Strategy {
     
 }

+ 8 - 0
src/utils/lib.rs

@@ -10,12 +10,15 @@ use crate::utils::starknet_messages::{
 use utils::starknet_messages;
 use crate::utils;
 
+#[allow(dead_code)]
 pub struct StarkSignature {
     pub r: Felt,
     pub s: Felt,
     pub v: Felt,
 }
 
+#[allow(dead_code)]
+#[allow(deprecated)]
 fn grind_key(key_seed: BigUint) -> BigUint {
     let two_256 = BigUint::from_str(
         "115792089237316195423570985008687907853269984665640564039457584007913129639936",
@@ -47,6 +50,7 @@ fn grind_key(key_seed: BigUint) -> BigUint {
     }
 }
 
+#[allow(dead_code)]
 pub fn get_private_key_from_eth_signature(signature: &str) -> Result<Felt, String> {
     let eth_sig_truncated = signature.trim_start_matches("0x");
     if eth_sig_truncated.len() < 64 {
@@ -60,6 +64,7 @@ pub fn get_private_key_from_eth_signature(signature: &str) -> Result<Felt, Strin
     return Ok(Felt::from_hex(&ground_key.to_str_radix(16)).unwrap());
 }
 
+#[allow(dead_code)]
 pub fn sign_message(message: &Felt, private_key: &Felt) -> Result<StarkSignature, String> {
     return ecdsa_sign(private_key, &message)
         .map(|extended_signature| StarkSignature {
@@ -72,6 +77,7 @@ pub fn sign_message(message: &Felt, private_key: &Felt) -> Result<StarkSignature
 
 // these functions are designed to be called from other languages, such as Python or JavaScript,
 // so they take string arguments.
+#[allow(dead_code)]
 pub fn get_order_hash(
     position_id: String,
     base_asset_id_hex: String,
@@ -159,6 +165,7 @@ pub fn get_order_hash(
         .map_err(|e| format!("Failed to compute message hash: {:?}", e))
 }
 
+#[allow(dead_code)]
 pub fn get_transfer_hash(
     recipient_position_id: String,
     sender_position_id: String,
@@ -212,6 +219,7 @@ pub fn get_transfer_hash(
         .map_err(|e| format!("Failed to compute message hash: {:?}", e))
 }
 
+#[allow(dead_code)]
 pub fn get_withdrawal_hash(
     recipient_hex: String,
     position_id: String,

+ 1 - 0
src/utils/proxy.rs

@@ -3,6 +3,7 @@ use std::net::{IpAddr, Ipv4Addr, SocketAddr};
 use tracing::trace;
 
 
+#[allow(dead_code)]
 pub enum ProxyEnum {
     REST,
     WS,

+ 2 - 0
src/utils/response.rs

@@ -3,6 +3,7 @@ use tokio::time::Instant;
 
 /**交易所返回数据处理之后,统一保存格式,为了内部其他接口调用*/
 #[derive(Debug, Clone)]
+#[allow(dead_code)]
 pub struct Response {
     pub label: String,
     pub code: i16,
@@ -15,6 +16,7 @@ pub struct Response {
     pub data_type: String       // 數據類型, 例如 bybit 深度信息:snapshot(全量),delta(增量)
 }
 
+#[allow(dead_code)]
 impl Response {
     pub fn new(label: String, code: i16, message: String, data: Value) -> Response {
         Response {

+ 2 - 0
src/utils/rest_utils.rs

@@ -1,5 +1,7 @@
+#[allow(dead_code)]
 pub struct RestUtils {}
 
+#[allow(dead_code)]
 impl RestUtils {
     pub fn parse_params_to_str(parameters: String) -> String {
         let mut params_str = String::from("");

+ 2 - 0
src/utils/starknet_messages.rs

@@ -60,6 +60,7 @@ pub struct PositionId {
     pub value: u32,
 }
 
+#[allow(dead_code)]
 pub struct AssetAmount {
     pub asset_id: AssetId,
     pub amount: i64,
@@ -128,6 +129,7 @@ impl Hashable for TransferArgs {
 
 impl OffChainMessage for TransferArgs {}
 
+#[allow(dead_code)]
 pub static SEPOLIA_DOMAIN: LazyLock<StarknetDomain> = LazyLock::new(|| StarknetDomain {
     name: "Perpetuals".to_string(),
     version: "v0".to_string(),