Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from pooltogether/upkeep_multiple_performs_per_…
…block Upkeep multiple performs per block
- Loading branch information
Showing
8 changed files
with
449 additions
and
46 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
Large diffs are not rendered by default.
Oops, something went wrong.
66 changes: 66 additions & 0 deletions
66
deployments/rinkeby/solcInputs/38d7677229f35bcf169409114f3634a1.json
Large diffs are not rendered by default.
Oops, something went wrong.
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,66 @@ | ||
const chalk = require('chalk'); | ||
const hardhat = require('hardhat') | ||
|
||
|
||
function dim() { | ||
console.log(chalk.dim.call(chalk, ...arguments)) | ||
} | ||
|
||
function green() { | ||
console.log(chalk.green.call(chalk, ...arguments)) | ||
} | ||
|
||
async function fireTwoTransactions(){ | ||
dim("running fireTwoTransactions") | ||
|
||
const {ethers } = hardhat | ||
|
||
const signer = await hardhat.ethers.getNamedSigner("deployer") | ||
|
||
dim("signer address is", signer._address) | ||
|
||
const prizeStrategyUpkeep = await ethers.getContract("PrizeStrategyUpkeep", signer) | ||
const { upkeepNeeded, performData } = await prizeStrategyUpkeep.checkUpkeep([]) | ||
|
||
dim("prize strategy at ", prizeStrategyUpkeep.address) | ||
|
||
if(upkeepNeeded){ | ||
// fire first performUpkeep() | ||
dim(`Sending performUpkeep 1`) | ||
const unsignedTx1 = await prizeStrategyUpkeep.populateTransaction.performUpkeep([]) | ||
const gasLimit1 = ((await prizeStrategyUpkeep.estimateGas.performUpkeep([])).toNumber() * 2) | ||
const gasPrice1 = ((await prizeStrategyUpkeep.gasPrice1.performUpkeep([])).toNumber()) | ||
console.log(`performUpkeep(). Gas limit: ${gasLimit1.toString()}`) | ||
await relayer.sendTransaction({ | ||
to: unsignedTx1.to, | ||
data: unsignedTx1.data, | ||
gasLimit1, | ||
gasPrice1 | ||
}) | ||
|
||
dim(`Sending performUpkeep 2`) | ||
const unsignedTx = await prizeStrategyUpkeep.populateTransaction.performUpkeep([]) | ||
const gasLimit = ((await prizeStrategyUpkeep.estimateGas.performUpkeep([])).toNumber() * 2) | ||
const gasPrice = ((await prizeStrategyUpkeep.gasPrice.performUpkeep([])).toNumber() * 2) // double the gasPrice vs first tx | ||
console.log(`performUpkeep(). Gas limit: ${gasLimit.toString()}`) | ||
await relayer.sendTransaction({ | ||
to: unsignedTx.to, | ||
data: unsignedTx.data, | ||
gasLimit, | ||
gasPrice | ||
}) | ||
|
||
} | ||
|
||
} | ||
|
||
|
||
|
||
|
||
async function run(){ | ||
while(true){ | ||
await fireTwoTransactions() | ||
} | ||
} | ||
|
||
run() |
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