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

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
863 views

invalid opcode: opcode 0x5f not defined

I'm new to Solidity and it's my first try to write a smart contract using Openzeppelin, Pancakeswap and BEP20 libraries basically to make a BEP-20 token. When i try to deploy the smart contract, i get ...
0 votes
1 answer
603 views

How to import Openzep ERC20: Identifier not found

Can I get someone's perspective on why I'm unable to find the ERC20 contract I've npm install @openzeppelin/contracts. After import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; I get a ...
0 votes
2 answers
2k views

How many tokens are transfered actually when we are using decimals

I have a code below and when I am transferring 1,695,000,000 to a particular address, so actually 0.000000001695 are being transferred. Why is it so? Does that mean to transfer 1.695 billion tokens I ...
8 votes
4 answers
10k views

Tracking tokenholders of a token with web3

If I have a token address how can I navigate and find certain things like: tokenholder addresses transactions for the token holders including when they made the transaction I'm new to smart ...
0 votes
0 answers
17 views

Opensea seaport protocol works with Eip712 offline signatures only through permit method of tokens?

I try understand how offline signatures work with seaport protocol for example. Seaport use offline sign to make operations in token contract behalf signer of offline signature (eip712). But token ...
1 vote
2 answers
781 views

Initial ERC20 Token supply split into 2 or more hardcoded addresses

don't know if someone can help me, but let me explain my problem. For more transparency in my ERC20 token generation smart contract, I want to hardcode the Team Pool (0xA) and Crowdfunding Pool (0xB) ...
2 votes
2 answers
537 views

To transfer tokens from owner address to an address, if latter address moves some other tokens to a given particular address

