Created
September 14, 2023 23:35
-
-
Save chuckbergeron/a773c579a0e7f2bd498497859591117b to your computer and use it in GitHub Desktop.
PoolTogether v5 Hyperstructure - Draw Auction Bot, Send 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 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