Last active
September 7, 2023 22:09
-
-
Save chuckbergeron/be57b831dadfd922411090d296d434d7 to your computer and use it in GitHub Desktop.
PoolTogether v5 Hyperstructure - Prize Claiming Bot, Executing claimPrizes Transaction
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
const executeTransaction = async (claimPrizesParams, claimerContract: Contract) => { | |
// It's profitable if there is at least 1 claim to claim | |
if (claimPrizesParams.winners.length > 0) { | |
const populatedTx = await claimerContract.populateTransaction.claimPrizes( | |
...Object.values(claimPrizesParams), | |
); | |
const tx = await relayer.sendTransaction({ | |
data: populatedTx.data, | |
to: populatedTx.to, | |
gasLimit: 8000000, | |
}); | |
console.log('Transaction hash:', tx.hash); | |
} else { | |
console.log(`Not profitable to claim Draw #${context.drawId}, Tier Index: #${tier}`); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment