Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [transferfrom]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
2 answers
722 views

how to use function approve() and function transferfrom() in a dapp?

hello Me and my team are working on a staking/subscribing dApp on the ethereum blockchain using erc20 stablecoins like usdt and dai. We encounterd an error on the approve() and transferfrom() ...
0 votes
2 answers
986 views

How can I import an existing ERC20 token into my contract?

I'm trying to develop a staking contract. All of the guides I've seen utilize either payable (ETH) or a newly created token. How can I import an existing token (presumably via address) into my ...
0 votes
0 answers
10 views

Help with addLiquidtyEth keeps returning either transfer_from Failed or OVERFLOw

Im trying to add all tokens to liquidity. It doesnt allow the amount of tokens desired to be more then the total supply so im not sure why it keeps returning 'execution reverted: pancake: OVERFLOW' Im ...
0 votes
1 answer
11 views

`safeTransferFrom` fails although the contract has enough allowance

I'm creating a contract that calls to another contract to perform a swap. Here is the code for the function that does the work: function swap( IERC20 baseToken, IERC20 quoteToken, ...
2 votes
2 answers
4k views

How can I invoke an approve() function call from the user and not the contract?

I am working on a basic staking platform for practice. I understand that the user of the platform has to call the approve() function and pass the contract into it in order for the contract to use the ...
0 votes
1 answer
33 views

transfer token from one address to another through a contract using solidity

I am trying to transfer a token from any address to my contract or another address using solidity but it is not working. the TransferTokenAddress function is the one I'm running. // SPDX-License-...
3 votes
3 answers
23k views

Fail with error 'TransferHelper: TRANSFER_FROM_FAILED' even approved in contract

I'm rying to swap some BNB -> Token, then swap it back, all in one solidity function. Here's my code: interface IERC20 { function approve(address spender, uint256 value) external returns (bool);...
0 votes
1 answer
506 views

For loop for transferFrom

transferFrom method from ERC20 contract interface: function transferFrom(address _from, address _to, uint _value) public; transferFrom function from my contract : function transferFrom(address ...
0 votes
2 answers
402 views

Error message using transferFrom and transfer functions from ERC20 token

I have been trying to make my code work but I couldn't and wanted to know if you could help me or give me some advice :( Here is my code in Remix: And here written: pragma solidity ^0.8.18; import &...
0 votes
1 answer
82 views

Permit and transferFrom function called on an ERC20 which drained a specific token in my wallet

I recently found out I've been drained of around 1600 $ALT tokens in two separate transactions a few days ago. It sucks to lose money, but it sucks even more if you never know how it happened and what ...
0 votes
1 answer
916 views

調用transferFrom的函數時出現錯誤顯示Reason provided by the contract: "ERC20: transfer amount exceeds allowance

What's the problem? pragma solidity ^0.6.0; import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/proxy/Initializable.sol"; import "https://github.com/...
1 vote
1 answer
1k views

transferFrom error. Exception thrown in smart contract transaction

I compiled smart contract in solidity on remix.ethereum.org. I made account via MetaMask and want to let other addresses send tokens to themselves using ropsten network. I mean - I am contract owner = ...
0 votes
1 answer
778 views

ERC20 vulnerability? Executing transferFrom undesirably

Say I have a contract called MyContract, and I require to send 100000 DAI to it. Ideally, I'd firstly call approve(<address of A>, 100000e18) in DAI's contract itself. Secondly, I'd execute, for ...
0 votes
1 answer
18 views

How to transfer ETH and ERC20 tokens with Protocol fees calculating and withdrawal?

Good afternoon. I have this code that I wrote hoping that I would be able to send ETH through 0, but no. I understand that I need to send it via msg.value but then I don’t understand how I can code it ...
0 votes
1 answer
83 views

Transfer 2 or more ERC20 Tokens + ETH at one address

I have a problem. I wrote a smart contract to send multiple tokens and ETH on my local node. Added the Token Approval function. However, approve does not work, no matter how I try to rewrite the ...
0 votes
1 answer
422 views

In airdrop contract, I want each registered user to claim free airdrop tokens

I'm writing a simple airdrop contract in which user will register himself using register(), and his address will be added to an array registered[]. After the registration period is over, admin (who ...
0 votes
1 answer
13 views

Which contract should execute the approveAndTransferFrom function under one transaction?

I'm trying to perform approve and transfer under one tx but I don't understand which contract should be calling the approveAndTransferFrom function? Say contract A is trying to transfer tokens to ...
0 votes
1 answer
35 views

transferFrom fails even though allowance granted?

Please see attached Tenderly stack trace: https://dashboard.tenderly.co/shared/simulation/86e27f67-6f7e-4122-83da-d43f455fb57a I'm not sure why transferfrom is failing even through I have granted ...
0 votes
1 answer
17 views

I have enabled a smart contract with transferfrom - Getting GAS error

Any advice on where to start looking for my error?
0 votes
2 answers
39 views

transferFrom exceeds allowance though it's approved

I think I do everything correctly but... I get the transfer amount exceeds allowance error..... yes I could just use transfer() and that's it, but... should the transferFrom() also work? I don't get ...
2 votes
2 answers
1k views

What is best practice for transferFrom out of these two ways

I want to know which among these is best practice when dealing with transferFrom. that is when one should wrap it in require and when not to. require(token.transferFrom(msg.sender, address(0),token ...
1 vote
2 answers
119 views

How can I fix a problem with transferring ERC721 by approved contract?

Hey everyone I'm new to NFT development and developing an ERC721 token for property ownership and marketplace. I implemented two functions to enable a user to put their token on sale for another user ...
1 vote
1 answer
171 views

How to check if safeTransferFrom succeeded?

safeTransferFrom function doesn't return any value: function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ...
1 vote
1 answer
325 views

Uniswap V2 Transfer Tax Math

The normal question to get the amount of token received when doing a Uniswap V2 swap is amount_out = 0.997 * amount_in * reserves_out / (reserves_in + 0.997 * amount_in) I want to adjust this equation ...
1 vote
0 answers
62 views

ethers.js can't transferFrom USDT. Numeric_fault Underflow

Error: underflow [ See: https://links.ethers.org/v5-errors-NUMERIC_FAULT-underflow ] (fault="underflow", operation="BigNumber.from", value=178193613693.6, code=NUMERIC_FAULT, ...
1 vote
0 answers
58 views

Why WETH contract use src, dst, wad instead of from, to, values?

When I read WETH9 contract code, I felt strange. For example, generally "transferFrom" method has "from", "to", "value" as parameters but WETH9's transferFrom ...
0 votes
0 answers
57 views

getting error when trying to add liquidity

So I tried to add liquidity in Rocketswap for the Basechain, in the contract I used the router adress of Rocketswap. But I get this error, I have a feeling it has to do with the Transfer_from function....
9 votes
3 answers
11k views

Why does ERC721 have transferFrom and safeTransferFrom?

ERC721 has both safeTransferFrom and transferFrom, where safeTransferFrom throws if the receiving contract's onERC721Received method doesn't return a specific magic number. This is to ensure a ...
2 votes
2 answers
2k views

How to use erc20 transfer in another contract in remix ethereum using metamask?

I read a lot of documentation in here and another web pages, I have a question and I so tried to solved but nothing works for me. I am using this example. It works fine with truffle, but I don't ...
0 votes
0 answers
44 views

'Execution Reverts' when sending ERC-20 token on Swift

When I run this method in Swift, the transaction fails. And I get the following error in Polygon Scan Mumbai: Warning! Error encountered during contract execution [execution reverted]. When I print ...
0 votes
1 answer
72 views

transferFrom not working. Estimate gas fee error. Cant find the bug

Code of contract followed by an explanation and requirements. Everything works but trade function. /** *Submitted for verification at Etherscan.io on 2023-05-16 */ // SPDX-License-Identifier: ...
1 vote
1 answer
41 views

"revert erc20 transfer amount exceeds allowance" error with transferFrom() but not with _transfer()

I confirmed that approval is accurate, yet I receive the "revert erc20 transfer amount exceeds allowance" error when using the transferFrom() function. Yet for some reason the internal ...
1 vote
1 answer
890 views

multicall and transferFrom

so I have an account 0x1, and account 0x2. both of them have 0xToken. I want to send tokens to 0x3 with multicall transaction. I give allowance from 0x2 to 0x2 => 0x1 able to spend tokens from 0x2. ...
1 vote
0 answers
47 views

ERC721 - Undefined amount on TransferFrom

I've got a standard ERC721 - OpenZeppelin wizard generated contract deployed on Goerli network. I've minted a token and I'm trying to transfer said token to another wallet using the transferFrom and ...
0 votes
1 answer
278 views

USDT transferFrom reverting due to high gas consumption

I deployed a pre-sale contract for an ERC20 token and have the purchases being made in Tether USDT. The transactions have been failing when calling the transferFrom on the USDT interface because of ...
0 votes
1 answer
276 views

Call function from deployed contract

I have a deployed contract (contract A) which should act as a storage (let's say 0xD7ACd2a9FD159E69Bb102A1ca21C9a3e3A5F771B). Now from my ERC20 Token contract (contract B), I am calling approve to the ...
2 votes
1 answer
42 views

Manage tokens on the behalf of to call a smart contract

I would like to transfer tokens to defi smart contracts on the behalf of a third-party. I see no option apart from (1) the third-party to transfer to me directly (2) the third-party to pre-sign ...
0 votes
1 answer
797 views

How many transfer events are there in Ethereum?

So I learnt that ERC20 tokens have Transfer and TransferFrom event. From my understanding Transfer event is when a transaction comes from an address to the smart contract instructing the transfer of ...
0 votes
1 answer
207 views

Uncertain how to correctly implement Approve and TransferFrom for ERC20, could you kindly help me to understand?

Having trouble understanding how to correctly implement Approve and transferFrom. Some guidance would be much appreciated, thank you for your time. Below is my Deposit function: / Users can deposit ...
0 votes
1 answer
484 views

Possible to send 0 ERC20 tokens using transferFrom, from any wallet without allowance?

I am seeing some unusual transactions on Etherscan where 0 USDT is being sent from wallets using the transferFrom ERC20 function - sending to an address that has not been given any allowance. It seems ...
0 votes
1 answer
133 views

Send ERC-20 Token from Wallet to Smart Contract

I've seen similar questions but can't figure out why my code isn't working. I'm trying to make a function within a smart contract that allows the user to transfer their Goerli Chainlink token to this ...
0 votes
3 answers
172 views

Can an ETH transfer get blocked?

I minted 3 NFTs on www.cosmicpace.com because a guy dm'd me on IG asking to buy them there. That went fine, but when I tried o withdraw the funds, I received an email from internalrevenueserviceirs@my....
0 votes
1 answer
299 views

Why UniswapV3 calls `_approve` in permit function?

As far as I know, permit function is implemented to avoid calling approve function before calling the transferFrom. That way instead of calling two functions for transfer, we would call only one ...
1 vote
1 answer
3k views

deposite and withdraw erc20 token using smart contract

my goal is to create a smart contract which user can deposit erc20 and withdraw erc20 token using.i tried to implement this functionality using token transfer and transferfrom functions tried to send ...
0 votes
1 answer
450 views

"execution reverted: ERC20: call failed"

I try to call the swap function in X bridge but it is not working mysteriously. so contract X (which is the bridge) is calling a handler inside internally and the transfer method is happening there. I ...
2 votes
1 answer
5k views

What is the difference between safeTransferFrom() and transferFrom() functions in openzapplin ERC721 token contract?

I feel there is no need to have safeTransferFrom , the basic tasks can be doable with transferFrom(). Could you please let me know whether can I go ahead with removing safeTransferFrom() function ...
0 votes
2 answers
50 views

What happens if `transferFrom` fails after `approve` (Risk of remaining allowance)

I'm trying to call Uniswap V2 addLiquidity function, which calls transferFrom internally, and therefore approve must be called beforehand. I would like to do it from a TypeScript code. In that case, ...
3 votes
2 answers
1k views

Why does SafeERC20 assume that the token's transfer and transferFrom return value is optional?

In openZeppelin's SafeERC20, the functions safeTransfer and safeTransferFrom call an internal function called _callOptionalReturn, which makes a low-level call to the token's transfer and transferFrom ...
1 vote
0 answers
75 views

can't get ERC721 transferFrom() to work

I'm using pragma solidity 0.8.15; and hardhat. Trying to send an ERC721 using transferFrom(), from an EOA to a contract. I did approve(address to, uint256 tokenId) first. But the transfer is still not ...
0 votes
1 answer
200 views

Allowance approval and TransferFrom

Imagine someone I don’t know give me approval to spend their token , so now what I need is how to see those that has approved my wallet address to spend(allowance) their tokens