Skip to main content

Questions tagged [erc-20]

The ERC20 Token Standard is a set of 8 functions to be included (in an agreed upon language) in a smart token contract in order to enable interoperability across multiple interfaces and dapps. These functions relate to (1) how tokens can be transferred (2) how to access data about the token, and (3) how to format key events like transfers and approvals. ERC stands for Ethereum Request for Comments.

Filter by
Sorted by
Tagged with
2 votes
2 answers
10k views

Any quick, easy ways to convert ERC-20 tokens?

Are there any quick ways to convert my Airdrop ERC-20 tokens from various old ETH wallets to ETH/BTC...? Looks like I've got a few hundred $ kicking around in old Airdrop tokens. I've seen a few ...
ETH_TokenGuy's user avatar
2 votes
1 answer
235 views

Best practices on handling both ether (Ξ) and tokens

I'm writing a contract which should handle both ether (Ξ) and ERC20 tokens. I know that many dApps use WETH and I understand what it does, but I'm not sure if it's used because it's the most efficient ...
Paul Razvan Berg's user avatar
2 votes
0 answers
110 views

Why do some contracts use multiple balance and supply variables? [duplicate]

I'm trying to understand smart contracts. Now I do understand the basic template. However, many token's I see on the internet use different code. Many of them have a different way of storing balances ...
Skywalker's user avatar
2 votes
1 answer
8k views

How to use sendTransaction to send ERC20 tokens through Metamask?

I have a custom ERC20 token and I want to enable metamask support. By this I mean: 1) The user clicks a "Pay using metamask" button 2) The Metamask payment window pops up and with "Pay 100 ABC ...
bigpotato's user avatar
  • 279
2 votes
1 answer
1k views

Etherscan API no decimals separator

I am using Etherscan API to retrieve certain erc20 token balance on given ETH address and get a number like 62910000000 without decimals separator. In fact the proper balance is 6291000.0000. How to ...
Jacek Dudzic's user avatar
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 ...
Sabreena's user avatar
2 votes
1 answer
1k views

What determines the price of the ERC-20 token on a trading exchange?

I know that ERC-20 tokens are traded in pairs on the trading exchanges, but what essentially determines the price in USD? I would like to know if there's a specific algorithm that does the calculation....
Anji P's user avatar
  • 45
2 votes
1 answer
2k views

Help needed understanding ERC20 smart contract functions and workflow

I have deployed an ERC20 smart contract to the Ethereum blockchain, it can be viewed here: https://etherscan.io/address/0x90c97591205aff8400dbe99f8b17c888e890d28d#readContract I have been able to ...
Lismore's user avatar
  • 1,303
1 vote
1 answer
1k views

Is it possible to trigger an ERC777 receiver hook by receiving ERC20 tokens?

I noticed that the callTokensReceived hook is called when using a few of the ERC777 functions but I am wondering how this could be triggered if an ERC20 token was sent to it? Example (pseudo code): ...
Jonathan Scialpi's user avatar
1 vote
1 answer
767 views

ERC20 token transfer attempt resulting in underpriced (price change attempted)

It's almost an exact copy of this but when I ran it, I get the following error message. (node:5189) UnhandledPromiseRejectionWarning: Error: Returned error: transaction underpriced Below is the code ...
stratofortress's user avatar
1 vote
1 answer
3k views

Contract with function payable to receive ERC20 token in one shot?

I am trying to write a smart contract with a function that receives an ERC20 token (i.e.: DAI), but the transaction to call this function is always failing. Let's assume I first record the ERC20 ...
Sergi Juanati's user avatar
1 vote
1 answer
12k views

Cannot estimate gas error on Uniswap / Sushiswap

I'm trying to swap at Ropsten network some tokens for testing purposes, but I'm getting the following error: Cannot estimate gas. It's curious because when I transfer from one wallet to another ...
Niko's user avatar
  • 31
1 vote
2 answers
554 views

Guessing mnemonic phrase based on the first 2 public addresses [duplicate]

Last hopeless attempt. I know that infinite amount of private keys can be generated from a mnemonic phrase and usually MetaMask, etc picks the first one from the list to use as the public address. ...
Jaja Ned's user avatar
1 vote
1 answer
2k views

swap token for usdt, create function send 1 usdt and receive 1 token

I need to create a smart contract where each token of mine will be exchanged for 1 usdt, that is, a person sends 1 usdt to the function and he adds 1 token to his balance sheet. How can I do it? with ...
Augusto Furlan's user avatar
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 ...
Harish Manthurthi's user avatar
1 vote
1 answer
890 views

Lock multiple batches of ERC20 tokens for a certain amount of time

I need to build a smart contract where users can lock their ERC20 tokens for a fixed amount of time (same amount of time for all users, e.g. 1 year). Lets say a user locks 100 tokens and half a year ...
Daniel Gretzke's user avatar
1 vote
1 answer
4k views

