forked from bnb-chain/bsc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: waiting for the last simulation before pick best bid
- Loading branch information
Showing
46 changed files
with
859 additions
and
389 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { ethers } from "ethers"; | ||
import program from "commander"; | ||
|
||
// depends on ethjs v6.11.0+ for 4844, https://github.com/ethers-io/ethers.js/releases/tag/v6.11.0 | ||
// BSC testnet enabled 4844 on block: 39539137 | ||
// Usage: | ||
// nvm use 20 | ||
// node check_blobtx.js --rpc https://data-seed-prebsc-1-s1.binance.org:8545 --startNum 39539137 | ||
// node check_blobtx.js --rpc https://data-seed-prebsc-1-s1.binance.org:8545 --startNum 39539137 --endNum 40345994 | ||
program.option("--rpc <Rpc>", "Rpc Server URL"); | ||
program.option("--startNum <Num>", "start block", 0); | ||
program.option("--endNum <Num>", "end block", 0); | ||
program.parse(process.argv); | ||
|
||
const provider = new ethers.JsonRpcProvider(program.rpc); | ||
const main = async () => { | ||
var startBlock = parseInt(program.startNum) | ||
var endBlock = parseInt(program.endNum) | ||
if (isNaN(endBlock) || isNaN(startBlock) || startBlock == 0) { | ||
console.error("invalid input, --startNum", program.startNum, "--end", program.endNum) | ||
return | ||
} | ||
// if --endNum is not specified, set it to the latest block number. | ||
if (endBlock == 0) { | ||
endBlock = await provider.getBlockNumber(); | ||
} | ||
if (startBlock > endBlock) { | ||
console.error("invalid input, startBlock:",startBlock, " endBlock:", endBlock); | ||
return | ||
} | ||
|
||
for (let i = startBlock; i <= endBlock; i++) { | ||
let blockData = await provider.getBlock(i); | ||
console.log("startBlock:",startBlock, "endBlock:", endBlock, "curBlock", i, "blobGasUsed", blockData.blobGasUsed); | ||
if (blockData.blobGasUsed == 0) { | ||
continue | ||
} | ||
for (let txIndex = 0; txIndex<= blockData.transactions.length - 1; txIndex++) { | ||
let txHash = blockData.transactions[txIndex] | ||
let txData = await provider.getTransaction(txHash); | ||
if (txData.type == 3) { | ||
console.log("BlobTx in block:",i, " txIndex:", txIndex, " txHash:", txHash); | ||
} | ||
} | ||
} | ||
}; | ||
main().then(() => process.exit(0)) | ||
.catch((error) => { | ||
console.error(error); | ||
process.exit(1); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { ethers } from "ethers"; | ||
import program from "commander"; | ||
|
||
// Usage: | ||
// node faucet_request.js --rpc localhost:8545 --startNum 39539137 | ||
// node faucet_request.js --rpc localhost:8545 --startNum 39539137 --endNum 40345994 | ||
|
||
// node faucet_request.js --rpc https://data-seed-prebsc-1-s1.bnbchain.org:8545 --startNum 39539137 --endNum 40345994 | ||
program.option("--rpc <Rpc>", "Rpc Server URL"); | ||
program.option("--startNum <Num>", "start block", 0); | ||
program.option("--endNum <Num>", "end block", 0); | ||
program.parse(process.argv); | ||
|
||
const provider = new ethers.JsonRpcProvider(program.rpc); | ||
const main = async () => { | ||
var startBlock = parseInt(program.startNum) | ||
var endBlock = parseInt(program.endNum) | ||
if (isNaN(endBlock) || isNaN(startBlock) || startBlock == 0) { | ||
console.error("invalid input, --startNum", program.startNum, "--end", program.endNum) | ||
return | ||
} | ||
// if --endNum is not specified, set it to the latest block number. | ||
if (endBlock == 0) { | ||
endBlock = await provider.getBlockNumber(); | ||
} | ||
if (startBlock > endBlock) { | ||
console.error("invalid input, startBlock:",startBlock, " endBlock:", endBlock); | ||
return | ||
} | ||
|
||
let startBalance = await provider.getBalance("0xaa25Aa7a19f9c426E07dee59b12f944f4d9f1DD3", startBlock) | ||
let endBalance = await provider.getBalance("0xaa25Aa7a19f9c426E07dee59b12f944f4d9f1DD3", endBlock) | ||
const faucetAmount = BigInt(0.3 * 10**18); // Convert 0.3 ether to wei as a BigInt | ||
const numFaucetRequest = (startBalance - endBalance) / faucetAmount; | ||
|
||
// Convert BigInt to ether | ||
const startBalanceEth = Number(startBalance) / 10**18; | ||
const endBalanceEth = Number(endBalance) / 10**18; | ||
|
||
console.log(`Start Balance: ${startBalanceEth} ETH`); | ||
console.log(`End Balance: ${endBalanceEth} ETH`); | ||
|
||
console.log("successful faucet request: ",numFaucetRequest); | ||
}; | ||
main().then(() => process.exit(0)) | ||
.catch((error) => { | ||
console.error(error); | ||
process.exit(1); | ||
}); |
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
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
Oops, something went wrong.