The Status module that consumes go-ethereum https://status.im
Go to file
Stefan a2ff03c79e feat: retrieve balance history for tokens and cache it to DB
Extends wallet module with the history package with the following
components:

BalanceDB (balance_db.go)

- Keeps track of balance information (token count, block, block timestamp)
for a token identity (chain, address, currency)
- The cached data is stored in `balance_history` table.
- Uniqueness constrained is enforced by the `balance_history_identify_entry`
UNIQUE index.
- Optimal DB fetching is ensured by the `balance_history_filter_entries`
index

Balance (balance.go)

- Provides two stages:
    - Fetch of balance history using RPC calls (Balance.update function)
    - Retrieving of cached balance data from the DB it exists (Balance.get
    function)
- Fetching and retrieving of data is done for specific time intervals
    defined by TimeInterval "enumeration"
- Update process is done for a token identity by the Balance.Update function
- The granularity of data points returned is defined by the constant
increment step define in `timeIntervalToStride` for each time interval.
- The `blocksStride` values have a common divisor to have cache hit
between time intervals.

Service (service.go)

- Main APIs
    - StartBalanceHistory: Regularly updates balance history for all
    enabled networks, available accounts and provided tokens.
    - GetBalanceHistory: retrieves cached token count for a token identity
    (chain, address, currency) for multiple chains
    - UpdateVisibleTokens: will set the list of tokens to have historical
    balance fetched. This is a simplification to limit tokens to a small
    list that make sense

Fetch balance history for ECR20 tokens

- Add token.Manager.GetTokenBalanceAt to fetch balance of a specific
block number of ECR20.
- Add tokenChainClientSource concrete implementation of DataSource
to fetch balance of ECR20 tokens.
- Chose the correct DataSource implementation based on the token
"is native" property.

Tests

Tests are implemented using a mock of `DataSource` interface used
to intercept the RPC calls.

Notes:

- the timestamp used for retrieving block balance is constant

Closes status-desktop: #8175, #8226, #8862
2023-01-25 22:25:50 +04:00
.dependabot Patch/dependabot protocol (#1980) 2020-05-19 00:14:02 +01:00
.github fix documentation url in the checklist (#2770) 2022-07-22 22:12:29 +05:30
.vscode chore: fix vscode test run 2022-11-17 10:40:26 +01:00
_assets ci: use WORKSPACE_TMP for TMPDIR to not abuse /run 2023-01-03 16:54:22 +01:00
_docs rename status-react to status-mobile 2022-07-17 15:37:14 +02:00
_examples go-waku integration (#2247) 2021-06-16 16:19:45 -04:00
abi-spec Upgrade linter to 1.50.0 2023-01-13 17:52:03 +00:00
account replace deprecated ioutil.TempDir with os.MkdirTemp 2023-01-03 15:40:11 +01:00
api get messenger from account service when local pairing (#3069) 2023-01-11 19:30:54 +08:00
appdatabase feat: add balance_history DB table and update migration scripts 2023-01-25 22:25:50 +04:00
appmetrics feat: make kdf iterations configurable when creating a multiaccount (#2796) 2022-09-27 16:27:20 -04:00
build/bin add .gitkeep to build/bin so it always exists 2019-03-05 14:22:00 +01:00
cmd fix(RequestCommunityInfoFromMailserver): Add useDatabase flag to read/not read community info before requesting mailserver.. 2022-11-30 11:10:13 +01:00
common Move services to status-node 2021-07-20 10:57:38 +02:00
config chore: add status.prod fleet (#2583) 2022-03-11 15:48:51 -05:00
connection Address linter issues 2022-03-28 13:14:12 +01:00
contracts feat: nonce management in multi tx 2023-01-12 12:56:57 +01:00
db Address linter issues 2022-03-28 13:14:12 +01:00
discovery chore: upgrade go-waku and log about messages sent/received 2022-11-09 17:39:17 +03:00
eth-node synchronize display name (#2989) 2022-12-29 14:16:19 +08:00
exportlogs Upgrade geth to 1.9.5 and Whisper (#1617) 2019-10-04 17:21:24 +02:00
extkeys Upgrade geth 2021-07-20 10:57:38 +02:00
images fix(images): ensure decode from URL emits error on HTTP error code 2022-09-19 12:55:17 +02:00
ipfs fix: add mode build param and change ipfs gateway accordingly 2022-08-26 18:57:55 +02:00
logutils Removed unnecessary dependency from logutil package 2021-08-19 11:35:40 +02:00
mailserver feat: add balance_history DB table and update migration scripts 2023-01-25 22:25:50 +04:00
metrics Upgrade linter to 1.50.0 2023-01-13 17:52:03 +00:00
mobile Sync all devices after initial pairing (#3047) 2023-01-06 20:21:14 +08:00
multiaccounts feat: add balance_history DB table and update migration scripts 2023-01-25 22:25:50 +04:00
node feat: ens_usernames database (#3066) 2023-01-20 13:34:30 +03:00
nodecfg feat: use identify protocol 2022-11-15 11:00:36 -04:00
notifier Notifier package to interact with gorush notifications (#910) 2018-05-08 16:30:03 +02:00
params fix: set nameserver via config 2023-01-11 08:37:31 -04:00
peers synchronize display name (#2989) 2022-12-29 14:16:19 +08:00
postgres Anon Metrics Broadcast (#2198) 2021-09-01 13:02:18 +01:00
profiling Upgrade linter to 1.50.0 2023-01-13 17:52:03 +00:00
protocol feat: add balance_history DB table and update migration scripts 2023-01-25 22:25:50 +04:00
rpc synchronize display name (#2989) 2022-12-29 14:16:19 +08:00
rtt rename status-react to status-mobile 2022-07-17 15:37:14 +02:00
server Upgrade linter to 1.50.0 2023-01-13 17:52:03 +00:00
services feat: retrieve balance history for tokens and cache it to DB 2023-01-25 22:25:50 +04:00
signal synchronize display name (#2989) 2022-12-29 14:16:19 +08:00
sqlite feat: make kdf iterations configurable when creating a multiaccount (#2796) 2022-09-27 16:27:20 -04:00
static feat: add balance_history DB table and update migration scripts 2023-01-25 22:25:50 +04:00
t feat: add balance_history DB table and update migration scripts 2023-01-25 22:25:50 +04:00
telemetry feat: Push messages to telemetry server when receiving messages 2021-11-10 09:34:14 +01:00
timesource Move services to status-node 2021-07-20 10:57:38 +02:00
transactions feat: nonce management in multi tx 2023-01-12 12:56:57 +01:00
vendor fix: close connections when maximum number of peers is reached 2023-01-18 11:43:07 -04:00
waku Upgrade linter to 1.50.0 2023-01-13 17:52:03 +00:00
wakuv2 fix: no messages from storenode 2023-01-19 10:11:44 +01:00
.codeclimate.yml feat: delete for me (#2866) 2022-09-28 19:42:17 +08:00
.dockerignore Ignore *.test files from all folders (#635) 2018-02-08 14:23:08 +02:00
.gitignore feat: add visual identity service (#2550) 2022-03-11 16:17:48 -05:00
.golangci.yml Remove protocol and eth-node submodules (#1835) 2020-02-10 12:22:37 +01:00
.travis.yml Remove Ropsten and Rinkeby test networks 2022-10-24 14:17:46 +02:00
BOOTNODE.md docs: clarify purpose and describe ports 2020-02-06 18:44:23 +01:00
CMakeLists.txt dev: allow option to force compiling for apple silicon 2022-06-30 09:42:19 +02:00
CONTRIBUTING.md rename status-react to status-mobile 2022-07-17 15:37:14 +02:00
LICENSE.md Create LICENSE.md 2016-09-21 10:00:29 +08:00
MAILSERVER.md rcp.sh: curl wrapper for easier RPC calls 2021-08-24 11:23:25 +02:00
Makefile allow building shared library on M1 Macs 2023-01-25 15:12:09 +01:00
README.md Explain how to run Waku node in README (#1921) 2020-04-09 18:33:53 +02:00
RELEASING.md rename status-react to status-mobile 2022-07-17 15:37:14 +02:00
VERSION Fix activation of deleted chat on contact update 2023-01-25 11:12:34 +01:00
WAKU.md Create WAKU.md with spec support (#1855) 2020-02-21 17:56:15 +08:00
go.mod fix: close connections when maximum number of peers is reached 2023-01-18 11:43:07 -04:00
go.sum fix: close connections when maximum number of peers is reached 2023-01-18 11:43:07 -04:00
nix.conf ci: use Nix shell to provide Android SDK for builds 2022-12-05 15:48:27 +01:00
shell.nix feat: Support fetching accepted Activity Center notifications by multiple types (#3088) 2023-01-20 09:45:32 -03:00