Skip to content

Commit

Permalink
fix: all decimals to bigdecimals
Browse files Browse the repository at this point in the history
  • Loading branch information
sevenzing committed Oct 9, 2024
1 parent dab82c1 commit 002a7c5
Show file tree
Hide file tree
Showing 18 changed files with 35 additions and 35 deletions.
2 changes: 1 addition & 1 deletion libs/blockscout-db/entity/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "blockscout-db-entity"
version = "0.2.0+blockscout.6.8.0"
version = "0.2.1+blockscout.6.8.0"
edition = "2021"
publish = false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ pub struct Model {
pub r#type: Option<String>,
pub method: Option<String>,
pub block_number: Option<i32>,
pub amount: Option<Decimal>,
pub tx_fee: Option<Decimal>,
pub amount: Option<BigDecimal>,
pub tx_fee: Option<BigDecimal>,
pub viewed_at: Option<DateTime>,
pub inserted_at: DateTime,
pub updated_at: DateTime,
Expand Down
2 changes: 1 addition & 1 deletion libs/blockscout-db/entity/src/address_coin_balances.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub block_number: i64,
#[sea_orm(column_type = "Decimal(Some((100, 0)))", nullable)]
pub value: Option<Decimal>,
pub value: Option<BigDecimal>,
pub value_fetched_at: Option<DateTime>,
pub inserted_at: DateTime,
pub updated_at: DateTime,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub day: Date,
#[sea_orm(column_type = "Decimal(Some((100, 0)))", nullable)]
pub value: Option<Decimal>,
pub value: Option<BigDecimal>,
pub inserted_at: DateTime,
pub updated_at: DateTime,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ pub struct Model {
pub block_number: i64,
#[sea_orm(column_type = "VarBinary(StringLen::None)")]
pub token_contract_address_hash: Vec<u8>,
pub value: Option<Decimal>,
pub value: Option<BigDecimal>,
pub value_fetched_at: Option<DateTime>,
pub inserted_at: DateTime,
pub updated_at: DateTime,
pub old_value: Option<Decimal>,
pub old_value: Option<BigDecimal>,
#[sea_orm(column_type = "Decimal(Some((78, 0)))", nullable)]
pub token_id: Option<Decimal>,
pub token_type: Option<String>,
Expand Down
2 changes: 1 addition & 1 deletion libs/blockscout-db/entity/src/address_token_balances.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub struct Model {
pub block_number: i64,
#[sea_orm(column_type = "VarBinary(StringLen::None)")]
pub token_contract_address_hash: Vec<u8>,
pub value: Option<Decimal>,
pub value: Option<BigDecimal>,
pub value_fetched_at: Option<DateTime>,
pub inserted_at: DateTime,
pub updated_at: DateTime,
Expand Down
2 changes: 1 addition & 1 deletion libs/blockscout-db/entity/src/addresses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use sea_orm::entity::prelude::*;
#[sea_orm(table_name = "addresses")]
pub struct Model {
#[sea_orm(column_type = "Decimal(Some((100, 0)))", nullable)]
pub fetched_coin_balance: Option<Decimal>,
pub fetched_coin_balance: Option<BigDecimal>,
pub fetched_coin_balance_block_number: Option<i64>,
#[sea_orm(
primary_key,
Expand Down
2 changes: 1 addition & 1 deletion libs/blockscout-db/entity/src/block_rewards.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub struct Model {
)]
pub block_hash: Vec<u8>,
#[sea_orm(column_type = "Decimal(Some((100, 0)))", nullable)]
pub reward: Option<Decimal>,
pub reward: Option<BigDecimal>,
pub inserted_at: DateTime,
pub updated_at: DateTime,
}
Expand Down
6 changes: 3 additions & 3 deletions libs/blockscout-db/entity/src/blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use sea_orm::entity::prelude::*;
pub struct Model {
pub consensus: bool,
#[sea_orm(column_type = "Decimal(Some((50, 0)))", nullable)]
pub difficulty: Option<Decimal>,
pub difficulty: Option<BigDecimal>,
#[sea_orm(column_type = "Decimal(Some((100, 0)))")]
pub gas_limit: BigDecimal,
#[sea_orm(column_type = "Decimal(Some((100, 0)))")]
Expand All @@ -29,12 +29,12 @@ pub struct Model {
pub size: Option<i32>,
pub timestamp: DateTime,
#[sea_orm(column_type = "Decimal(Some((50, 0)))", nullable)]
pub total_difficulty: Option<Decimal>,
pub total_difficulty: Option<BigDecimal>,
pub inserted_at: DateTime,
pub updated_at: DateTime,
pub refetch_needed: Option<bool>,
#[sea_orm(column_type = "Decimal(Some((100, 0)))", nullable)]
pub base_fee_per_gas: Option<Decimal>,
pub base_fee_per_gas: Option<BigDecimal>,
pub is_empty: Option<bool>,
}

Expand Down
2 changes: 1 addition & 1 deletion libs/blockscout-db/entity/src/emission_rewards.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub struct Model {
column_type = "custom(\"int8range\")"
)]
pub block_range: String,
pub reward: Option<Decimal>,
pub reward: Option<BigDecimal>,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
Expand Down
4 changes: 2 additions & 2 deletions libs/blockscout-db/entity/src/internal_transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ pub struct Model {
pub created_contract_code: Option<Vec<u8>>,
pub error: Option<String>,
#[sea_orm(column_type = "Decimal(Some((100, 0)))", nullable)]
pub gas: Option<Decimal>,
pub gas: Option<BigDecimal>,
#[sea_orm(column_type = "Decimal(Some((100, 0)))", nullable)]
pub gas_used: Option<Decimal>,
pub gas_used: Option<BigDecimal>,
pub index: i32,
#[sea_orm(column_type = "VarBinary(StringLen::None)", nullable)]
pub init: Option<Vec<u8>>,
Expand Down
2 changes: 1 addition & 1 deletion libs/blockscout-db/entity/src/last_fetched_counters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub counter_type: String,
#[sea_orm(column_type = "Decimal(Some((100, 0)))", nullable)]
pub value: Option<Decimal>,
pub value: Option<BigDecimal>,
pub inserted_at: DateTime,
pub updated_at: DateTime,
}
Expand Down
8 changes: 4 additions & 4 deletions libs/blockscout-db/entity/src/market_history.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ pub struct Model {
#[sea_orm(primary_key)]
pub id: i64,
pub date: Date,
pub closing_price: Option<Decimal>,
pub opening_price: Option<Decimal>,
pub market_cap: Option<Decimal>,
pub tvl: Option<Decimal>,
pub closing_price: Option<BigDecimal>,
pub opening_price: Option<BigDecimal>,
pub market_cap: Option<BigDecimal>,
pub tvl: Option<BigDecimal>,
pub secondary_coin: Option<bool>,
}

Expand Down
2 changes: 1 addition & 1 deletion libs/blockscout-db/entity/src/token_transfers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub struct Model {
pub from_address_hash: Vec<u8>,
#[sea_orm(column_type = "VarBinary(StringLen::None)")]
pub to_address_hash: Vec<u8>,
pub amount: Option<Decimal>,
pub amount: Option<BigDecimal>,
#[sea_orm(column_type = "VarBinary(StringLen::None)")]
pub token_contract_address_hash: Vec<u8>,
pub inserted_at: DateTime,
Expand Down
10 changes: 5 additions & 5 deletions libs/blockscout-db/entity/src/tokens.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ pub struct Model {
pub name: Option<String>,
#[sea_orm(column_type = "Text", nullable)]
pub symbol: Option<String>,
pub total_supply: Option<Decimal>,
pub decimals: Option<Decimal>,
pub total_supply: Option<BigDecimal>,
pub decimals: Option<BigDecimal>,
pub r#type: String,
pub cataloged: Option<bool>,
#[sea_orm(
Expand All @@ -24,12 +24,12 @@ pub struct Model {
pub updated_at: DateTime,
pub holder_count: Option<i32>,
pub skip_metadata: Option<bool>,
pub fiat_value: Option<Decimal>,
pub circulating_market_cap: Option<Decimal>,
pub fiat_value: Option<BigDecimal>,
pub circulating_market_cap: Option<BigDecimal>,
pub total_supply_updated_at_block: Option<i64>,
pub icon_url: Option<String>,
pub is_verified_via_admin_panel: Option<bool>,
pub volume_24h: Option<Decimal>,
pub volume_24h: Option<BigDecimal>,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
Expand Down
4 changes: 2 additions & 2 deletions libs/blockscout-db/entity/src/transaction_stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ pub struct Model {
pub date: Option<Date>,
pub number_of_transactions: Option<i32>,
#[sea_orm(column_type = "Decimal(Some((100, 0)))", nullable)]
pub gas_used: Option<Decimal>,
pub gas_used: Option<BigDecimal>,
#[sea_orm(column_type = "Decimal(Some((100, 0)))", nullable)]
pub total_fee: Option<Decimal>,
pub total_fee: Option<BigDecimal>,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
Expand Down
10 changes: 5 additions & 5 deletions libs/blockscout-db/entity/src/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ use sea_orm::entity::prelude::*;
#[sea_orm(table_name = "transactions")]
pub struct Model {
#[sea_orm(column_type = "Decimal(Some((100, 0)))", nullable)]
pub cumulative_gas_used: Option<Decimal>,
pub cumulative_gas_used: Option<BigDecimal>,
pub error: Option<String>,
#[sea_orm(column_type = "Decimal(Some((100, 0)))")]
pub gas: BigDecimal,
#[sea_orm(column_type = "Decimal(Some((100, 0)))", nullable)]
pub gas_price: Option<Decimal>,
pub gas_price: Option<BigDecimal>,
#[sea_orm(column_type = "Decimal(Some((100, 0)))", nullable)]
pub gas_used: Option<Decimal>,
pub gas_used: Option<BigDecimal>,
#[sea_orm(
primary_key,
auto_increment = false,
Expand Down Expand Up @@ -51,9 +51,9 @@ pub struct Model {
#[sea_orm(column_type = "Text", nullable)]
pub revert_reason: Option<String>,
#[sea_orm(column_type = "Decimal(Some((100, 0)))", nullable)]
pub max_priority_fee_per_gas: Option<Decimal>,
pub max_priority_fee_per_gas: Option<BigDecimal>,
#[sea_orm(column_type = "Decimal(Some((100, 0)))", nullable)]
pub max_fee_per_gas: Option<Decimal>,
pub max_fee_per_gas: Option<BigDecimal>,
pub r#type: Option<i32>,
pub has_error_in_internal_txs: Option<bool>,
pub block_timestamp: Option<DateTime>,
Expand Down
2 changes: 1 addition & 1 deletion libs/blockscout-db/migration/src/migration.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1570,7 +1570,7 @@ CREATE TABLE public.tokens (
name text,
symbol text,
total_supply numeric,
decimals numeric,
BigDecimals numeric,
type character varying(255) NOT NULL,
cataloged boolean DEFAULT false,
contract_address_hash bytea NOT NULL,
Expand Down

0 comments on commit 002a7c5

Please sign in to comment.