# Web3 Sheets by GFX Labs Web3 Sheets makes utilizing Ethereum data easily accessible from within Google Sheets. Featuring full historical data for all data types and does not require contracts to be verified on Etherscan. ## Install 1. Make a new Google Sheet 2. Click Extensions 3. Click Add-ons 4. Click Get add-ons 5. Search for Jimmmy & click (this is staging) 6. Individual install & follow the prompts Staging: [Link](https://workspace.google.com/u/1/marketplace/app/jimmyjimmyjimmy/226976142560) to add-on ## Examples * Web3 Sheets Demo: [Aave v2](https://docs.google.com/spreadsheets/d/1OCKGxo6KefwGNAD8AgA1m5yIkZnWN55hr5kjwWdZz1s/edit#gid=1930306329) ![](https://hackmd.io/_uploads/H11UwpYIs.png) * Web3 Sheets Demo: [Compound v2](https://docs.google.com/spreadsheets/d/1XwDs-nYWtC4f1gUOEEp_lnE0wjejG0Orbeekb_yC_Pk/edit?usp=sharing) ![](https://hackmd.io/_uploads/r1WmMTYIs.png) * Web3 Sheets Demo: [Chainlink](https://docs.google.com/spreadsheets/d/1UboQKUjQdx-zOuAxHomDlwKxwgkiUzZIvL7xOKryApk/edit?usp=sharing) ![](https://hackmd.io/_uploads/B1Ccu6Y8o.png) * Web3 Sheets Demo: [Uniswap](https://docs.google.com/spreadsheets/d/1HcA9V4DwX8-ZOVP6jnKCR7IUHcSPIwF8Hp-2gZoFn6U/edit#gid=0) ![](https://hackmd.io/_uploads/SkiaHP68o.png) * Web3 Sheets Demo: [MakerDao](https://docs.google.com/spreadsheets/d/1BbvqelzkAUTrmzhy5tM4p8xuU2X80uKlKf-s7cPaAdU/edit?usp=sharing) ![](https://hackmd.io/_uploads/SJJJBua8i.png) * Web3 Sheets Demo: [Interest Protocol](https://docs.google.com/spreadsheets/d/1m0CcK3vHAgCCC52ukXzJ1njQ5fsKc5buSs3E1e2BrMQ/edit?usp=sharing) * Web3 Sheets Demo: [USDC Blacklist](https://docs.google.com/spreadsheets/d/1nJZMPlgq4q7cnH_EjOVBNECdsA3pJOQbHUAwUQjQRPs/edit#gid=0) ![](https://hackmd.io/_uploads/BkUfPWQwi.png) ## Functions We have five different functions * ETHBALANCE: for getting the Ether balance of an address * CALLINT: for functions that return an integer * CALLADDRESS: for functions that return an address * CALLSTR: for functions that return a string * CURRENT_BLOCK: returns the current block number ## Components of a query ### Basic example **Function(path, options, signature, arguments)** * Example to get the WETH balance of an address `=CALLINT("","0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2","balanceOf(address)","0x8ad599c3a0ff1de082011efddc58f1908eb6e6d8")` ![](https://hackmd.io/_uploads/S13XkwQUo.png) ### How path works Path is utilized for functions that return objects and arrays. To index an array use "/" and to index an object use "." * Example of an array. To get the LTV of USDC on Aave v2. getReserveConfigurationData returns an object that can be indexed. By passing "1" you will get the result on the 1 position. `=CALLINT("1","0x057835Ad21a177dbdd3090bB1CAE03EaCF78Fc6d","getReserveConfigurationData(address)","0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48")` ![](https://hackmd.io/_uploads/HyPckv7Is.png) * Example of an array within array. To get the 2nd token's symbol & address: WBTC & 0x2260fac5e5542a773aa44fbcfedf7c193bc2c599 `=CALLCSTR("/1./","0x057835Ad21a177dbdd3090bB1CAE03EaCF78Fc6d","getAllReservesTokens()")` `=CALLADDRESS("/1/0","0x057835Ad21a177dbdd3090bB1CAE03EaCF78Fc6d","getAllReservesTokens()")` ![](https://hackmd.io/_uploads/SJ9JlPQLi.png) ### How options work Options is by default the target address for the function call. However, the user may utilize `COPS(target, blocknumber)` to make historical calls. * Example to get the WETH balance of an address at a specific block `=CALLINT("",COPS("0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",15986709),"balanceOf(address)","0x8ad599c3a0ff1de082011efddc58f1908eb6e6d8")` ### How signatures work Signature is the function written on the smart contract & displayed on Etherescan. * Example to get the WETH balance of an address `=CALLINT("","0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2","balanceOf(address)","0x8ad599c3a0ff1de082011efddc58f1908eb6e6d8")` ### How arguments work Arguments is whatever you are passing into the function call. You can pass no arguments or multiple arguements by adding multiple commas. * Example of having no arguments. This is a query for a Chainlink ETH-USD price at a specific block. `=CALLINT("", COPS("0x5f4ec3df9cbd43714fe2740f5e3616155c5b8419", 15986709),"latestAnswer()")` ![](https://hackmd.io/_uploads/HyMaBD7Lj.png) * Example of having more than one arguement. This is a query for accountAssets by a user's address on Compound v2.`=CALLINT("","0x3d9819210a31b4961b30ef54be2aed79b9c9cd3b","accountAssets(address,uint256)","0xdc10fc554d3729d4bd570afe8ff5d8b2f5207781",0)` ![](https://hackmd.io/_uploads/HJWYBw7Ii.png) * Example of passing an array. This is query is to calculate the TWAP price of the Uniswap v3 ETH-USDC pool. "/0" is to get the tick and "0,14400" is so we get info from now and 14400 seconds ago. `=CALLINT("/0","0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640","observe(uint32[])",ARRAY(0,14400))` ![](https://hackmd.io/_uploads/SJ3d8CFUi.png) * Example of an array & struct. This is query is calculate the TWAP price of the Balancer wstETH-ETH pool from now to 14400 seconds ago. `= CALLINT("/0", "0x32296969ef14eb0c6d29669c550d4a0449130230", "getTimeWeightedAverage((uint8,uint256,uint256)[])", ARRAY(STRUCT(0,1400,0)))` ![](https://hackmd.io/_uploads/S1kGdRtLs.png) ## How to use Web3 Sheets in multiple documents 1. Create a new Google Sheet with your same email 2. Go to Extensions>Add-ons>Manage Add-ons 3. Locate the extension and click on the three dots in the top right of the tile 4. Select "Use in this document" ## FAQ * How do I handle a boolean result * CALLINT will return 1 for true and 0 for false * Do I need to pass a blocknumber? * No, it will default to the latest * How do I make sure I'm getting the latest data? * Set the blocknumber to "latest"