Event signature · Lending

Borrow (Aave V3) event signature and topic0

The topic0 of the Borrow (Aave V3) event is 0xb3d084820fb1a9decffb176436bd02558d15fac9b0ddfed8c465bc7359d7dce0, the keccak-256 hash of Borrow(address,address,address,uint256,uint8,uint256,uint16); 3 of its 7 arguments are indexed. Borrow taken on an Aave V3-style money market.

Anatomy of a Borrow (Aave V3) log

Topics

  • topic00xb3d084820fb1a9decffb176436bd02558d15fac9b0ddfed8c465bc7359d7dce0keccak256("Borrow(address,address,address,uint256,uint8,uint256,uint16)")
  • topic1reserve (address)indexed: filterable
  • topic2onBehalfOf (address)indexed: filterable
  • topic3referralCode (uint16)indexed: filterable

Data

  • datauser (address), amount (uint256), interestRateMode (uint8), borrowRate (uint256)ABI-encoded, decoded with the ABI
Parameters

Arguments and where they sit in the log

Indexed arguments travel as topics and can be filtered cheaply; the others are ABI-encoded together in the data.

NameTypeIn the log
reserveaddresstopic1
useraddressdata
onBehalfOfaddresstopic2
amountuint256data
interestRateModeuint8data
borrowRateuint256data
referralCodeuint16topic3

Solidity declaration

event Borrow(address indexed reserve, address user, address indexed onBehalfOf, uint256 amount, uint8 interestRateMode, uint256 borrowRate, uint16 indexed referralCode);

Canonical signature

Borrow(address,address,address,uint256,uint8,uint256,uint16)

topic0

0xb3d084820fb1a9decffb176436bd02558d15fac9b0ddfed8c465bc7359d7dce0

Ready-made alerts

Get an alert on Borrow

Each rule opens with the contract and the conditions filled in. Sign in, pick your chat and click Create.

Who emits it

Contracts we list that emit Borrow

Any other contract with the same signature emits a log with the same topic0.

Code

Read Borrow logs in code

The same filter in viem, ethers and plain JSON-RPC, and the Solidity that emits it. The address is Aave V3 Core Pool, a contract we list that emits it.

viem
import { createPublicClient, http, parseAbiItem } from "viem"
import { mainnet } from "viem/chains"

const client = createPublicClient({ chain: mainnet, transport: http() })

const logs = await client.getLogs({
  address: "0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2",
  event: parseAbiItem("event Borrow(address indexed reserve, address user, address indexed onBehalfOf, uint256 amount, uint8 interestRateMode, uint256 borrowRate, uint16 indexed referralCode)"),
  fromBlock: "latest",
})

for (const log of logs) console.log(log.args) // { reserve, user, onBehalfOf, amount, interestRateMode, borrowRate, referralCode }
ethers v6
import { Interface, JsonRpcProvider } from "ethers"

const provider = new JsonRpcProvider(process.env.RPC_URL)
const iface = new Interface(["event Borrow(address indexed reserve, address user, address indexed onBehalfOf, uint256 amount, uint8 interestRateMode, uint256 borrowRate, uint16 indexed referralCode)"])

const logs = await provider.getLogs({
  address: "0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2",
  topics: [iface.getEvent("Borrow")!.topicHash],
})

for (const log of logs) console.log(iface.parseLog(log)?.args)
JSON-RPC (eth_getLogs)
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "eth_getLogs",
  "params": [
    {
      "address": "0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2",
      "topics": [
        "0xb3d084820fb1a9decffb176436bd02558d15fac9b0ddfed8c465bc7359d7dce0"
      ],
      "fromBlock": "latest"
    }
  ]
}
Solidity
event Borrow(address indexed reserve, address user, address indexed onBehalfOf, uint256 amount, uint8 interestRateMode, uint256 borrowRate, uint16 indexed referralCode);

// inside a function:
emit Borrow(reserve, user, onBehalfOf, amount, interestRateMode, borrowRate, referralCode);
Example

An example Borrow log, encoded and decoded

Placeholder values, not a real transaction: how each argument is stored in the topics and the data, and what decoding gives back.

Encoded (as the node returns it)
  • topic0keccak256("Borrow(address,address,address,uint256,uint8,uint256,uint16)")0xb3d084820fb1a9decffb176436bd02558d15fac9b0ddfed8c465bc7359d7dce0
  • topic1reserve0x0000000000000000000000001111111111111111111111111111111111111111
  • topic2onBehalfOf0x0000000000000000000000003333333333333333333333333333333333333333
  • topic3referralCode0x0000000000000000000000000000000000000000000000000000000000000007
  • data0x00000000000000000000000022222222222222222222222222222222222222220000000000000000000000000000000000000000000000000000000000000fa000000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000001770
Decoded with the ABI
  • reserveaddress · indexed0x1111111111111111111111111111111111111111
  • useraddress0x2222222222222222222222222222222222222222
  • onBehalfOfaddress · indexed0x3333333333333333333333333333333333333333
  • amountuint2564000
  • interestRateModeuint85
  • borrowRateuint2566000
  • referralCodeuint16 · indexed7
FAQ

Frequently asked questions

What is the topic0 of the Borrow (Aave V3) event?

0xb3d084820fb1a9decffb176436bd02558d15fac9b0ddfed8c465bc7359d7dce0: the keccak-256 hash of Borrow(address,address,address,uint256,uint8,uint256,uint16).

Which Borrow (Aave V3) arguments are indexed?

reserve, onBehalfOf, referralCode are indexed and sit in the log's topics; user, amount, interestRateMode, borrowRate are in the data.

How do I get an alert when a contract emits Borrow (Aave V3)?

Open one of the ready-made rules on this page, or add any contract and pick Borrow (Aave V3) from the event list. Conditions can be set on indexed and non-indexed arguments, and each alert names the contract and links to the transaction.

Keep exploring

More event signatures and tools

Know the moment a contract emits it

The Beta plan is free: one wallet and one contract, no credit card.