fluidex / rollup-state-manager

5 stars 6 forks source link

add balance details to decoded_tx #212

Closed HAOYUatHZ closed 2 years ago

HAOYUatHZ commented 2 years ago

add old_balance and new_balance

previously

https://github.com/fluidex/rollup-state-manager/issues/132

now

deposit

pub struct DepositTx {
    pub account_id: u32,
    pub token_id: u32,
    pub amount: AmountType,
    pub old_balance: AmountType,
    pub new_balance: AmountType,
}
in rust struct in tx_data.ts
old_balance balance1
new_balance balance2

withdraw

pub struct WithdrawTx {
    pub account_id: u32,
    pub token_id: u32,
    pub amount: AmountType,
    pub old_balance: AmountType,
    pub new_balance: AmountType,
}
in rust struct in tx_data.ts
old_balance balance1
new_balance balance2

transfer

pub struct TransferTx {
    pub from: u32,
    pub to: u32,
    pub token_id: u32,
    pub amount: AmountType,
    pub old_balance: AmountType,
    pub new_balance: AmountType,
}
in rust struct in tx_data.ts
account1_old_balance balance1
account1_new_balance balance1 - amount
account2_old_balance balance2 - amount
account2_new_balance balance2

spot trade

spot trade is a bit complicated. we will do that later