Skip to content

Instantly share code, notes, and snippets.

@chuckbergeron
Created September 14, 2023 23:35
Show Gist options
  • Save chuckbergeron/a773c579a0e7f2bd498497859591117b to your computer and use it in GitHub Desktop.
Save chuckbergeron/a773c579a0e7f2bd498497859591117b to your computer and use it in GitHub Desktop.
PoolTogether v5 Hyperstructure - Draw Auction Bot, Send Transaction
const sendTransaction = async (
relayer: Relayer,
auctionContracts: AuctionContracts,
context: DrawAuctionContext,
) => {
let populatedTx: PopulatedTransaction;
if (context.drawAuctionState === DrawAuctionState.RngStartVrfHelper) {
const chainlinkRngAuctionHelper = auctionContracts.chainlinkVRFV2DirectRngAuctionHelperContract;
populatedTx = await chainlinkRngAuctionHelper.populateTransaction.transferFeeAndStartRngRequest(
REWARD_RECIPIENT,
);
} else {
populatedTx =
await auctionContracts.rngAuctionRelayerRemoteOwnerContract.populateTransaction.relay(
ERC_5164_MESSAGE_DISPATCHER_ADDRESS[RNG_CHAIN_ID],
RELAY_CHAIN_ID,
auctionContracts.remoteOwnerContract.address,
auctionContracts.rngRelayAuctionContract.address,
REWARD_RECIPIENT,
);
}
const tx = await relayer.sendTransaction({
data: populatedTx.data,
to: populatedTx.to,
gasLimit: 8000000,
});
console.log('Transaction hash:', tx.hash);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment