SOCI4L

Reading a contract

Step 1 of 2
0 of 2 goals

Describe what you want to call

A contract is bytecode at an address. The ABI is what turns a name you type into the bytes it expects.

const abi = parseAbi([
  'function symbol() view returns (string)',
])
const symbol = await client.readContract({
  address: addresses.AcademyToken, abi, functionName: 'symbol',
})
console.log(symbol)

A view call costs nothing and is not a transaction.

// A token is deployed on this chain.
// Its address is in `addresses.AcademyToken`.

Press Run, or hit the button above. Output lands here.

Goals

The code runs without throwing
run the code to check this
Read the token symbol
run the code to check this
Run the code to load this lesson’s chain.