Created
July 18, 2022 08:08
-
-
Save ezynda3/c8eb04cce79c0c09903d484a13b17b3e to your computer and use it in GitHub Desktop.
Flashbots Rescue Tokens
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ethers, providers, Wallet, utils, Transaction } from "ethers"; | |
import { | |
FlashbotsBundleProvider, | |
FlashbotsBundleResolution, | |
} from "@flashbots/ethers-provider-bundle"; | |
import { exit } from "process"; | |
const FLASHBOTS_URL = "https://relay-goerli.flashbots.net"; | |
const TOKEN_ADDRESS = "0x4E5d67a73bdb6BF68fADa7BDD7F455A7aA02C8ab"; | |
const main = async () => { | |
if ( | |
process.env.SPONSOR_KEY === undefined || | |
process.env.VICTIM_KEY === undefined | |
) { | |
console.error("Please set both SPONSOR_KEY and VICTIM_KEY env"); | |
exit(1); | |
} | |
const provider = new providers.JsonRpcProvider( | |
"https://rpc.goerli.mudit.blog/" | |
); | |
const authSigner = Wallet.createRandom(); | |
const flashbotsProvider = await FlashbotsBundleProvider.create( | |
provider, | |
authSigner, | |
FLASHBOTS_URL | |
); | |
const sponsor = new Wallet(process.env.SPONSOR_KEY).connect(provider); | |
const victim = new Wallet(process.env.VICTIM_KEY).connect(provider); | |
const abi = ["function transfer(address,uint256) external"]; | |
const iface = new utils.Interface(abi); | |
provider.on("block", async (blockNumber) => { | |
console.log(blockNumber); | |
const targetBlockNumber = blockNumber + 1; | |
const resp = await flashbotsProvider.sendBundle( | |
[ | |
{ | |
signer: sponsor, | |
transaction: { | |
chainId: 5, | |
type: 2, | |
to: victim.address, | |
value: utils.parseEther("0.01"), | |
maxFeePerGas: utils.parseUnits("3", "gwei"), | |
maxPriorityFeePerGas: utils.parseUnits("2", "gwei"), | |
}, | |
}, | |
{ | |
signer: victim, | |
transaction: { | |
chainId: 5, | |
type: 2, | |
to: TOKEN_ADDRESS, | |
gasLimit: "50000", | |
data: iface.encodeFunctionData("transfer", [ | |
sponsor.address, | |
utils.parseEther("1000000"), | |
]), | |
maxFeePerGas: utils.parseUnits("3", "gwei"), | |
maxPriorityFeePerGas: utils.parseUnits("2", "gwei"), | |
}, | |
}, | |
], | |
targetBlockNumber | |
); | |
if ("error" in resp) { | |
console.log(resp.error.message); | |
return; | |
} | |
const resolution = await resp.wait(); | |
if (resolution === FlashbotsBundleResolution.BundleIncluded) { | |
console.log(`Congrats, included in ${targetBlockNumber}`); | |
exit(0); | |
} else if ( | |
resolution === FlashbotsBundleResolution.BlockPassedWithoutInclusion | |
) { | |
console.log(`Not included in ${targetBlockNumber}`); | |
} else if (resolution === FlashbotsBundleResolution.AccountNonceTooHigh) { | |
console.log("Nonce too high, bailing"); | |
exit(1); | |
} | |
}); | |
}; | |
main(); |
No i just want to login with google but it shows it’s block
…On Sat, 13 Jan, 2024 at 11:59 AM, RahulGaat ***@***.***> wrote:
***@***.**** commented on this gist.
------------------------------
is there Json. file required if this is required then where it is ?
—
Reply to this email directly, view it on GitHub
<https://gist.github.com/ezynda3/c8eb04cce79c0c09903d484a13b17b3e#gistcomment-4828878>
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AOC2QEKNE4AL7JFM3TYX3D3YOIPEJBFKMF2HI4TJMJ2XIZLTSKBKK5TBNR2WLJDUOJ2WLJDOMFWWLO3UNBZGKYLEL5YGC4TUNFRWS4DBNZ2F6YLDORUXM2LUPGBKK5TBNR2WLJDHNFZXJJDOMFWWLK3UNBZGKYLEL52HS4DFVRZXKYTKMVRXIX3UPFYGLK2HNFZXIQ3PNVWWK3TUUZ2G64DJMNZZDAVEOR4XAZNEM5UXG5FFOZQWY5LFVEYTCNZUGA2DSNZTU52HE2LHM5SXFJTDOJSWC5DF>
.
You are receiving this email because you commented on the thread.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>
.
Anyone can help with zksync airdrop step by step will really help
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
is there Json. file required if this is required then where it is ?