Skip to main content
18 votes

Using ".value(...)" is deprecated. Use "{value: ...}" instead

With respect to the ".value(...)" is deprecated. Use "{value: ...}" warning: You can use the following pattern to remove the warning: (bool success, ) = recipient.call{value:amt}(&...
Lee's user avatar
  • 8,588
10 votes
Accepted

Someone has "faked" transferring 0.00 ERC-20 tokens from my and many other addresses

This is just new way to do scam to the ethereum addresses. Scammer are creating new address which looks alike the address the user is constantly sending the token or any ERC20 token like USDT, USDC. ...
Safi's user avatar
  • 893
8 votes
Accepted

Why ether transfer sometimes use more that 21000 gas?

That's because when the normal transaction took place, there was no contract code at this address (it was created here at block 15158470, but the tx is at block 15152542). So all that was paid was the ...
hroussille's user avatar
  • 7,841
6 votes
Accepted

Why ERC721 does not have direct transfer function?

We did not include a transfer function because it may be ambiguous whether you mean to transfer something that you are the owner of versus something you are authorized to get. The current owner must ...
William Entriken's user avatar
6 votes

Why does SafeERC20 assume that the token's transfer and transferFrom return value is optional?

Quick answer: there is NOT always a return value. Long answer: Although it is not fully ERC20-compliant, there are lots of ERC20-tokens out there which don't return anything. Instead, they just are ...
itinance's user avatar
  • 184
6 votes
Accepted

Why does Uniswap V2 use `_safeTransfer` to transfer tokens?

Because the ERC20 standard kinda sucks, and is unclear about how you should handle non-succeeding token transfers, both reverting and just returning false are technically allowed, so this takes both ...
Foxxxey's user avatar
  • 4,402
5 votes

What is best practice for transferFrom out of these two ways

Jeremy's answer is incorrect. While it's true that Openzeppelin's implementation does never return false, other implementations might do it. According to the EIP-20, a token can return false, and it's ...
0xSanson's user avatar
  • 3,709
5 votes
Accepted

When would an ERC20 return false?

ERC20 Standard mentions handling false returns because some early token implementations return false instead of reverting. OpenZeppelin's ERC20 contract returns true or reverts, which is a common ...
Adam Boudj's user avatar
  • 2,431
4 votes
Accepted

Make an erc20 transfer with web3py

transact() asks the node to sign your transaction using eth_sendTransaction. Infura can't do that, because they don't have your keys. Instead, you can use the contract object to create an unsigned ...
carver's user avatar
  • 6,381
4 votes
Accepted

What are these 2 transactions with the same hash and different values?

Looking at the transaction in your example on etherscan I see this transaction makes multiple transfers of erc20 tokens to various address. It seems that the etherscan endpoint you are querying ...
neurotempest's user avatar
4 votes
Accepted

Recommended way to remove ETH balance from a contract?

You are right. But the thing is, even the gas cost of opcodes can be increased in the upgraded version and it is evident in EIP1884 during Istanbul hard fork, where gas cost for sload increased. ...
Zartaj Afser's user avatar
  • 4,925
4 votes
Accepted

Smart Contract: Unintended Transfer of Ownership

It seems like you've fallen victim to a scam tutorial. The youtube video was posted two weeks ago from the time of writing this: And in the video they show the contract being brand new: Yet if you ...
Rohan Nero's user avatar
  • 1,635
3 votes
Accepted

Estimating transfer gas for ERC20 tokens using ethers js without needing the token

TLDR; Not all ERC20 transfers cost the same. There are mostly four cases of ERC20 transfers which influence the gas costs. Most of the time you're better of with passing a high value for gasLimit. But ...
Soham Zemse's user avatar
  • 2,091
3 votes
Accepted

Why Transfer function doesn't check for allowance comparing to TransferFrom?

Using account A in order to execute transferFrom(source, target, amount) requires both: source holds at least amount of the given token A has been approved by source to transfer from it at least ...
goodvibration's user avatar
3 votes
Accepted

Request a transaction amount in a function

The contract can't prompt the user for any input. It has to be the frontend code which asks the user for input. So in your frontend you need to ask the user to input the amount of Ether to send and ...
Lauri Peltonen's user avatar
3 votes
Accepted

Trying to understand Etherscan output for token swap via Uniswap

It is leftover ETH that was returned to your wallet as a change. For more detail, you chose to swap by specifying the exact output amount (Doge Reload), so the web calculated the ETH input needed (~0....
turboza's user avatar
  • 340
3 votes

Fetch last 10 blocks using Alchemy Transfers API

Alchemist here 💙 To fetch all NFT mint events within the last 10 blocks, you can use: ethers.js to fetch block num, and then use the Alchemy getAssetTransfers request to search "erc721" ...
thatguyintech's user avatar
3 votes
Accepted

Usage of transfer Instead of safeTransfer

You are correct that you do not need SafeTransfer when transferring your own erc20 or a erc20 that's safe to transfert to start with! Some erc20 return bool true on a successful transfer, some don't. ...
Olivier Demeaux's user avatar
3 votes

How to prove to someone that you're the owner of an Ethereum wallet remotely?

So what you want to do is prove that a person is in possession of a private key which maps to certain address. To do this you can ask him to sign some message with the private key (account). You can ...
Lauri Peltonen's user avatar
2 votes

Modifying erc-721 transfer

If it implements all functions on the IERC721 interface is not falling from the standard. As @Airwave mentioned there is the EIP2981 standard for royalties and you can see OpenZeppen implementation ...
Julissa DC's user avatar
  • 1,956
2 votes

How to approve user to spend all my ERC20 tokens?

What is usually done (you can see such cases on decentralized exchanges) is to approve a very large number of tokens (greater than the total supply). A library such as bignumber.js can help you to ...
clement's user avatar
  • 4,352
2 votes
Accepted

what is the cheapest way for sending ethereum from 10 account addresses to 10 account addresses?

10 transactions from an EOA will cost 210,000 gas. The most efficient way to do this would be to deploy a contract that accepts funds in the constructor and subsequently distributes the funds to 10 ...
Shane Fontaine's user avatar
2 votes

Is it possible to predefine 'msg.value' when calling a function in an external contract?

To send funds in a function call to another contract you can use something like this: contract X { function transfer(address dest, uint amount) public { ... } } contract Y { function take() public ...
Lauri Peltonen's user avatar
2 votes
Accepted

Gas limit issue when transfer USDT

eventually i manage to find out this answer for myself. This phenomenon happen because contract execution trigger refund gas mechanism. Back to time when i transfer my whole USDT, upon contract ...
Atlas Chiew's user avatar
2 votes

Transfer ETH to 3rd part wallet with keystore - MEW does not recommend

Using keystore files (and private keys, mnemonic phrases, etc.) on websites is discouraged because there's a higher risk of them being stolen. The DNS servers of the website could be hacked (which ...
Morten's user avatar
  • 6,052
2 votes
Accepted

Is there a way to transfer ETH to block miner coinbase address using a transaction without a smart contract?

Directly, there is no way to use the "to" field of a transaction as block.coinbase. The to field needs to be an address (or 0 for creating a contract). But the miner will get your ...
eth's user avatar
  • 86.3k
2 votes

Sending token with contract interaction in Remix

Think I found the answer actually: Call a smart contract payable function sending erc20 token User/me first needs to call the approve function in the LINK contract then my Remix contract can transfer ...
gmondok's user avatar
  • 87
2 votes
Accepted

How to write a simple token contract which token can only be transferred within the specific geographical region?

One way you could achieve that is by: Creating a whitelist of addresses that will be the only ones to transfer your local currency Overriding transfer() to restrict transfers from/to users within the ...
Sergi Juanati's user avatar
2 votes

Need to understand the logic used in multiTransfer function,

The logic is simple, You transfer the amounts of the token described by the contract this function is part of, to the addresses specified in the entry data. The only different logic here is how are ...
Kaki Master Of Time's user avatar
2 votes

Solidity contract - Best way to airdrop a single time a user

The best you can do is create a mapping between the getAirdrop function and the user's address. Then add a method into the getAirdrop fuction that if the airdrop is successful, the Boolean goes to ...
AvocadoChocolate's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible