I'm trying to swap tokens using Uniswap v2 interface. The code of the contract is here.
I'm able to deposit Eth to the contract and but I'm not able to invoke the swapEthForTokenWithUniswap()
successfully through javascript.
const swap = async() => {
const res = await defitry.methods.swapEthForTokenWithUniswap(web3.utils.toWei('0.1', 'ether'))
.send({from:acc.address,
gas: 100000})
console.log(res)
}
The transaction keeps reverting but i can call the function and swap using the writeContract tab on etherscan. I keep getting Object.TransactionRevertedWithoutReasonError