All Questions
Tagged with transferfrom transfer
22 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
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
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
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 ...
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 ...
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 &...
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
3
answers
217
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....
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 ...
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
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?...
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
{
...
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
94
views
ERC20 Token Transfer Issue
I have a test token (ERC20) deployd on ETH test network (Kovan)
The token was deployed using Unicrypt tool
So far everything ok, but the issues is how can i transfer tokens from an outside smart ...
0
votes
2
answers
1k
views
Is there a reason why the ERC20/ERC721 `safeTransferFrom` requires a `from` address? Why not just `safeTransferTo` directly?
I can understand that the from address in the safeTransferFrom function could be used by an approved operator. But I also wonder why not have another function for actual owners called just ...
0
votes
1
answer
759
views
ERC721 TransferFrom problem - How can the buyer calls Transfer from function in order to buy a ERC-721 token?
Recently I am working on a NFT marketplace and I had difficulties in implementing safeTransferFrom function. At this stage I use _transfer function to allow the buyer calling the function directly so ...
1
vote
0
answers
271
views
Transferring ERC20 token to a contract using custom function
I have a couple of questions related to transferring ERC20 token to a contract.
I am developing a protocol that has its own token to provide incentive mechanisms. For certain operations I need to lock ...
2
votes
1
answer
2k
views
How to approve user to spend all my ERC20 tokens?
In ERC20 we approve a user to spend our token and then they can spend as much allowed using transferFrom, but if the allowance limit exceed then I have to approve again, is there any way to allow them ...
1
vote
1
answer
252
views
Request a transaction amount in a function
I'm trying to have a function generate a request such that it pops up a Metamask request.
I know I can do:
require(msg.value == amount);
to require the function call has a certain value.
But this ...
0
votes
1
answer
201
views
Gets reverted when calling ERC20.transfer in a contract, not reverted when transferring 0
I have this code inside a contract
interface ERC20 {
//standard variables
function allowance(address _owner, address _spender) constant returns (uint remaining);
function approve(address ...