Helpers
Since Tenderly misses on traces with
block.coinbase
use https://tx.eth.samczsun.com/polygon/0x98798a8820fa01927c655a4223fd0f3821f7b013982e6d0d844c609237e2ef62 and click the little [call] to see the Output data and revert reason.
Nodejs
const { ethers } = require('ethers');
const ALCHEMY_KEY = "alchemy-apikey";
const provider = new ethers.providers.AlchemyProvider("matic",ALCHEMY_KEY);
const getAuthor = async(blockNum) => {
const response = await fetch(`https://polygon-mainnet.g.alchemy.com/v2/${ALCHEMY_KEY}`, {
method: 'POST',
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
"id": 1,
"jsonrpc": "2.0",
"method": "bor_getAuthor",
"params": [
'0x'+blockNum.toString(16)
]
}),
});
const json = await response.json();
return json.result;
}
let waitBlock = 0;
provider.on('block', async(block) => {
try {
console.log(block);
if (block < waitBlock) return;
const author = await getAuthor(block);
console.log(author);
const validators = [
'0x127685D6dD6683085Da4B6a041eFcef1681E5C9C',
'0x02f70172f7f490653665c9bfac0666147c8af1f5',
'0xd2e4bE547B21E99A668f81EEcF0298471A19808f',
'0xb9EDE6f94D192073D8eaF85f8db677133d483249',
'0x9eaD03F7136Fc6b4bDb0780B00a1c14aE5A8B6d0',
].map(x => x.toLowerCase());
if (author && validators.includes(author.toLowerCase())) {
console.log('Validator active');
// You should be able to submit bundles for a while
await tryToSubmitBundlesForAFewBlocks();
console.log('Closing');
process.exit(0);
} else {
waitBlock = block + 10; // wait 10 more blocks
}
} catch (err) {
console.error(err);
}
});
List of validators active found in discord for now in #validators-list
Substitutes a minimal Searcher Contract to receive a fastLaneCall and simply give back the
_bidAmount
to be sure the relay is repaid.The FastlaneAuction handler will call this contract
fastLaneCall
if this contract address is submitted in the bundle as the searcherTx.//SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.16;
// Example Contract that sends back _bidAmount to msg.sender
// It ignores _sender and _searcherCallData
// Used for testing purposes
contract SearcherHelperRepayerEcho {
function fastLaneCall(
address _sender,
uint256 _bidAmount,
bytes calldata _searcherCallData
) external payable returns (bool, bytes memory) {
bool success;
address to = msg.sender;
assembly {
// Transfer the ETH and store if it succeeded or not.
success := call(gas(), to, _bidAmount, 0, 0, 0, 0)
}
require(success, "ETH_TRANSFER_FAILED");
return (true,bytes("ok"));
}
}
Last modified 8mo ago