How To Query For A String
If you're starting with Web3 Sheets, you might want to call an string. This tutorial assumes you already have Web3 Sheets installed.
Web3 Sheets Demo: Calling Strings
Requirements
- You need the contract address you're calling.
Basic Example
The structure of the query is as follows:
=CALLSTRING(path, target address, function signature, optional arguments)
For example, let's say you want to look up the name of the Uniswap governance contract on Ethereum.
=CALLSTRING("","0x408ED6354d4973f66138C91495F2f2FCbd8724C3","name()")
It will return "Uniswap Governor Bravo".
Multichain Call Address
To make a multichain call simply add the desired network. For example, let's say you want to look up the Optimism governance contract name.
=CALLSTRING("",COPS("0xcDF27F107725988f2261Ce2256bDfCdE8B382B10","latest","op"),"name()")
It will return "Optimism".
Switch out "latest" with a specific block number to make a historical call.
Calling A String That Is Formated As bytes32
Some strings are formated as bytes. Simply use the CALLCSTRING function to handle bytes. For exmaple, MakerDAO's MKR contract stores the name and symbol in bytes32.
=CALLCSTR("","0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2","name()")
=CALLCSTR("","0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2","symbol()")
The name will return Maker and the symbol will return MKR,