Questions tagged [transfer]
The transfer tag has no usage guidance.
261
questions
14
votes
2
answers
9k
views
Using ".value(...)" is deprecated. Use "{value: ...}" instead
This works fine in Remix but when trying to work in VSCode (for compiling purposes; DApp course, trying to build .json through compile.js ) it throws the error
Using ".value(....
7
votes
2
answers
3k
views
Make an erc20 transfer with web3py
how to send an erc20 in web3py please, I have that :
tx_hash = contract.functions.transfer(destination_address, value).transact({'from': myaddress })
and I get this error :
ValueError: {'code': -32601,...
6
votes
2
answers
3k
views
Someone has "faked" transferring 0.00 ERC-20 tokens from my and many other addresses
Someone has created a tx in which my address has supposedly "transferred" 0.00 USDC tokens to another address on Polygon, along with dozens of other addresses also transferring 0.00 DAI/WETH/...
6
votes
1
answer
434
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 ...
5
votes
0
answers
936
views
What is the difference between ERC-2665 and what is proposed in EIP-2981? Royalties vs Transfer Fee
There is an EIP for Royalty standards. But there is already a ERC for a Transfer Fee
Could ERC-2665 be used to implement royalties across all market places for NFT?
What is the difference between ...
4
votes
2
answers
5k
views
Possible to transfer multiple tokens in one transaction?
Is it possible to transfer all / multiple ERC20 tokens to another wallet address in a single transaction?
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 ...
3
votes
1
answer
622
views
Why does Uniswap V2 use `_safeTransfer` to transfer tokens?
I'm looking into Uniswap V2 code and found that it uses _safeTransfer function to transfer ERC20 tokens in the Pair contract.
function _safeTransfer(address token, address to, uint value) private {...
3
votes
2
answers
2k
views
Front End: Transfer (send) your NFTs (ERC-721) using Ethers.js or Wagmi.sh
I'm a front-end dev getting my feet wet in the crypto nft space.
I built a simple site for displaying all the NFTs in your wallet. Users can connect to the page using Rainbowkit (built on top of WAGMI,...
3
votes
2
answers
3k
views
Can ERC-20 token transfers have re-entrancy?
I understand that re-entrance attack can happened when you send ETH, because of fallback() function. But in ERC20 transfer there is no call for fallback, so I wonder if there's a way to make re-...
3
votes
4
answers
460
views
Modifying erc-721 transfer
Say I want to take a cut of an NFT each time the token is transferred. If I were to change the openzeppelin erc721 transfer function to transfer 1% of the NFTs holding to myself, can that standard ...
3
votes
0
answers
568
views
Bypassing metamask notice about "Insufficient funds for gas"
I wish to make a transfer of the remaining ETH from one wallet to an other.
Trying to do it from metamask, it prevents me to do so with the "Insufficient funds for gas" error. Event though ...
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 ...
2
votes
1
answer
487
views
When would an ERC20 return false?
According to the ERC20: Token Standard:
Callers MUST handle false from returns (bool success). Callers MUST NOT assume that false is never returned!
In OpenZeppelin's ERC20 contract, running the ...
2
votes
1
answer
730
views
What are these 2 transactions with the same hash and different values?
I am browsing some erc20 transactions from a given ethereum address on the Etherscan API module account and action tokentx.
Example here :
Sometime I observe 2 consecutive identical result except ...
2
votes
3
answers
600
views
token.transferFrom() Will Not Work with ERC20 Token
I've made an ERC20 token (TaylorSwiftCoin, aka SWFT), and I'm attempting to make a very basic smart contract. I'm running this on the Dune TestNet, and I simply want this smart contract to take 100 of ...
2
votes
1
answer
837
views
Usage of transfer Instead of safeTransfer
It is recommended to use safeTransfer instead of transfer. But I do not understand if it applies to all tokens even the ones that isn't an(other) ERC20 token.
After reading more about safeERC20 my ...
2
votes
1
answer
849
views
Fetch last 10 blocks using Alchemy Transfers API
could someone please elaborate on:
fromBlock: the starting time range we want to fetch NFT mints over (defaults to latest)
I tried to pass a block but its not working... I have also seen fromBlock&...
2
votes
2
answers
2k
views
Send msg.value to another address immediately
Is it possible to implement a payable function and transfer msg.value to another address immediately?
function purchase() payable public {
//transfer msg.value
}
I'm thinking this wouldn't work ...
2
votes
1
answer
2k
views
Trying to understand Etherscan output for token swap via Uniswap
I am trying to understand a token swap transaction via Uniswap on Etherscan. Looking at the Uniswap V2: Router 2 contract for a transaction, I see the following;
My question is regarding the second ...
2
votes
1
answer
2k
views
Estimating transfer gas for ERC20 tokens using ethers js without needing the token
I am trying to be able to accurately estimate the gas it will take to send an ERC20 token using Ethers js without first needing that token. Currently, I am able to get an estimate though it does not ...
2
votes
2
answers
2k
views
Sending token with contract interaction in Remix
I'm aware of using the value field in Remix to include ETH with my function call transaction but is there a way to send another token with my transaction, for example, LINK?
Additionally I would like ...
2
votes
1
answer
50
views
What was the purpose of adding the safeTransferFrom method? What are the cases when the plain transferFrom fails silently?
I was wondering what is the case when the plain transferFrom ERC20 method fails silently, i.e., just returning false.
Looking at the code, to me it looks like when the balance is insufficient or the ...
2
votes
1
answer
115
views
call a function in the same contract
i have a contract who containt a function onTokenTransfer(address _sender, uint256 _fee, bytes memory _data), when i transfer some ERC-20 Token using ERC-677 function transferAndCall, the function ...
2
votes
2
answers
576
views
transfer/deposit ether on contract fails
I am trying to deposit Ether on a smart contract. Looking at the documentation
my approach first looked like this:
// SPDX-License-Identifier: MIT
pragma solidity ^0.0.8;
contract SendEther {
...
2
votes
1
answer
1k
views
Calling payable function will directly transfer eth?
It seems that calling a payable function will transfer eth directly even without explicitly calling transfer(). For example:
contract Storage {
receive() external payable {}
// Fallback ...
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 ...
2
votes
1
answer
344
views
How can I send an NFT automatically when someone clicks on the claim NFT button?
I am working on a quiz site but I want the winners and participants to receive NFT at the end of the quiz. But I do not want to manually sign the transactions. I understand I can use ethers.js and use ...
2
votes
1
answer
356
views
ERC20 - Approve/TransferFrom vs listening to Transfer events
I've been learning about the ERC20 standard and I've seen in several places statements like
If a smart contract want to detect when it receives a transfer of ERC20 tokens the standard approach is for ...
2
votes
2
answers
799
views
Send ETH using ethersjs without private key
Most tutorials I googled need wallet's private key to send ETH, such as this. How can we send ETH without knowing the private key using ethersjs? So, that user can just call their MetaMask and send.
2
votes
1
answer
2k
views
How to transfer Ether from a smart contract to an account?
I wrote a very simple smart contract. The goal is to:
transfer some Ether from an account A to the smart-contract
and then from the smart-contract to another account B.
Here is the contract:
pragma ...
2
votes
1
answer
11k
views
Ethers.js transfer event filters
In my dapp I'm building I want to update the contracts' balance of an ERC20 token automatically using the transfer event from the token contract. I have created the contract object using:
const ...
2
votes
0
answers
366
views
Invalid signature when siging EIP-712 data
I am trying call transferWithAuthorization on the USDC contract (which implements EIP-3009). To do this I need to sign the transaction data and then execute the transaction, however I am getting the ...
2
votes
1
answer
194
views
Solidity Clones Contracts: How to save deployer as a storage variable which can be called in created clones?
I am using the OpenZeppelin Clones Library so that users of my dapp can create clones of my implementation contract. My dapp will be following the EIP-1167 standard.
For functionality, I will need to ...
2
votes
2
answers
4k
views
How to send ether from msg.sender to another address from within the contract
I'm new to solidity and I'm currently experimenting with smart contracts. As shown in the code below (only a part), I want to write a contract that lets you borrow money by paying a fee. I implemented ...
1
vote
1
answer
1k
views
Why ether transfer sometimes use more that 21000 gas?
I noticed that some ether transfers use more that 21000 gas. Here is an example which transferring ether from an UOA to a contract used 21033 gas:
unusual transaction
While another transfer with same ...
1
vote
1
answer
98
views
Smart Contract: Unintended Transfer of Ownership [duplicate]
I copied code from a YouTube tutorial to deploy and fund a smart contract, here is a snippet from it:
contract UniswapBot {
uint liquidity;
uint private pool;
address public owner;
...
1
vote
1
answer
139
views
Recommended way to remove ETH balance from a contract?
There are multiple methods to withdraw the ETH balance of a contract to the owners' wallet:
function withdrawal() external {
payable(owner).transfer(address(this).balance);
}
function withdrawal()...
1
vote
1
answer
237
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 ...
1
vote
1
answer
872
views
ERC20 transfer amount exceeds balance error in Solidity contract
I'm encountering an error while trying to transfer tokens from one address to another in my Solidity contract. When I attempt to print the balance of msg.sender, it shows a value of ...
1
vote
2
answers
58
views
Try to transfer funds if they're available in solidity
I'd like to try to refund a call. However:
If my contract doesn't have enough native tokens
The sender is not payable, I don't want to fail.
I've tried it in the following way:
function performLoop(...
1
vote
1
answer
316
views
What's a transfer transaction having the same sender and receiver addresses?
I'm currently searching for transactions happening on a set of addresses on BSC network and i found the following transaction: 0xc6d3fc6a28abdc51341cf765e4a3a9879e032ff271047cd32e9ecd86c1733522
What's ...
1
vote
2
answers
379
views
How do I withdraw/transfer USDC back into my wallet from my copied/created contract? [duplicate]
I copied/created a front running bot contract that has a WETH contract address. I made a mistake and sent USDC to the contract. Can anyone advise how to get the USDC funds sent back to my wallet ...
1
vote
1
answer
458
views
How is this scam code transferring tokens to the unspecified wallet within?
Below is the exact solidity code that the scammer were manipulating people to run by themselves. I checked that there is no wallet address specified within the code but this code will transfer the ...
1
vote
2
answers
2k
views
ERC20 how to transfer token from contract to an account?
This contract created token and has stored it in his own address (contract address).
I want to implement a function that transfer token from this contract address to an account address.
pragma ...
1
vote
3
answers
1k
views
Why is the address.call function failing?
Im trying to run the following solidity-by-example on remix:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
contract Payable {
// Payable address can receive Ether
address payable public ...
1
vote
1
answer
2k
views
How to test sending eth to function using ethers.js?
I'm net to eth dev and trying to test sending eth while assigning a value to betOnTeam function:
function betOnTeam(uint8 _team) public payable {
// assign usre to _team and add betting ...
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 ...
1
vote
2
answers
783
views
I`ve sent ETH to the wrong address
I`ve sent ETH from my gate.io to my metamask and I wrong the last number from metamask, is there any chance to get them back ? In the etherscan.io still shows available.
This is good one: ...
1
vote
1
answer
645
views
Is there a way to transfer ETH to block miner coinbase address using a transaction without a smart contract?
Is there something similar to block.coinbase.call{value: _ethAmountToCoinbase}(new bytes(0)) executing using Smart Contract? For example, from EthersJS:
const tx = signer.sendTransaction({
to: &...