Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return async () => {
logUtils.log(`Processing ETH ${recipientAddress}`);
const userBalance = await web3Wrapper.getBalanceInWeiAsync(recipientAddress);
const maxAmountInWei = Web3Wrapper.toWei(new BigNumber(DISPENSE_MAX_AMOUNT_ETHER));
if (userBalance.isGreaterThanOrEqualTo(maxAmountInWei)) {
logUtils.log(
`User exceeded ETH balance maximum (${maxAmountInWei}) ${recipientAddress} ${userBalance} `,
);
return;
}
const txHash = await web3Wrapper.sendTransactionAsync({
from: configs.DISPENSER_ADDRESS,
to: recipientAddress,
value: Web3Wrapper.toWei(new BigNumber(DISPENSE_AMOUNT_ETHER)),
});
logUtils.log(`Sent ${DISPENSE_AMOUNT_ETHER} ETH to ${recipientAddress} tx: ${txHash}`);
};
},
return async () => {
logUtils.log(`Processing ETH ${recipientAddress}`);
const userBalance = await web3Wrapper.getBalanceInWeiAsync(recipientAddress);
const maxAmountInWei = Web3Wrapper.toWei(new BigNumber(DISPENSE_MAX_AMOUNT_ETHER));
if (userBalance.isGreaterThanOrEqualTo(maxAmountInWei)) {
logUtils.log(
`User exceeded ETH balance maximum (${maxAmountInWei}) ${recipientAddress} ${userBalance} `,
);
return;
}
const txHash = await web3Wrapper.sendTransactionAsync({
from: configs.DISPENSER_ADDRESS,
to: recipientAddress,
value: Web3Wrapper.toWei(new BigNumber(DISPENSE_AMOUNT_ETHER)),
});
logUtils.log(`Sent ${DISPENSE_AMOUNT_ETHER} ETH to ${recipientAddress} tx: ${txHash}`);
};
},