SOCI4L

Events are the chain’s history

Step 1 of 2
0 of 2 goals

Pull the log history

balanceOf says what someone holds now. It cannot say how they got it. Logs can.

const transfer = parseAbiItem(
  'event Transfer(address indexed from, address indexed to, uint256 value)'
)
const logs = await client.getLogs({
  address: addresses.AcademyToken, event: transfer,
  fromBlock: 'earliest', toBlock: 'latest',
})
console.log(logs.length)
// The token has emitted a Transfer event for every movement.
// Vault: 0x4444444444444444444444444444444444444444

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

Goals

The code runs without throwing
run the code to check this
Find all five Transfer events
run the code to check this
Run the code to load this lesson’s chain.