Commit Graph

636 Commits

Author SHA1 Message Date
Ashwin Phatak
eb20708faf
Tests for maps with struct type value and double nested maps (#58)
* Tests for fixed array of struct type.

* Add tests for maps with struct type value and double nested maps.

Co-authored-by: nikugogoi <95nikass@gmail.com>
2021-06-14 16:23:41 +05:30
Ashwin Phatak
f5c1a22fdc
Tests for getting array and string type member value in struct (#57)
* Add tests for structs with fixed array and string type
 members.

* Refactor functions in solidity-mapper storage.

* Add tests for getting array and string type member value in struct.

Co-authored-by: nikugogoi <95nikass@gmail.com>
2021-06-14 16:12:42 +05:30
nikugogoi
2fcfadecc2 Implement getting value of struct by member name. 2021-06-11 16:45:12 +05:30
nikugogoi
b33ce0b640 Get array element by specifying index. 2021-06-11 16:44:27 +05:30
Ashwin Phatak
8851882144
Get value of struct type (#54)
* Implement getting value for struct types.

* Add tests for structs with value type memebers.

* Add tests for verifying proof in struct type.

Co-authored-by: nikugogoi <95nikass@gmail.com>
2021-06-11 11:19:20 +05:30
Ashwin Phatak
5316b19fbf
Get fixed size array of type address (#53)
* Add test for fixed array of address type.

* Add tests for verifying proof data.

Co-authored-by: nikugogoi <95nikass@gmail.com>
2021-06-11 11:16:02 +05:30
Ashwin Phatak
df025433ec
Tests for getStorageValue on mapping and nested mappings with different key types (#52)
* Tests for mapping with value type keys.

* Add test for mapping with string type keys.

* Add test for mapping with dynamically-sized byte array as keys.

* Add tests for nested mapping.

Co-authored-by: nikugogoi <95nikass@gmail.com>
2021-06-10 11:22:03 +05:30
Ashwin Phatak
c916e61a9b GQL mutation to start watching contract. 2021-06-09 15:54:10 +05:30
Ashwin Phatak
7035a513b1
Downstream event subscription support. (#47)
* Downstream event subscription support.

* Logging changes.
2021-06-09 15:11:05 +05:30
Ashwin Phatak
fc44617db3
Use solidity mapper to get value for mapping and nested mapping (balance and allowance) (#48)
* Implement getting value for basic mapping type.

* Add test for basic mapping type.

* Implement getting value for nested mapping type.

Co-authored-by: nikugogoi <95nikass@gmail.com>
2021-06-09 10:18:19 +05:30
Ashwin Phatak
84e1927402
Watch upstream ERC20 events to trigger indexing (#43)
* Move to apollo client, enables subscriptions.

* Watch logs and trigger other indexer methods.

* Refactoring config loading, watched contracts table.

* Check event sync progress inside transaction.

* Refactoring server startup.
2021-06-08 16:07:52 +05:30
nikugogoi
a13a909a85 Implement getting storage value for uint256 type in watcher. 2021-06-08 12:49:00 +05:30
nikugogoi
c3d1737ee1 Setup lerna to run scripts across packages. 2021-06-08 12:49:00 +05:30
nikugogoi
8d697ab9d1 Check and remove unused dependecies. 2021-06-07 11:42:03 +05:30
Ashwin Phatak
945cba9392
Implement typescript strict mode and ESLint in watcher package (#40)
* Set up typescript build and eslint.

* Automatic lint fixes.

* Fix argument type warnings.

* Fix function return types.

* Fix typescript errors in watcher.

Co-authored-by: nikugogoi <95nikass@gmail.com>
2021-06-04 18:08:26 +05:30
Ashwin Phatak
3aaa9dd7f8
Use postgres instead of sqlite. (#38) 2021-06-04 15:19:30 +05:30
Ashwin Phatak
4e0ef7c852
Implement typescript strict mode and ESLint in ipld-eth-client and cache packages (#37)
* Set up typescript build.

* Setup eslint in cache package.

* Automatic lint fixes.

* Fix typescript return types.

* Fix typescript argument type warnings.

* Set up typescript build and eslint.

* Automatic lint fixes.

* Fix typescript explicit any warnings.

* Add argument types.

* Fix return type warnings.

* Fix typescript errors.

* Implement declaration in types directory.

Co-authored-by: nikugogoi <95nikass@gmail.com>
2021-06-04 12:04:12 +05:30
Ashwin Phatak
47ce52c112
Sqlite based index for ERC20 data (#31)
* Save/load balance and allowance data to/from RDBMS.

* Event entities.

* Pass artifacts to indexer.

* Refactoring, comments.

* Sync events to database.

* Absorb typeorm config file settings into our own config file.
2021-06-03 17:31:21 +05:30
Ashwin Phatak
23f9a9db41
Get value for array of integer and boolean types in solidity mapper (#30)
* Implement getting value for array type.

* Add subtypes in solidit mapper readme.

Co-authored-by: nikugogoi <95nikass@gmail.com>
2021-06-03 15:03:39 +05:30
Ashwin Phatak
00eb129536
Use getStorageValue to parse value for string type variable (#29)
* Get string value of variable name.

* Use getStorageValue to parse value for string type variable.

Co-authored-by: nikugogoi <95nikass@gmail.com>
2021-06-03 11:52:23 +05:30
Ashwin Phatak
b243025ca8
Test cases in solidity-mapper for contract, fixed-size byte arrays and enum types (#26)
* Add tests for getStorageInfo and getEventNameTopics.

* Lint solidity-mapper package code.

* Add test for contract type.

* Add test for fixed size byte arrays.

* Add test for Enum types.

* Add tests for variables packed together and using single slot.

* Fix comments in test contracts.

Co-authored-by: nikugogoi <95nikass@gmail.com>
2021-06-02 11:23:33 +05:30
Ashwin Phatak
f6870d88dc
Support GQL query for name, symbol, totalSupply (#24)
* Update mock server and tests for additional ERC20 state vars.

* Refactor eth-client getStorageAt, impl totalSupply.

* Impl ERC20 API for name, symbol.
2021-06-01 18:13:41 +05:30
nikugogoi
7d7cf26f81 Add method to get event name topics from abi. 2021-05-31 16:24:45 +05:30
Ashwin Phatak
13ec526ebd Create index for ERC20 data. 2021-05-31 16:24:45 +05:30
Ashwin Phatak
a0aae09f83
Get slot for ERC20 variable from storage layout (#13)
* Get slot for ERC20 variable from storage layout.

* Fix solidity-mapper build for importing library functions.

* Implement lint command in solidity-mapper package.

Co-authored-by: nikugogoi <95nikass@gmail.com>
2021-05-31 14:50:05 +05:30
Ashwin Phatak
72ca980198
Solidity data mapper/parser (#12)
* Initial setup with hardhat and typescript.

* Add test for integer type.

* Add test for unsigned integer type.

* Add test for boolean type.

* Add test for address type.

* Add test for string type.

* Setup building library with typescript.

* Remove hardhat dependency from getStorageValue library function.

* Move contracts to test and remove deploy script.

* Add readme for running tests.

Co-authored-by: nikugogoi <95nikass@gmail.com>
2021-05-31 11:07:11 +05:30
Ashwin Phatak
7213a1dc6d
Lazy ERC20 watcher (#11)
* Storage mapping utils.

* Resolver factories.

* Get ERC20 balance from upstream ipld-eth-server slot.

* Get ERC20 allowance from storage slot.

* Parse ERC20 events from block events.

* Cache GQL requests in leveldb.

* Refactor fetch/cache from upstream into eth-loader class.

* Refactoring.

* Refactor eth-client, extract cache class.

* Cache config settings.

* Debug logs.

* Rename server to watcher.

* Start local server by default.

* Split into multiple packages.

* eth-client API methods.

* Update docs.
2021-05-28 16:56:40 +05:30
Ashwin Phatak
95eb1ac0d1 Data driven tests for GQL endpoints. 2021-05-13 19:20:43 +05:30
Ashwin Phatak
11fbe0534d Refactor mock server. 2021-05-13 16:06:38 +05:30
Ashwin Phatak
c84b481385 Move server to yarn workspace package. 2021-05-13 16:06:38 +05:30
Ashwin Phatak
1277f24fd6 Add setup/example queries. 2021-05-11 16:39:32 +05:30
Ashwin Phatak
7133b3ab86 Schema, mock data and resolvers. 2021-05-11 16:39:32 +05:30
Ashwin Phatak
2b4e1ba315 Basic GQL server with mock data. 2021-05-11 16:39:32 +05:30
Ashwin Phatak
1562af9c05 Basic typescript project. 2021-05-11 16:39:32 +05:30
HackMD
b841606156 Basic design/approach 2021-05-06 11:52:38 +00:00
Ashwin Phatak
50a3c91530
Create README.md 2021-05-06 11:45:00 +05:30