Skip to content

Instantly share code, notes, and snippets.

@zengzengzenghuy
Last active October 31, 2023 03:00
Show Gist options
  • Save zengzengzenghuy/7991f498164e9908451be9114b881734 to your computer and use it in GitHub Desktop.
Save zengzengzenghuy/7991f498164e9908451be9114b881734 to your computer and use it in GitHub Desktop.
//
// _ _____ ______ _____ _
// /\ (_) | __ \| ____| __ \| |
// / \ __ ___ ___ _ __ ___ | |__) | |__ | |__) | |
// / /\ \ \ \/ / |/ _ \| '_ ` _ \| _ /| __| | ___/| |
// / ____ \ > <| | (_) | | | | | | | \ \| |____| | | |____
// /_/ \_\/_/\_\_|\___/|_| |_| |_|_| \_\______|_| |______|
//
//
// https://goerli.etherscan.io/tx/0xa1f3c607373b1159febd6cfab01cbe62898edd697b42df91749cc6c6fcb384e3#eventlog
// eventSchema = keccak(Transfer(address,address,uin256))
let receipt = getReceipt(txBlockNumber, txIdx);
const eventSchema ="0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
// // Transfer (index_topic_1 address from, index_topic_2 address to, uint256 amount)
// // The first two fields of the log are stored in topics because they are indexed
// // The first element in the topic array is the event signature
// // The second element in the topic array is the "index_topic_1 address from" value
// // The only bytes stored in the "data" of the log correspond to "uint256 amount"
let logAddr = receipt.log(0).address();
let transferAmount = receipt.log(0).data(0);
let fromAddr = receipt.log(0).topic(1, eventSchema);
let toAddr = receipt.log(0).topic(2,eventSchema)
isEqual(toAddr.toCircuitValue(),bridgeAddress)
isEqual(logAddr.toCircuitValue(),tokenAddress)
isEqual(transferAmount.toCircuitValue(),amount)
addToCallback(fromAddr)
addToCallback(logAddr)
addToCallback(transferAmount)
addToCallback(toAddr)
{
"txBlockNumber": 9942901,
"txIdx": 6,
"bridgeAddress": "0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984",
"tokenAddress": "0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984",
"amount": 100000000000
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment