Questions tagged [transferfrom]
The transferfrom tag has no usage guidance.
100 questions
0
votes
1
answer
46
views
what is the way to find out if a selected token will revert at 0 transfer
How can I find out if the selected token will revert to 0 transfer? Is there a list of tokens that revert at 0 transfer. As far as I understand USDC is one of them, is that correct ? Thanks in advance!...
0
votes
2
answers
58
views
Unexpected returns when using permit and transferFrom
I have two contracts written in solidity, the first one is permitOnly.sol. Which behaves as expected and successfully increases allowance after execution.
// SPDX-License-Identifier: MIT
pragma ...
0
votes
0
answers
18
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
54
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,
...
0
votes
1
answer
76
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-...
0
votes
1
answer
306
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
33
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
102
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
16
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
48
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
19
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
54
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 ...
1
vote
2
answers
194
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
459
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
110
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
86
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
1
answer
97
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
66
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
1k
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
2
answers
520
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 &...
2
votes
1
answer
47
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 ...
1
vote
1
answer
202
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, ...
0
votes
1
answer
1k
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
224
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
595
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
162
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
1
answer
328
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
3
answers
216
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
369
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 ...
0
votes
1
answer
589
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 ...
0
votes
2
answers
55
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 ...
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
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
215
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
0
votes
1
answer
145
views
"insuffiecient allowance" running my unit test
I'm developing in remix a lottery SC. I have a problem when I run buyTicket() function. On remix I fix it giving approve to SC address from erc20 function, but I don't know how to do it when I run my ...
1
vote
2
answers
1k
views
Attack on ERC-777 smart contract and UniswapV2Pair resulting in 104 ETH liquidity drain
My ERC-777 smart contract (Schnoodle, symbol SNOOD) was attacked yesterday resulting in the entire liquidity in the UniswapV2Pair token being drained (104 ETH). The attack was by way of an attacker ...
0
votes
1
answer
298
views
Trouble transferring erc20 tokens using a contract
I have this section of code in a contract of mine:
erc20.transferFrom(msg.sender, vault, cost);
When testing that my contract sends the erc20 tokens, I get this error:
Error: Transaction reverted: ...
1
vote
1
answer
73
views
Cryptozombies transferFrom function
What happens if function transferFrom is called by owner of _tokenId but with different _from parameter than msg.sender?
require() is not checking that msg.sender is equal to _from so I can pass any ...
0
votes
1
answer
34
views
Why this transaction succeeded to transfer more than its balance?
On BSC chain, this transaction is minting an NFT(MstToken). The evm trace shows it called MstToken.transferFrom(fromUser, ..., 0x30927f74c9de0000) to send out 0x30927f74c9de0000 token and it succeeded,...
0
votes
2
answers
766
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() ...
6
votes
1
answer
452
views
Why ERC721 does not have direct transfer function?
I was researching the ERC721 standard on Openzeppelin and I have noticed that there is not public or external "transfer" function.
I see internal "_transfer" function, that is ...
0
votes
0
answers
171
views
ERC20 "transferFrom" not transferring balance/token to contract address
I am trying to make a DEX and facing an issue in swapping. I created two contracts. One is Token (of ERC20 type) and other is Exchange. Here is my Token contract.
contract Token is ERC20 {
address ...
2
votes
1
answer
6k
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
1
answer
30
views
Transfer ERC20 tokens
I try to implement functionality of burning ERC20 token.Transaction is failed during calling "transferFrom" function. Who knows what's the problem? I guess there is an error in allowance.
...
0
votes
0
answers
51
views
Transfer condition modification
I am trying to add a condition that when the token is sold, change the fees to 7, in case it is a purchase, leave it at 1. Would the code shown be correct? In any case, what would be the best practice?...
3
votes
3
answers
28k
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);...
2
votes
1
answer
2k
views
How to approve() a ERC721 token to an unknown address which buys the token at some later point?
I am building an NFT marketplace where the user actions are as follows.
Address A uploads an image to create an NFT. This action calls smart contract functions createToken() to create ERC721 token ...
0
votes
0
answers
250
views
Do I need to use the approve function to transfer erc20 tokens from one address to another?
I'm making an nft marketplace and I want the buyers to buy the nfts with WETH.
function createMarketSale(address nftContract, uint256 itemId)
public
nonReentrant
{
...