As of May 31, 2023, we have updated our Code of Conduct.

Questions tagged [transfer]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
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-...
Shaketh's user avatar
  • 31
0 votes
1 answer
30 views

What are some APIs that write transactions to the blockchain?

Are there any APIs that write transactions to the blockchain? I am most interested in RESTful versions.
Mowzer's user avatar
  • 201
0 votes
1 answer
175 views

Invalid amount in MetaMask app on iPhone

I am using Moralis for simple token transfer from one wallet to another. My code: And this works great on desktop (Chrome MetaMask plugin): But when I wanna use this on my phone - iPhone (MetaMask ...
PoorMillionaire's user avatar
0 votes
1 answer
235 views

erc20 transfer function not working

i am developing a locking smart-contract where user can add token address, amount and lock time. i imported erc20 standard from openzeplin but when i transfer erc20 tokens to my smartcontract is ...
learner's user avatar
1 vote
1 answer
91 views

How to send ether from smart contract to a particular address

I initially transferred some ether into the smart contract when deployed and in one of the function I should be transferring ether to the address of the msg.sender. Help me out if you can!
qwak's user avatar
  • 11
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 ...
Alexander Herranz's user avatar
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 ...
Mourad's user avatar
  • 123
1 vote
2 answers
230 views

transfer money without specifying the amount

I have a list of products, each product has a price. I would like to create a function that can be called by a user and automatically checks whether the user's balance has enough money to buy the ...
sono's user avatar
  • 113
0 votes
1 answer
754 views

Getting Fail with error 'TransferHelper: TRANSFER_FROM_FAILED' while trying to swap part of tokens during transfer

I have created ERC20 token and want to modify transfer function so that swaps part of transferring amount to another token. I'm using OpenZeppelin ERC20 contract. // SPDX-License-Identifier: MIT // ...
Aleksei .C's user avatar
0 votes
1 answer
346 views

payments ( pre set value) in solidity

I am developing a movie renting smart contract where the owner can add new movies, clients can search movies and pay for the movies they select. Adding and searching is working to my liking. The ...
learner's user avatar
0 votes
1 answer
90 views

Send Ether from SC to EAO

I came across many blogs saying the defacto standard to send ether from one contract to another and why one is better than the other. However, what is the best practice for sending ether from contract ...
Emrah's user avatar
  • 1,434
0 votes
0 answers
59 views

Subscriptions - Recurring payments (Fiat to Crypto wallet)

I checked several platforms (BitPay, Stripe, Plaid etc..) but none seem to enable me to setup a recurring payment from fiat to a crypto wallet the same way you would do it on Netflix with your bank ...
ibox's user avatar
  • 51
2 votes
1 answer
785 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 ...
user3799934's user avatar
0 votes
1 answer
19 views

_addr.transfer(amount) dependent on value in message

I am trying to write a simple smart contract that accepts a small constant fee of eth. I am using the _addr.transfer(fee) function and the 'fee' is set in the contract at time of construction. I am ...
broadbear's user avatar
  • 103
1 vote
1 answer
429 views

Is "approve" required only for transferring tokens? Not a native coin?

Speaking of Ethereum blockchain, or any other one compatible with it: Polygon, Avalanche and others: is calling the function approve(...) mandatory only, and only, when there's a token involved in ...
Markus736's user avatar
1 vote
1 answer
618 views

Transferring ERC721 tokens with web3j using an operator

I've been struggling using web3j (the web 3 Java library, not JS) transferring ERC721 tokens from one user to another, using an operator. I get that we need to approve the operator from the user that ...
zain101's user avatar
  • 11
0 votes
0 answers
166 views

Send ERC20 tokens(it is link) from an address to smart contract

I can not transfer ERC20 tokens from my address to the contract. But I can transfer from the contract to other addresses. my account(msg.sender) has 10 link(ERC20) tokens . and i want to send these ...
srs.aslani's user avatar
0 votes
0 answers
216 views

How to retrieve Wrapped BNB tokens sent to Ethereum Smart contract instead of Binance Smart Contract address?

Need desperate help from experts here. I swapped my ETH coins to BNB first to buy some pre-ICO coins, but executed a contract in Ethereum network (accidentally forgot to create and transfer Binance ...
Gene's user avatar
  • 1
1 vote
3 answers
841 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 ...
Nicolás Guasca Santamaría's user avatar
0 votes
1 answer
41 views

How to perform an action when receiving tokens in smart contract

So I have some custom Tokens in a smart contract and whenever I receive BUSD in the smart contract I want to be able to send some of the custom Tokens back to the user that paid through a button from ...
Fotis Aronis's user avatar
0 votes
1 answer
40 views

Contract does not accept eth sent from another contract

Hi I try to send ETH from Sender contract to Receiver contract by calling sendPayment function. But I get an error. I know that the issue is the require statement in the fallback function because ...
Satoru Yamada's user avatar
0 votes
1 answer
186 views

Transfer() method with Web3 I got error and didn't transfer

I tried to make a button on we3 when click on it, the transfer method should start after 5 minutes. when I click my button first of all metamask show me this when I click on try it anywhay this error ...
Abeer's user avatar
  • 3
0 votes
0 answers
37 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?...
Jhonatanbsc's user avatar
0 votes
1 answer
28 views

Give certain address permission to transfer ownership

I'm trying to create a contract and give a certain address, that is not the owner, permission to transfer ownership, or to atleast have the transferOwnership function public but only be able to ...
Cryptastic's user avatar
0 votes
1 answer
33 views

Sending balance to contract fails

I'm playing ethernaut, the king of the hill level. I made a practice target contract and an attacking contract. I want to send value to the attacking contract (this works) then I want to send the ...
guernica's user avatar
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 ...
fastRatt's user avatar
0 votes
0 answers
29 views

Contract getFunds call which should send wrapped ERC20 token to owner reverts, why?

My smart contract holds a few WETH. I have this function in my contract: function getFunds(address tokenAddress) external onlyOwner{ IERC20 token = IERC20(tokenAddress); uint ...
flo's user avatar
  • 123
0 votes
0 answers
136 views

Why the transaction reverted when I try to sell tokens on uniswap v2 router2, but success on browser?

I am using web3 to send transaction to uniswap v2 router2 to sell my tokens for ETH, with both the sold token and WETH approved for router2 with amount of uint256max, and I set amountOutMin to 0 ...
chen chang's user avatar
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 ...
blnks's user avatar
  • 165
0 votes
1 answer
52 views

Revert error when transfering available amount of ETH

I'm trying to code a reward pool distribution system and I'm unable to do the following (in that order). A deposits X amount (user_deposit) B deposits Y amount (user_deposit) C deposits Z amount of ...
Mateo Molinari's user avatar
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 ...
challet's user avatar
  • 131
0 votes
1 answer
178 views

Amount is wrong when transferring ERC-20 token with web3.js

When I run the method on Etherscan or Remix, the amount is correct, and it displays with the token's symbol CSHIP. Yet for the life of me, I can't get the right amount to show up when I am ...
Michael Wang's user avatar
0 votes
0 answers
230 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 { ...
eth_sign's user avatar
0 votes
0 answers
43 views

My token is not converting to BNB on transfer with testnet

I have copied 1Love's code; https://1love.charity/: https://bscscan.com/address/0x25096f414c11a41c802a01bfa4210d76c88da838 However, on transfers I do not recieve bnb in my charity or marketing wallet. ...
newbie's user avatar
  • 101
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 ...
Harish Manthurthi's user avatar
1 vote
0 answers
47 views

I have a question about how to tell whether tx is 'transfer', 'call', 'create' or 'destruct'

I want to distinguish between the types of Ethereum TX. In the Ethercan, That is distinguish tx type like, transfer, contract create, contract destruct, contract call and etc... so, I check trace data ...
Minwoo's user avatar
  • 61
0 votes
1 answer
41 views

Sending Ether from contract to the sender

This is a very common question. I am trying to withdraw fund from the contract. I have tried send,transfer and call but the transaction hash always shows 0 value transferred pragma solidity >=0.4....
Asif Alamgir's user avatar
1 vote
0 answers
270 views

Cannot swapExactTokensForETH inside transfer of my token

I'm trying to create a token (calling it MyToken in this question) that on each transfer, it takes a fee from the transfer amount and does the following: calling the uniswap router to exchange this ...
xcsob's user avatar
  • 157
0 votes
1 answer
141 views

Automated Eth deposits onto L2 (e.g. Arbitrum, Optimism, Polygon/Matic etc.)

I would like to build a bridge between L1 and L2 that will send Eth from the smart contract on L1 to the smart contract on L2 automatically. So one will be able to deposit Eth on a smart-contract ...
Cezary Stroczyński's user avatar
0 votes
0 answers
1k views

ERC20: transfer amount exceeds balance - working with transfer with ERC20

I am trying to call transfer of an ERC20 token from another "escrow" smart contract in remix JavaScript VM (London). I have 2 contracts like so: MyToken.sol (an ERC20Votes.sol, but "...
user82768's user avatar
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 ...
Federico Gentile's user avatar
0 votes
0 answers
773 views

How to send BNB (or other networks) with web3 on a dapp?

So, I tried the many examples found around but I never manage to get it working. I have this snippet: async function pay(cost) { code = 0 message = "Please approve the tx" ...
Wyatt Gillette's user avatar
0 votes
1 answer
58 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 ...
Armindo Pereira's user avatar
0 votes
2 answers
982 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 ...
xenon's user avatar
  • 398
1 vote
2 answers
702 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: ...
LittleTigerM5's user avatar
0 votes
1 answer
60 views

Withdraw balance [duplicate]

I want to withdraw the balance on the contract. What is the problem?
Motun's user avatar
  • 1
0 votes
1 answer
52 views

Ownership question about Ethereum ERC20 tokens

I been considering creating my own Ethereum ERC20 token and I have one main question. When you create a Ethereum ERC20 token and you launch it, do you automatically own all of that Ethereum ERC20 ...
bobbyfisher1950's user avatar
1 vote
0 answers
795 views

How to transfer an ERC1155 Matic token using Node.js?

I'm trying to write a Node script that will transfer an ERC1155 token on the Matic network from my address to someone else's address. Here's an example token: https://opensea.io/assets/matic/...
Kane's user avatar
  • 111
0 votes
1 answer
2k views

BEP-20 Token Transfer Error

I am unable to transfer test tokens from my address (say address A) to another address B. The steps I did were deploy and verify a rebase contract, all tokens were automatically sent to my address. ...
mzaidi's user avatar
  • 942
0 votes
1 answer
67 views

Cannot transfer ERC-20 tokens from a contract

pragma solidity ^0.6.2; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; contract MyContract { IERC20 LINK; constructor(address token) public { LINK = ...
Ramit Agarwal's user avatar