empty value of entity after writing with .save() and reading with ::find()
in that case, AccountBalanceChangeEventsBatch contains only 1 value of 5
We have a very important value in our contracts called open_interest, it is calculated by the formula open_interest = open_interest - abs(old_account_balance.taker_open_notional) + abs(account_balance.taker_open_notional)
(if account_balance and position are the same thing)
to calculate this value I used OpenInterestEntity::find(OpenInterestEntity::id().eq(open_interest_id.clone())) in account_balance_change_event_handler, but judging by the logs it returned a zero value of OpenInterestEntity when it was not zero, please tell me what can be the matter here.
more logs are here
looks like getting the order by ID returns a zero value
because we are saving value 21074050192 and straight after that we see open_interest_entity isn't None, but value 0 after unwrap
Just for the sake of sanity, could you print
open_interest_entity.save()
info!("{open_interest_entity}");
info!("{}", OpenInterestEntity::find(OpenInterestEntity::id().eq(open_interest_entity.id.clone()).unwrap());
That is, save, print, lookup, print.
This way we’d know if it was saved properly.
The id and market are correct, though. So, it finds a value, but the value has OI zero, just after .save() and even on the next tx handler
empty value of entity after writing with
.save()
and reading with::find()
in that case,
AccountBalanceChangeEventsBatch
contains only 1 value of 5 We have a very important value in our contracts calledopen_interest
, it is calculated by the formulaopen_interest = open_interest - abs(old_account_balance.taker_open_notional) + abs(account_balance.taker_open_notional)
(if account_balance and position are the same thing)
to calculate this value I used
OpenInterestEntity::find(OpenInterestEntity::id().eq(open_interest_id.clone()))
inaccount_balance_change_event_handler
, but judging by the logs it returned a zero value ofOpenInterestEntity
when it was not zero, please tell me what can be the matter here.more logs are here looks like getting the order by ID returns a zero value because we are saving value 21074050192 and straight after that we see open_interest_entity isn't None, but value 0 after unwrap
![image](https://github.com/FuelLabs/fuel-indexer/assets/35231749/06e3fbbc-78f3-481c-b950-854deb6de910)
The id and market are correct, though. So, it finds a value, but the value has OI zero, just after .save() and even on the next tx handler
My toolchain