Is it possible to send ERC20 tokens to a contract address like sending ether?

Can we send ERC20 tokens to a contract address??
Jazz's user avatar
  • 216
1 vote
1 answer
589 views

Implementation of an Allowance Crowdsale. Token Interface / _prevalidatePurchase-/_delivertokens-function

I am new to solidity coding and after I created some basic contracts as well as a ERC20 token contract I wanted to create a crowdsale contract. Now I am stuck and I have a question regarding the ...
Daniel's user avatar
  • 61
1 vote
1 answer
2k views

Transfer ERC20 Token using Ropsten Infura with Web3

I created a contract token using the Ethereum.org token solidity code. It has a function called transfer to send tokens between accounts: function transfer(address _to, uint256 _value) I need to know ...
Viper's user avatar
  • 151
1 vote
2 answers
219 views

Why does the MESH token is stated to be vulnerable on the recent overflow bug of some ERC20 contract?

Has you know, there were a recent vulnerability which allowed creation of units for anyone in some ERC20 contracts. However, I’m failing to find the stated vulnerable code for MESH. Does it means it ...
user2284570's user avatar
  • 1,018
1 vote
1 answer
1k views

Why my token holder stay at 0 on etherscan

I deployed a smart contract on the Ropsten testnet to create an ERC-20 token but, even though when I add my token on Metamask it shows that I own the total supply of the token, my token ownership ...
yohan's user avatar
  • 65
1 vote
1 answer
2k views

Why don't I see my tokens in Mist?

I think I should have several tokens in my account, but I can only see Ether. Is a wallet contract necessary to see ERC-20 tokens?
Nick Exa's user avatar
1 vote
2 answers
175 views

ERC20 Token Standard Question

I've been following this wiki as a reference. The code has this snippet: // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ...
Simon Rubin's user avatar
1 vote
4 answers
1k views

Monitor token transfers

I'd like to monitor the transfers of a certain ERC-20 token but so far I didn't find a way. I'm currently using web3.py. Any suggestion? Thanks
Matteo Pallotta's user avatar
1 vote
1 answer
942 views

How do i transfer erc20 token from another contract?

I'm creating a contract which will transfer usdt token from users wallet to contract address // SPDX-License-Identifier: MIT pragma solidity 0.8.16; import "https://github.com/OpenZeppelin/...
sachin murali's user avatar
1 vote
1 answer
916 views

Help me understand this sample code for new ERC20 token

This is my first question here so please bear with me. I have deployed my first token on test network. I was reading about how to improve Token contracts and stumbled upon this sample file. This ...
Sallu's user avatar
  • 175
1 vote
1 answer
529 views

Unable to send tokens

Since December 3rd I have attempted to send ~200 OMG from my wallet to a OMG wallet on a exchange. I am attempting to do this through myetherwallet.com and I have tried about 4 times now. Every time ...
halexh's user avatar
  • 135
1 vote
1 answer
226 views

Does an Ethereum client need to download the entire state of a contract in order to use it?

A typical ERC20 token will store account balances in a mapping, something like this: mapping(address => uint) public balances; Does this mean that, to do a transaction or check a balance on this ...
Peter Hall's user avatar
1 vote
1 answer
2k views

How to make a Solidity function require ERC20 payment

I find lots of examples for making a contract function payable with Ether and requiring specific Ether amounts. But how do I achieve the same with an ERC20 token instead of Ether? Example: Say I have ...
Svante's user avatar
  • 450
1 vote
1 answer
667 views

Are there any risks of undefined behavior when calling a function which doesn't return anything using a prototype of it which returns bool?

