CryptoFly.us | CRYPTOCURRENCY BITCOIN SHIRTS CLOTHING APPAREL HATS

CRYPTO NEWS

I am trying to addLiquidity on Uniswap v2 but I am getting error Reason provided by the contract: "TransferHelper: TRANSFER_FROM_FAILED"

 function addLiquidity(     address tokenA,     address tokenB,     uint amountADesired,     uint amountBDesired,     uint amountAMin,     uint amountBMin,     address to,     uint deadline ) external virtual override ensure(deadline) returns (uint amountA, uint amountB, uint liquidity) {     (amountA, amountB) = _addLiquidity(tokenA, tokenB, amountADesired, amountBDesired, amountAMin, amountBMin);     address pair = UniswapV2Library.pairFor(factory, tokenA, tokenB);     TransferHelper.safeTransferFrom(tokenA, msg.sender, pair, amountA);     TransferHelper.safeTransferFrom(tokenB, msg.sender, pair, amountB);     liquidity = IUniswapV2Pair(pair).mint(to); } 
  • I have minted 2 ERC Token say Token1 & Token2 and also approved the address of deployed Router v2 contract from Token contracts.
  • Also generated the INIT_CODE_HASH in the factory contract and added to the hash value by removing 0X.
  • While trying to transact addLiquidity function I am getting an error "TransferHelper: TRANSFER_FROM_FAILED".

I have used the deployed code of Router & Factory contracts from ether scan. I am unable to point out the issue any help will be appreciated.

Thanks in Advance

Looping over scheduling ETH transaction

I have used Aion smart contracts to facilitate scheduling a ETH transaction. It works fine, but when it comes to making those transactions periodically (Scheduling multiple transactions), it throws an error. What I am trying to say is that I have made one specific function that is responsible for taking two arguments ( nonce =::Listen

I have used Aion smart contracts to facilitate scheduling a ETH transaction. It works fine, but when it comes to making those transactions periodically (Scheduling multiple transactions), it throws an error.

What I am trying to say is that I have made one specific function that is responsible for taking two arguments ( nonce = number of payments, period = duration between payments ) beside my main scheduleTransaction() which is responsible for a single transaction scheduling, and I want to set up a group of automatic ETH transactions based on these characteristics. I’m going to attach my code. my loop seems fine, but it gives an error.

I would be thankful if anyone gives me a suggestion why whenever I try to execute scheduleMultipleTransaction(), it throws an error?

enter image description here

function scheduleTransaction(uint256 _fromNow) public {     aion = AionContract(0x2fC197cD7897f41957F72e8E390d5a7cF2858CBF);     uint256 callCost = 10e16 + 800000*100e9 + aion.serviceFee();     aion.ScheduleCall.value(callCost)( block.timestamp + _fromNow, Reciever, 10e16, 800000, 100e9, hex"00", true); }   function scheduleMultipleTransactions(uint _period, uint _nonce) public {     for(uint i=0; i<=_period*(_nonce-1); i+_period) {         scheduleTransaction(i);     } }  function () public payable {} 

Lastly, I have to add that i had provided enough ETH to the contract prior to execution of these functions

I am trying to addLiquidity on Uniswap v2 but I am getting error Reason provided by the contract: "TransferHelper: TRANSFER_FROM_FAILED"

Shopping cart
There are no products in the cart!
Continue shopping
0