Questions tagged [transfer]
The transfer tag has no usage guidance.
224
questions
13
votes
2
answers
8k
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
2k
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,...
5
votes
2
answers
1k
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/...
5
votes
0
answers
907
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
1
answer
280
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 ...
4
votes
2
answers
4k
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
756
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
2
answers
1k
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
2k
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
0
answers
524
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
1
answer
289
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 {...
2
votes
3
answers
124
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
620
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
1
answer
1k
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
1k
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
54
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
1
answer
789
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
79
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
348
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
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
10k
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
1
answer
82
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
3k
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 ...
2
votes
2
answers
527
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.
1
vote
1
answer
757
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
172
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
27
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
50
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 ...
1
vote
2
answers
18
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
73
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
150
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
299
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 ...
1
vote
1
answer
281
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
1k
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 ...
1
vote
2
answers
1k
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
845
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
2k
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
704
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
967
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 ...
1
vote
1
answer
421
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: &...
1
vote
1
answer
52
views
How to write a simple token contract which token can only be transferred within the specific geographical region?
In my use case, I want to build a local currency system with solidity. The core concept of local currency is that the currency can only be used in the specific region. It aims to encourage spending ...
1
vote
1
answer
2k
views
what is the cheapest way for sending ethereum from 10 account addresses to 10 account addresses?
What is the cheapest way to send ether to 10 addresses? By using smart contract or using externally owned account to send one by one...? I know that the gas limit of a normal transaction is 21,000......
1
vote
1
answer
137
views
Transaction Reverted when calling a function to send Tether USDT from Contract to wallet address
I have a function that uses the ERC20 transfer function to send an ERC20 token from a smart contract to another wallet address.
function withdrawTokens(address _tokenContract, uint256 _amount) ...
1
vote
1
answer
69
views
ERC677 transferAndCall
i want to send some LINK to a contract B from a contract A, and in the same function call a function in contract B, im using transferAndCall(address _to, uint _value, bytes _data) function in the ...
1
vote
1
answer
84
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
62
views
how can i check hashcode and th amount
I'm new in Solidity, therefore if I have a wrong concept of anything kindly do explain.
I'm working for a personal escrow smart contract that should include these functions:
1- function deposit from ...
1
vote
1
answer
36
views
modifiers overriding simple question with inheritance
just wanting to be sure of this. If I have a contract that inherits from another contract and overrides a function of that contract with NonReentrant modifier on it. Will that NonReentrant modifier ...
1
vote
1
answer
159
views
is pull over push pattern recommended for erc20 withdrawal too?
I had a chance to read the pull over push pattern for transferring/withdrawing ethers, but i'm not sure if i need to apply this for erc20 transfers.
i.e.
function buy(uint256 _someId, uint256 _price)...