I am writing a contract for an ERC20 token (say ABC). Is it possible to airdrop some of these newly minted ABC tokens to those ERC20 addresses, every time, if they transfer a different token (named ...
0 votes
0 answers
22 views

balanceOf call revert exception

I am doing the Uniswap tutorial on SimpleSwap contract. I am stuck at making the tests. I am getting the exception at line: const ercAbi = [ // Read-Only Functions "function balanceOf(address ...
1 vote
1 answer
2k views

Uniswap fork: remove liquidity error

I am trying to fork uniswap. And I have a problem when liquidity is removed. Problem in UniswapERC20. I don't know what's wrong. Step by step (repeatedly for Rinkeby and Ropsten): Copy Uniswap ...
1 vote
0 answers
16 views

Scanning for fresh wallets and deployer connections

My main goal is to listen for fresh wallets buying launches of a erc 20 token. We all know fresh wallets (funded from a central exchange) could be created by insiders or friends of developers. Or ...
0 votes
1 answer
778 views

API that lists ERC20 token holders and balance

I am looking for a service that provides an API that lists addresses holding a given ERC20 token holder and the amount held. The API would be similar to Etherscan's: https://docs.etherscan.io/api-...
0 votes
1 answer
15 views

Mint function of ERC20 reverts, when called from another contract

So, I am trying to call a mint function which is present in my ERC20 token contract, which is a standard open Zeppelin Contract, From another Contract. I am using Interface to call the mint function, ...
0 votes
1 answer
294 views

Trying to call a mint function to a deployed erc20 contract using ethers.js

I'm building a react app which currently is able to connect to a wallet and display some data from a few deployed contracts. Upon connection to a wallet, I want to mint 1000 units of a token which I ...
1 vote
1 answer
27 views

Foolproof way to retrieve every token owned by an adress

So I wanted to retrieve every token balance of one of my adress. I started by analysing all my transactions. But then I discovered that I could not trust the transactions's transfer events and that I ...
0 votes
2 answers
270 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=...
1 vote
2 answers
1k views

How to transfer ERC20 tokes from Blockchain wallet to MyEtherWallet?

I got some token and by mistake sent them to my Blockchain ETH address. Now, what is the process of transferring them to MEW? They talk about exporting your private key, what does that mean and to ...
1 vote
1 answer
302 views

Who pays the computation fee in account abstraction ERC-4337? in what currency?

I hear that by imposing account abstraction specified in ERC-4337 EOA is not the only one that can instantiate a transaction. What I'm confused about is the actual entity that pays the gas fee and the ...
2 votes
1 answer
312 views

Transferring an ERC-20 using web3js 1.0.0

I have been trying to follow the web3js documentation, but it mentions things that are not native to Javascript like "Buffer" so I found a library called ethereumjs-tx to let me use that. My HTML ...
0 votes
1 answer
15 views

What are some good strategies to launch a token in a DEX?

I have a project that has a token and I want to launch it in a DEX. How can I incentivise users to provide liquidity to the pool so the pool is backed by a fair amount of WETH? Do you know of some ...
6 votes
2 answers
2k views

Smart contract erc20 code snippet to prevent buyer token transfers

I´m going to start a token pre-sale and I want to be able to send the tokens to the buyer but prevent the buyer to send tokens to another wallet. I tried the following in my ERC20 smart contract but ...
1 vote
1 answer
807 views

Create tokens with dynamic price

Imagine that I have a contract where a user can buy and sell tokens based on a dynamic price in ETH. The price is calculated every 2 hours by a server. When buying or selling, the value used is the ...
3 votes
0 answers
42 views

Why uint8 for decimals in ERC20 tokens?

Is there a specific reason why pretty much everyone uses uint8 for the decimals in ERC20 tokens? I would get it if it was to limit the size, because the decimals will never be big enough to exceed the ...
3 votes
2 answers
319 views

Issue with autonomous contract calling erc20 token's transferFrom for approved amount

Trying to transfer fund using ERC20 token handle and calling 'transferFrom'. Assume that the specific amount is preapproved by owner account for 'MyContract' contract address. contract StandardToken {...
0 votes
0 answers
15 views

How to bridge ERC-20 EFI tokens to Efinity parachain address using Enjin wallet?

I have been holding some EFI tokens in my Ethereum wallet and would like to transfer them to my Efinity parachain address. I am using the Enjin wallet on my Android device and was wondering if there ...
2 votes
2 answers
146 views

How to Deploy a Token Using the ERC-3643 Standard

I want to develop a smart contract using the ERC-3643 standard instead of ERC-20. Could you guide me on how to integrate this standard into my contract? Any assistance would be greatly appreciated. ...
1 vote
1 answer
1k views

ERC20 tokens in Metamask suddenly not showing

I've been using Metamask in Chrome for a while and had a list of ERC20 tokens in Ropsten network already added in the Assets section through their contract addresses: DAI address: ...
0 votes
2 answers
683 views

The use of ERC20 tokens in a private ethereum network

I am being told to use a private blockchain instead of the public one in an attempt to cut gas costs. But I was hit with the problem of the value of ether and tokens in this private blockchain. I am ...
0 votes
1 answer
743 views

How can I remove custom spending cap on Metamask?

When I call the approve function of the ERC20 token standard, it asks me to set a custom spending cap, as shown below. But I need to use the default value every time without clicking "use ...
0 votes
1 answer
13 views

How to you write tests for the transferFrom function for my ICO contract?

I want to write a test for the transferFrom(). I'm doing it by checking that the address balances change after the function is called. When I run the test, I get the error below. It's caused by the ...
10 votes
2 answers
5k views

What address(0) stands for?

In the contract for EOS crowdsale: https://etherscan.io/address/0xd0a6e6c54dbc68db5db3a091b171a77407ff7ccf#code line 469: assert(address(EOS) == address(0)); "assert" will test if both sides of ...
1 vote
1 answer
33 views

Does uniswap have ONE liquidity pool per pair?

I'm trying to understand whether Uniswap has one liquidity pool per pair, or multiple liquidity pools per pair, each with slightly differing ratios? Of course the ratios couldn't differ significantly, ...
3 votes
3 answers
7k views

how to implement an airdrop function inside a smart contract

I have a Erc20 token X and an Smart Contract A Smart Contract A contains 1000 X Tokens. How can an User get an defined amount of X Tokens from this Smart Contract? (something like an Airdrop) So ...
0 votes
0 answers
14 views

Bscscan Verification Error

https://bscscan.com/address/0xd9fe39eb244f5516613d1ee1c76cddbe473085fd#code Although my TokenFactoryDef contract is verified, the contracts created under it are unverified and I cannot verify it ...
0 votes
1 answer
216 views

FX6 and "ERC-20 Block Link Fee" or My Funds are being held Hostage

I was "tricked" into using FX6/Sundell, but that is a story for another thread. I was able to move my funds out of FX6/Sundell into my Coinbase Wallet. But, it appears FX6/Sundell were able ...
1 vote
2 answers
737 views

Determine number of holders in solidity

I saw a lot of questions over the internet on how to determine the number of token holders in solidity and everybody says that its impossible to be determined without interacting with a solution that ...
9 votes
2 answers
25k views

How can i transfer ERC20 tokens from a contract to an user account?

I have deployed an ERC20 token (contract A) and the tokens are being used for a service in my other contract (Contract B). I can easily transfer tokens from an user owned account(EOA) to Contract B ...
0 votes
1 answer
295 views

I need to know how to set a maximum buy limit per wallet

Yeah so I'm creating a eth token and I need to find a way that buyer have a purchasable maximum limit. Can anybody help me with that ? Can't find answer thanks a lot.
2 votes
2 answers
114 views

Which specific operations can explain ERC-20 "transfer" gas cost differences?

I would like to understand the rather large difference in gas costs of transfer operations of the same ERC-20 token. I know that all ETH transactions cost 21000 gas, and I know that all ERC-20 ...
0 votes
1 answer
41 views

npx hardhat run --network localhost .\scripts\2_seed-exchange.js

This is the error PS C:\pr0\token-exchange> npx hardhat run --network localhost .\scripts\2_seed-exchange.js Using chainId: 31337 Dapp Token fetched: 0x5FbDB2315678afecb367f032d93F642f64180aa3 ...
0 votes
1 answer
276 views

How to use web3 to send an ERC-20 token to a contract function

I know how to use web3 to send USDC tokens from one address to another, by using "web3.eth.Contract (ContractABI, ContractAddress) to create a Contract object, and then creating a data object ...
1 vote
1 answer
26 views

Would always keeping a non-zero amount of every relevant ERC-20 token lower transaction costs over time?

There is a Smart Contract call called SSTORE (See ETH Yellow Paper page 27: https://ethereum.github.io/yellowpaper/paper.pdf). It costs 20000 gas if a zero byte is set to a non-zero byte. It costs ...
0 votes
1 answer
26 views

How to know the exact AMM implementation for a liquidity pool?

Is every liquidity pool which uses Uniswap V2 using the exact same AMM implementation? i.e. for 2 different liquidity pools, if I know the amount of liquidity (ratio of tokenA and tokenB) in the pool ...
3 votes
2 answers
3k views

Constantly getting "Gas estimation failed" error when attempting to deploy ERC20 Token contract on Rinkeby testnet

I have included the code for the contract below. The error I get when attempting to deploy in remix via metamask is: Gas estimation errored with the following message (see below). The transaction ...
3 votes
1 answer
293 views

How to use enums for conditions on constructor?

I am learning to code with solidity. need help to solve this I have a membership system where users can have basic, gold, diamond membership types. Users can use coupons every 5 minutes and for basic ...
0 votes
1 answer
42 views

How to query ERC20 token transfers?

I want to query all in- and outcoming transactions for a given address. To do this I used the etherscanProvider.getHistory method. However f.e. this address AddrTo = ...
0 votes
0 answers
13 views

Is it possible to transfer Native-eth from wallet A to wallet B and transfer some erc20 token from wallet B to Wallet A in a single transaction?

Is it possible to transfer Native-eth from wallet A to wallet B and transfer some erc20 token from wallet B to Wallet A in a single transaction? Because Wallet B has zero native-eth and some some ...
0 votes
0 answers
13 views

Scammy _transfer method of ERC-20 token

function _transfer(address from, address to, uint256 amount) private { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer ...
0 votes
2 answers
445 views

ERC20 How to transfer the balance to a new address

I want to call the ERC20 contract with other contracts and transfer the corresponding balance to the contract caller. What should I do?
0 votes
1 answer
345 views

How can i make a simple chartjs chart with ethereum contract address

i would like to have a chart on my site that prints the last price of a certain erc20 token i have seen a widget from ethplorer but i rather build my own chart but i cant find any documentation for ...
3 votes
2 answers
4k views

ParserError: Source "@openzeppelin/contracts/token/ERC20/ERC20.sol" not found:

I keep getting this error, would be really cool to get help. I've heard that I need to install a program, forgot which but I'm not so sure that's a great idea to start with and is not the fix to this ...

1
2
3 4 5
50