This commit is contained in:
Bryan Stitt 2023-06-08 11:33:16 -07:00
parent 334b1c21b3
commit 74280bc329
5 changed files with 9 additions and 12 deletions

View File

@ -18,7 +18,7 @@ use entities::{balance, login, pending_login, referee, referrer, rpc_key, user};
use ethers::{prelude::Address, types::Bytes}; use ethers::{prelude::Address, types::Bytes};
use hashbrown::HashMap; use hashbrown::HashMap;
use http::StatusCode; use http::StatusCode;
use log::{debug, warn}; use log::{debug, warn, trace};
use migration::sea_orm::prelude::{Decimal, Uuid}; use migration::sea_orm::prelude::{Decimal, Uuid};
use migration::sea_orm::{ use migration::sea_orm::{
self, ActiveModelTrait, ColumnTrait, EntityTrait, IntoActiveModel, QueryFilter, self, ActiveModelTrait, ColumnTrait, EntityTrait, IntoActiveModel, QueryFilter,

View File

@ -181,7 +181,7 @@ pub async fn user_balance_post(
// .topics[0] // .topics[0]
// { // {
// debug!("Bloom input bytes is: {:?}", x); // debug!("Bloom input bytes is: {:?}", x);
// debug!("Bloom input bytes is: {:?}", x..as_fixed_bytes()); // debug!("Bloom input bytes is: {:?}", x.as_fixed_bytes());
// debug!("Bloom input as hex is: {:?}", hex!(x)); // debug!("Bloom input as hex is: {:?}", hex!(x));
// let bloom_input = BloomInput::Raw(hex!(x)); // let bloom_input = BloomInput::Raw(hex!(x));
// debug!( // debug!(

View File

@ -15,7 +15,7 @@ use entities::{balance, rpc_key, secondary_user, user};
use ethers::types::Address; use ethers::types::Address;
use hashbrown::HashMap; use hashbrown::HashMap;
use http::StatusCode; use http::StatusCode;
use log::{trace, warn}; use log::trace;
use migration::sea_orm; use migration::sea_orm;
use migration::sea_orm::ActiveModelTrait; use migration::sea_orm::ActiveModelTrait;
use migration::sea_orm::ColumnTrait; use migration::sea_orm::ColumnTrait;

View File

@ -20,10 +20,8 @@ use fstrings::{f, format_args_f};
use hashbrown::HashMap; use hashbrown::HashMap;
use influxdb2::api::query::FluxRecord; use influxdb2::api::query::FluxRecord;
use influxdb2::models::Query; use influxdb2::models::Query;
use log::{debug, error, info, trace, warn}; use log::{debug, error, trace, warn};
use migration::sea_orm::ColumnTrait; use migration::sea_orm::{ColumnTrait, EntityTrait, QueryFilter};
use migration::sea_orm::EntityTrait;
use migration::sea_orm::QueryFilter;
use serde_json::json; use serde_json::json;
use ulid::Ulid; use ulid::Ulid;

View File

@ -426,9 +426,9 @@ impl BufferedRpcQueryStats {
} }
// Duplicate code, I should fix this later ... // Duplicate code, I should fix this later ...
let user_balance = (sender_balance.total_deposits let user_balance = sender_balance.total_deposits
- sender_balance.total_spent_outside_free_tier - sender_balance.total_spent_outside_free_tier
+ deltas.usage_bonus_to_request_sender_through_referral); + deltas.usage_bonus_to_request_sender_through_referral;
// Split up the component of into how much of the paid component was used, and how much of the free component was used (anything after "balance") // Split up the component of into how much of the paid component was used, and how much of the free component was used (anything after "balance")
if user_balance - self.sum_credits_used >= Decimal::from(0) { if user_balance - self.sum_credits_used >= Decimal::from(0) {
@ -439,12 +439,11 @@ impl BufferedRpcQueryStats {
deltas.balance_spent_excluding_free_credits = self.sum_credits_used; deltas.balance_spent_excluding_free_credits = self.sum_credits_used;
} }
Ok((deltas, Some((referral_entity, referrer_code_entity)))) Ok((deltas, Some((referral_entity, referrer_code_entity))))
} else { } else {
let user_balance = (sender_balance.total_deposits let user_balance = sender_balance.total_deposits
- sender_balance.total_spent_outside_free_tier - sender_balance.total_spent_outside_free_tier
+ deltas.usage_bonus_to_request_sender_through_referral); + deltas.usage_bonus_to_request_sender_through_referral;
// Split up the component of into how much of the paid component was used, and how much of the free component was used (anything after "balance") // Split up the component of into how much of the paid component was used, and how much of the free component was used (anything after "balance")
if user_balance - self.sum_credits_used >= Decimal::from(0) { if user_balance - self.sum_credits_used >= Decimal::from(0) {