Skip to content

Instantly share code, notes, and snippets.

@chuckbergeron
Last active September 7, 2023 22:09
Show Gist options
  • Save chuckbergeron/be57b831dadfd922411090d296d434d7 to your computer and use it in GitHub Desktop.
Save chuckbergeron/be57b831dadfd922411090d296d434d7 to your computer and use it in GitHub Desktop.
PoolTogether v5 Hyperstructure - Prize Claiming Bot, Executing claimPrizes Transaction
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