mirror of
https://github.com/cerc-io/watcher-ts
synced 2024-11-19 20:36:19 +00:00
b243025ca8
* 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> |
||
---|---|---|
.. | ||
src | ||
test | ||
.eslintignore | ||
.eslintrc.json | ||
.gitignore | ||
hardhat.config.ts | ||
package.json | ||
README.md | ||
tsconfig.json |
solidity-mapper
Get value of state variable from storage for a solidity contract.
Pre-requisites
-
NodeJS and NPM
Instructions
Run the tests using the following command
$ yarn test
Different Types
- Booleans
- Integers
- Fixed Point Numbers
- Address
- Contract Types
- Fixed-size byte arrays
- Enums
- Function Types
- Arrays
- Dynamically-sized byte array
- Bytes
- String
- Structs
- Mapping Types
Observations
-
The storage layouts are formed according to the rules in https://docs.soliditylang.org/en/latest/internals/layout_in_storage.html#layout-of-state-variables-in-storage
-
Structs can occupy multiple slots depending on the size required by its members.
-
Fixed arrays can occupy multiple slots according to the size of the array and the type of array.