According to the ERC-20 Token Standard, functions transfer and transferFrom should return a boolean value indicating success or failure: interface IERC20Token { function transfer(address _to, ...
goodvibration's user avatar
1 vote
1 answer
945 views

How to make a delegatecall to external ERC20 token's approve function?

What I would like to do is something like this: function testCall(uint amount) public virtual returns (bool) { address tta = address(0xE7B6....); (bool success, bytes memory result) = tta....
Damir Olejar's user avatar
1 vote
1 answer
1k views

how to find destination address and value from transaction

How to find destination address and value from transaction detail? Network: rinkeby destination address is: 0x5e6b735c855cf7f44f179c25c98195ace9eb972b token value is: 100 LINK but this items doesn't ...
dave janson's user avatar
1 vote
1 answer
118 views

Why is the totalSupply of this token statically initialized to 5500000000?

contract UnixERC20 is StandardToken { function() { throw; } string public name; uint8 public decimals; string public symbol; string public version = 'H1.0'; ...
Rudrika's user avatar
  • 407
0 votes
2 answers
484 views

How to resolve insufficient asset liquidity in 0x on polygon mumbai testnet

I am testing the 0x api to get quote on Mumbai testnet. I want to swap BAL -> wETH. https://mumbai.api.0x.org/swap/v1/quote?buyToken=0x2e3A2fb8473316A02b8A297B982498E661E1f6f5&sellToken=...
Rishabh Raghwendra's user avatar
0 votes
2 answers
43 views

ICO Site Development, When should I transfer tokens to investors

I am trying to develop ICO presale site and researched various ICO contracts on github. I am now stuck because I can't know when I should transfer tokens to investors. Someone wrote buyTokens ...
alexpopov86's user avatar
0 votes
1 answer
158 views

createPayment method from solidity contract: This transaction is excepted to fail

I'm trying to implement and use the Solidity claimPayment function so my users(client) can claim a defined amount of tokens on my website (i want them to pay the fees and my server decide how much ...
Owow's user avatar
  • 123
0 votes
2 answers
2k views

Failing to trying to approve contract using ethers.js (CALL_EXCEPTION or cannot estimate gas)

I am having trouble calling a simple ERC-20 approve function from the front end on the Arbitrum network. Any insight is greatly appreciated. I will outline my code below. I am retrieving the provider ...
qoze's user avatar
  • 13
0 votes
1 answer
2k views

What is the best way of token redemption by user?

Background RETN Deals offers discount coupons from global brands and in addition, offers generous cashback in Cryptocurrency (RETN). The web application automatically tracks consumer purchases at ...
Rajesh's user avatar
  • 706
0 votes
1 answer
83 views

Is there a performance penalty towards creating the maximum number of tokens with ERC-20 etc?

I saw this link: Max possible ERC20 Tokens allowed with 18 decimals? Is there a performance penalty for creating so many tokens? Obviously the number of storage capacity needed for mining will be ...
okit247's user avatar
0 votes
2 answers
2k views

How to make transactions without metamask

My account has enough ether to make a transaction. How do i call a payable function that is written in solidity? I tried by calling like this const Web3 = require('web3'); const HDWalletProvider ...
Trinu's user avatar
  • 125
0 votes
1 answer
585 views

receiveAprroval through tokenRecipient interface

I received an error by the compiler regarding the following solidity code and I would like to know what's this error and what's the fix? interface tokenRecipient { function receiveApproval(...
hibanl's user avatar
  • 67
0 votes
1 answer
499 views

Token forward contract?

So i want to forward erc20 tokens that i receive in different wallets, to a single "parent" wallet so to speak. by searching around the stackexchange, i found how to forward ethers, > pragma ...
Justin Kwon's user avatar
0 votes
1 answer
541 views

Is ERC20 Token Contracts the Only Way to Create Custom Tokens?

Is the only way to create your own tokens/cryptocurrency on Ethereum by deploying a Smart Contract following the ERC20 standard? After deploying the token contract, is the only way to transfer the ...
keweli's user avatar
  • 55
0 votes
1 answer
668 views

Do I have to implement ERC20 signature as separate contract and use inheritance?

ERC20 defines contract signature for contract in order for them to be accepted by wallets, exchanges etc. I have seen that for some reason, even when signature contract (interface/abstract contract) ...
featherbits's user avatar
0 votes
1 answer
965 views

How to create a Payable function that only accepts a customer token?

I've got a question that I cannot seem to find an answer for, hoping the community can help (and this is my first post here so my apologies if this is the wrong question to ask in the first place). I ...
nukalov's user avatar
  • 103
0 votes
1 answer
3k views

Uniswap Price Feed.- Get price of a Token in a Solidity contract

I am looking to retrieve the current price of a token from Uniswap. I have successfully used the ChainLink oracle api to get the price of BTC/USD, but I want to now integrate Uniswap price feeds. I ...
Joe_Bloggs's user avatar
0 votes
1 answer
3k views

Getting this error for TOKEN ABI: You must provide the json interface of the contract when instantiating a contract object [closed]

I am trying to get abi of a token with etherscan and pass the variable in to the web3 function. I am using etherscan's getabi built in function as it is shown in the API documentation but I am still ...
Itsjonie's user avatar
  • 259
0 votes
1 answer
210 views

My Token erc20 does not issue tokens

Here is my code: pragma solidity ^0.5.0; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { ...
HM.schrodinger's user avatar
0 votes
1 answer
945 views

Is there a way to poll totalSupply of an ERC20 token on a specific Block?

I am using web3.py, and i am trying to get block-specific data of some ERC20 token contracts. Also, i tried with Google's BigQuery, but both seem to give the totalSupply at the 'latest' block. Is ...
GaryB's user avatar
  • 73
0 votes
1 answer
446 views

Accepting multiple ERC20 tokens

I've been doing a little project of mine where users could donate ether to a certain campaign to reach a certain goal, but I wanted to extend this project a little further and wanted to allow the ...
Luka Lazarevic's user avatar