1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
use std::fmt::Debug;

use alloy_primitives::U256;
use clickhouse::Row;
use malachite::Rational;
use reth_primitives::Address;
use serde::{Deserialize, Serialize};

use crate::{db::token_info::TokenInfoWithAddress, FastHashMap, Protocol};

#[derive(Debug, Serialize, Clone, Row, PartialEq, Eq, Deserialize)]
pub struct NormalizedLoan {
    pub protocol:     Protocol,
    pub trace_index:  u64,
    pub lender:       Address,
    pub borrower:     Address,
    pub loaned_token: TokenInfoWithAddress,
    pub loan_amount:  Rational,
    pub collateral:   FastHashMap<TokenInfoWithAddress, Rational>,
    pub msg_value:    U256,
}

#[derive(Debug, Serialize, Clone, Row, PartialEq, Eq, Deserialize)]
pub struct NormalizedRepayment {
    pub protocol:         Protocol,
    pub trace_index:      u64,
    pub lender:           Address,
    pub borrower:         Address,
    pub repayed_token:    TokenInfoWithAddress,
    pub repayment_amount: Rational,
    pub collateral:       FastHashMap<TokenInfoWithAddress, Rational>,
    pub msg_value:        U256,
}