Skip to content

Commit

Permalink
Suppress warnings from hexstody_eth
Browse files Browse the repository at this point in the history
  • Loading branch information
LeMarwin committed Oct 16, 2022
1 parent f155f84 commit f935219
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 47 deletions.
7 changes: 4 additions & 3 deletions hexstody-eth/src/handlers/accounts.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#![allow(dead_code, unused_variables, non_snake_case)]
use crate::types::*;
use crate::node_calls;
use crate::db_functions;
use crate::conf::{NodeConfig, load_config};
use crate::conf::NodeConfig;

use rocket::{get,post,State};
use rocket::http::{Status, ContentType};
use rocket::serde::json::Json;
use rocket_db_pools::{Database, Connection};
use rocket_okapi::{openapi, openapi_get_routes, swagger_ui::*};
use rocket_db_pools::Connection;
use rocket_okapi::openapi;

#[openapi(tag = "accounts")]
#[get("/createuser/<login>")]
Expand Down
19 changes: 9 additions & 10 deletions hexstody-eth/src/handlers/balance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ use crate::types::*;
use crate::utils::*;
use crate::node_calls;
use crate::db_functions;
use crate::conf::{NodeConfig, load_config};
use crate::conf::NodeConfig;

use rocket::{get,post,State};
use rocket::{get,State};
use rocket::http::{Status, ContentType};
use rocket::serde::json::Json;
use rocket_db_pools::{Database, Connection};
use rocket_okapi::{openapi, openapi_get_routes, swagger_ui::*};
use rocket_db_pools::Connection;
use rocket_okapi::openapi;

#[openapi(tag = "balance")]
#[get("/balance/eth/total")]
Expand Down Expand Up @@ -70,7 +69,7 @@ pub async fn balance_eth_login(login: &str,
return (Status::InternalServerError,(ContentType::JSON, "No result error".to_string()));
}
Some(res_str) => {
let json_res = serde_json::to_string(&hxt_str_to_f64(res_str));
let _json_res = serde_json::to_string(&hxt_str_to_f64(res_str));
log::warn!("=======================</BALANCE ETH>==========================");
return (Status::Ok, (ContentType::JSON, format!("{}",&hxt_str_to_f64(res_str))));
}
Expand All @@ -83,7 +82,7 @@ pub async fn balance_eth_login(login: &str,
#[get("/balance/eth/address/<address>")]
pub async fn balance_eth_address(address: &str,
cfg: &State<NodeConfig>,
db: Connection<MyDb>) -> (Status, (ContentType, String)) {
_db: Connection<MyDb>) -> (Status, (ContentType, String)) {
log::warn!("=======================<BALANCE ETH>==========================");
log::warn!("address {:?}",address);
let r_res = node_calls::balance_eth(cfg,address);
Expand Down Expand Up @@ -138,7 +137,7 @@ pub async fn balance_erc20_login(login: &str,
return (Status::InternalServerError,(ContentType::JSON, "No result error".to_string()));
}
Some(res_str) => {
let json_res = serde_json::to_string(&hxt_str_to_f64(res_str));
let _json_res = serde_json::to_string(&hxt_str_to_f64(res_str));
log::warn!("=======================</BALANCE ERC20>==========================");
return (Status::Ok, (ContentType::JSON, format!("{}",&hxt_str_to_f64(res_str))));
}
Expand All @@ -152,7 +151,7 @@ pub async fn balance_erc20_login(login: &str,
pub async fn balance_erc20_address(address: &str,
token_address: &str,
cfg: &State<NodeConfig>,
db: Connection<MyDb>) -> (Status, (ContentType, String)) {
_db: Connection<MyDb>) -> (Status, (ContentType, String)) {
log::warn!("=======================<BALANCE ERC20>==========================");
log::warn!("Address {:?}",address);
log::warn!("TokenAddress {:?}",token_address);
Expand All @@ -175,7 +174,7 @@ pub async fn balance_erc20_address(address: &str,
return (Status::InternalServerError,(ContentType::JSON, "No result error".to_string()));
}
Some(res_str) => {
let json_res = serde_json::to_string(&hxt_str_to_f64(res_str));
let _json_res = serde_json::to_string(&hxt_str_to_f64(res_str));
log::warn!("=======================</BALANCE ERC20>==========================");
return (Status::Ok, (ContentType::JSON, format!("{}",&hxt_str_to_f64(res_str))));
}
Expand Down
10 changes: 3 additions & 7 deletions hexstody-eth/src/handlers/common.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
use crate::types::*;
use crate::node_calls;
use crate::db_functions;
use crate::conf::{NodeConfig, load_config};
use crate::conf::NodeConfig;

use rocket::{get,post,State};
use rocket::http::{Status, ContentType};
use rocket::serde::json::Json;
use rocket_okapi::{openapi, openapi_get_routes, swagger_ui::*};
use rocket::{get,State};
use rocket_okapi::openapi;

#[openapi(tag = "version")]
#[get("/version")]
Expand Down
12 changes: 5 additions & 7 deletions hexstody-eth/src/handlers/sending.rs
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
#![allow(dead_code, unused_variables, non_snake_case)]
use crate::types::*;
use crate::utils::*;
use crate::node_calls;
use crate::db_functions;
use crate::conf::{NodeConfig, load_config};
use crate::conf::NodeConfig;

use rocket::{
get,post,State,
get,State,
http::{Status, ContentType},
serde::json::Json
};

use rocket_db_pools::{Database, Connection};
use rocket_okapi::{openapi, openapi_get_routes, swagger_ui::*};
use rocket_db_pools::Connection;
use rocket_okapi::openapi;

use web3::{
contract::{Contract, Options},
ethabi::ethereum_types::U256,
types::{Address, TransactionParameters,TransactionRequest, H160},
api::{Web3Api}
};

use std::str::FromStr;
Expand Down
21 changes: 2 additions & 19 deletions hexstody-eth/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,15 @@ mod worker;

#[macro_use] extern crate rocket;

use hex_literal::hex;
use worker::*;
use conf::load_config;
use conf::NodeConfig;
use clap::Parser;

use types::*;
use utils::*;

use std::str::FromStr;

use secp256k1::SecretKey;

use web3::{
contract::{Contract, Options},
ethabi::ethereum_types::U256,
types::{Address, TransactionParameters, H160},
api::{Web3Api}
};

use std::time::Duration;
use rocket::http::{Status, ContentType};
use rocket::serde::json::Json;
use rocket::State;
use rocket_db_pools::{Database, Connection};
use rocket_okapi::{openapi, openapi_get_routes, swagger_ui::*};
use rocket_db_pools::Database;
use rocket_okapi::{openapi_get_routes, swagger_ui::*};


use std::io::Write;
Expand Down
1 change: 1 addition & 0 deletions hexstody-eth/src/node_calls.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(dead_code, unused_variables, non_snake_case)]
use crate::types::*;
use crate::conf::{NodeConfig, load_config};

Expand Down
3 changes: 2 additions & 1 deletion hexstody-eth/src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(dead_code, unused_variables, non_snake_case)]
use web3::{
ethabi::ethereum_types::U256,
};
Expand Down Expand Up @@ -37,7 +38,7 @@ pub fn to_U256(volume: &str) -> U256{

pub fn hxt_str_to_f64(volume: &str) -> f64{
let res1 : &str = &volume[2..volume.len()].trim_start_matches('0');
if (res1.len()==0){
if res1.is_empty() {
return 0.0;
} else{
let res_dec = i128::from_str_radix(&res1, 16).unwrap();
Expand Down

0 comments on commit f935219

Please sign in to comment.