Borrow (Morpho Blue) event signature and topic0
The topic0 of the Borrow (Morpho Blue) event is 0x570954540bed6b1304a87dfe815a5eda4a648f7097a16240dcd85c9b5fd42a43, the keccak-256 hash of Borrow(bytes32,address,address,address,uint256,uint256); 3 of its 6 arguments are indexed. Borrow taken on a Morpho Blue market.
Topics
- topic00x570954540bed6b1304a87dfe815a5eda4a648f7097a16240dcd85c9b5fd42a43keccak256("Borrow(bytes32,address,address,address,uint256,uint256)")
- topic1id (bytes32)indexed: filterable
- topic2onBehalf (address)indexed: filterable
- topic3receiver (address)indexed: filterable
Data
- datacaller (address), assets (uint256), shares (uint256)ABI-encoded, decoded with the ABI
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.
| Name | Type | In the log |
|---|---|---|
| id | bytes32 | topic1 |
| caller | address | data |
| onBehalf | address | topic2 |
| receiver | address | topic3 |
| assets | uint256 | data |
| shares | uint256 | data |
Solidity declaration
event Borrow(bytes32 indexed id, address caller, address indexed onBehalf, address indexed receiver, uint256 assets, uint256 shares);
Canonical signature
Borrow(bytes32,address,address,address,uint256,uint256)
topic0
0x570954540bed6b1304a87dfe815a5eda4a648f7097a16240dcd85c9b5fd42a43
Get an alert on Borrow
Each rule opens with the contract and the conditions filled in. Sign in, pick your chat and click Create.
Contracts we list that emit Borrow
Any other contract with the same signature emits a log with the same topic0.
Read Borrow logs in code
The same filter in viem, ethers and plain JSON-RPC, and the Solidity that emits it. The address is Morpho Blue, a contract we list that emits it.
import { createPublicClient, http, parseAbiItem } from "viem"
import { mainnet } from "viem/chains"
const client = createPublicClient({ chain: mainnet, transport: http() })
const logs = await client.getLogs({
address: "0xbbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb",
event: parseAbiItem("event Borrow(bytes32 indexed id, address caller, address indexed onBehalf, address indexed receiver, uint256 assets, uint256 shares)"),
fromBlock: "latest",
})
for (const log of logs) console.log(log.args) // { id, caller, onBehalf, receiver, assets, shares }import { Interface, JsonRpcProvider } from "ethers"
const provider = new JsonRpcProvider(process.env.RPC_URL)
const iface = new Interface(["event Borrow(bytes32 indexed id, address caller, address indexed onBehalf, address indexed receiver, uint256 assets, uint256 shares)"])
const logs = await provider.getLogs({
address: "0xbbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb",
topics: [iface.getEvent("Borrow")!.topicHash],
})
for (const log of logs) console.log(iface.parseLog(log)?.args){
"jsonrpc": "2.0",
"id": 1,
"method": "eth_getLogs",
"params": [
{
"address": "0xbbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb",
"topics": [
"0x570954540bed6b1304a87dfe815a5eda4a648f7097a16240dcd85c9b5fd42a43"
],
"fromBlock": "latest"
}
]
}event Borrow(bytes32 indexed id, address caller, address indexed onBehalf, address indexed receiver, uint256 assets, uint256 shares);
// inside a function:
emit Borrow(id, caller, onBehalf, receiver, assets, shares);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.
- topic0keccak256("Borrow(bytes32,address,address,address,uint256,uint256)")0x570954540bed6b1304a87dfe815a5eda4a648f7097a16240dcd85c9b5fd42a43
- topic1id0xabababababababababababababababababababababababababababababababab
- topic2onBehalf0x0000000000000000000000003333333333333333333333333333333333333333
- topic3receiver0x0000000000000000000000004444444444444444444444444444444444444444
- data0x000000000000000000000000222222222222222222222222222222222222222200000000000000000000000000000000000000000000000000000000000013880000000000000000000000000000000000000000000000000000000000001770
- idbytes32 · indexed0xabababababababababababababababababababababababababababababababab
- calleraddress0x2222222222222222222222222222222222222222
- onBehalfaddress · indexed0x3333333333333333333333333333333333333333
- receiveraddress · indexed0x4444444444444444444444444444444444444444
- assetsuint2565000
- sharesuint2566000
Frequently asked questions
What is the topic0 of the Borrow (Morpho Blue) event?
0x570954540bed6b1304a87dfe815a5eda4a648f7097a16240dcd85c9b5fd42a43: the keccak-256 hash of Borrow(bytes32,address,address,address,uint256,uint256).
Which Borrow (Morpho Blue) arguments are indexed?
id, onBehalf, receiver are indexed and sit in the log's topics; caller, assets, shares are in the data.
How do I get an alert when a contract emits Borrow (Morpho Blue)?
Open one of the ready-made rules on this page, or add any contract and pick Borrow (Morpho Blue) 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.
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.