2022 Developer Survey is open! Take survey.

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
0 votes
0 answers
10 views

deposit ERC-20 tokens to smart contract during deployment

I am trying to deploy a staking smart contract that has its own internal reward pool for a token (PToken). The idea is that during deployment the deployer of the contract sends a certain amount of ...
user avatar
0 votes
0 answers
7 views

Is it possible to create Partitions in ERC20 security token

Am a beginner in Blockchain and learning writing smart contracts so do pardon me if question doesnt make sense as i have seen the ERC1400 security token and as per my findings Erc1400 looks better in ...
user avatar
0 votes
1 answer
16 views

Have a smart contract function call require a specific token be sent

I've found a few old posts that ask a similar question to this (see e.g. Requiring a specific type of token in smart contract) however i'm a bit confused how this relates to some other posts i've seen ...
user avatar
1 vote
2 answers
18 views

What is the difference between NFTs and a smart contract?

I am exploring a new domain and wanted to understand the difference between ERC721, ERC20, and a smart contract? ERC721 is "a standard for representing ownership of non-fungible tokens," but ...
user avatar
0 votes
1 answer
21 views

Transfer function not changing custom token(ERC20) balance after successful transfer from transfer function?

Transfer function not changing custom token(ERC20) balance after successful transfer from transfer function ? The transaction is successfully performed but the amount of custom token in my wallet does ...
user avatar
0 votes
0 answers
12 views

ERC721 transferring NFTs and currency

I have a contract that I want to use as an NFT marketplace. It extends ERC721URIStorage contract NftMarketplace is ERC721URIStorage ... In on function I use _transfer() to move an NFT from the seller ...
user avatar
0 votes
0 answers
6 views

Trouble deploying an ERC20 contract remix

Hi so some assistance would be greatly appreciated. I am able to successfully deploy my contract when my ether is set to 0. It will go through MM and everything looks solid. By the way I am using test ...
user avatar
  • 1
0 votes
0 answers
32 views

Depositing Weth ERC20 from Brownie into Aave Pool in contract

I am tying to do a simple deposit into an Aave V2 pool with Python Brownie and Solidity on a mainnet-fork but my transaction keeps getting reverted and I dont know why. In brownie, I call my function ...
user avatar
0 votes
0 answers
11 views

What is the preferred Inheritance for ERC20 token and why?

I tried to deploy both ERC20 contracts with burn functionality over the remix and both seems to work fine, I am confused if one way should be preferred over the other. Since, openzeppelin contract ...
user avatar
0 votes
0 answers
8 views

Ecommerce platform that accept my own cryptocurrency [closed]

I would like to build an ecommerce platform that accept my own currencies (e.g. XYZ minted using ERC20 standard). In other words, users can purchase items using XYZ coins. Can we use some off-the-...
user avatar
0 votes
0 answers
14 views

Metamask Invalid Amount error

I'm developing a game. And I'm trying to transfer a sample token that I've created in Remix (ERC20) on the Rinkeby testnet. Once the transfer function executes a drawer opens in my Metamask app (iOS) ...
user avatar
  • 1
1 vote
2 answers
61 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-...
user avatar
  • 11
0 votes
1 answer
15 views

Solidity: calling a imported contract's function without inheritance, Calling a imported contract interface and passing its implemented contract add

This is the error I'm getting, I'm trying to implement ERC20's _transfer function without inheritance, calling its Interface IERC20 and passing the ERC20 deployed contracts address and then calling ...
user avatar
0 votes
1 answer
8 views

build an abstract contract for user to claim erc20 tokens, encountered " insufficient allowance" error

My goal is to build an abstract contract and send a specific erc20 token into it so that others can claim the erc20token with merkletree validations. However I am having problem approving the contract ...
user avatar
0 votes
0 answers
4 views

create liquidity

if for example, I have 1000 total supply token I airdrop 300 before creating liquidity and I create liquidity with 500/1BNB so witch token gives a price does the airdrop token give a price?
user avatar
0 votes
2 answers
14 views

calling transfer of ERC20 token using call function is not working

I tried to make token transfer contract like this, contract TokenSender { function transferToken(address token1Address, address to, uint256 amount) external { (bool check, ) = ...
user avatar
0 votes
1 answer
17 views

Etherscan API get transaction status from getLogs api call

I am using the Etherscan API to get a list of ERC20 transfer events for a contract, that are relevant to my address: https://api.etherscan.io/api?module=logs&action=getLogs https://api.etherscan....
user avatar
0 votes
0 answers
13 views

How to code an approval function

Can someone help me with coding an approval function for Ether, if you could show methe most basic way to do this i would be able to figure out the rest thanks.
user avatar
0 votes
0 answers
8 views

Generate tokens(ERC20) based on NFTs traits

I have a contract that allows users to mint tokens(ERC20) based on certain NFTs( minted from a certain contract) owned by sender. At the moment user can mint 1 token/nft/day. User presses a "...
user avatar
  • 101
0 votes
0 answers
7 views

Can I use Crowdsale with ERC20 Token created in OZ4.5.0?

Basically, I already have ERC20 token created, which is using solidity 0.8.2 and OpenZeppelin version 4.5.0. I know that Crowdsales supports only OpenZeppelin Contracts 2.x version. I am not sure if I ...
user avatar
0 votes
1 answer
42 views

function selector was not recognized error

I'm extending OpenZeppelins ERC20 to create a Token that I use for testing in another smart contract. Here's how it looks: //SPDX-License-Identifier: Unlicense pragma solidity ^0.8.0; import "@...
user avatar
0 votes
2 answers
27 views

Sending ERC20s to a Contract on deployment

I'm trying to send an amount of ERC20 on Contract deploy to the contract itself. I'm using Hardhat and OpenZeppelin Contracts. Contract Code: //SPDX-License-Identifier: Unlicense pragma solidity ^0.8....
user avatar
0 votes
1 answer
21 views

How to cover the gas fees?

I want to create a solidity smart contract (ERC20) for a play to earn and I would like to know how to reward the winners without them having to pay gas fees when they claim their winnings. I think ...
user avatar
  • 103
0 votes
1 answer
27 views

Complicated ERC20 Arithmetic

I'm trying to compose a formula in Solidity that has a combination of unsigned integers, signed and exponents, however having a hard time figuring out how to do so. The formula would look something ...
user avatar
  • 101
0 votes
1 answer
12 views

Why this transaction succeeded to transfer more than its balance?

On BSC chain, this transaction is minting an NFT(MstToken). The evm trace shows it called MstToken.transferFrom(fromUser, ..., 0x30927f74c9de0000) to send out 0x30927f74c9de0000 token and it succeeded,...
user avatar
  • 183
1 vote
1 answer
23 views

How can I send erc20 tokens at once from MULTIPLE wallets to a single address?

I have a specific question. Is there any tool or wallet to manage multiple wallets and batch transfer tokens? Im not too familiar with contracts, so would prefer something easy to use with a UI https:/...
user avatar
  • 11
0 votes
0 answers
16 views

Permit failed into contract

This is contract doesn't work. Why? pragma solidity >=0.7.0 <0.9.0; interface IPancakeERC20 { function balanceOf(address owner) external view returns (uint); function transferFrom(...
user avatar
0 votes
1 answer
16 views

transfer vs transferFrom "amount exceeds allowance" when sender is the same as msg.sender

I know the reasons for using transfer vs transferFrom but made the mistake of using the second one whilst doing some testing and I got the error "ERC20: transfer amount exceeds allowance". ...
user avatar
0 votes
0 answers
7 views

How to create a front end page that requires owning X number of a specific ERC20 minted tokens

So I want to authenticate that a user owns a set number of ERC20 tokens in which I am the contract owner. so lets say i own contract for MyToken MTK I mint 200 MTKs for address A I mint 0 MTKs for ...
user avatar
0 votes
1 answer
70 views

How to buy NFTs from my smart contract with custom ERC20 token? [duplicate]

i want to launch a NFT genesis collection for all the holders of the previous collection. The previous collection gave the holders a ERC20 Token airdropped. So the holders have the custom ERC20 Token. ...
user avatar
0 votes
0 answers
22 views

Need help with buy and sell fee for erc20 contract

I've been looking into making my own token but I got stuck on implementing the buy and sell fees that's why I am here on stack exchange for help. the code I have at the moment should be okay but I'm ...
user avatar
0 votes
1 answer
16 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 ...
user avatar
  • 107
0 votes
1 answer
27 views

How do I get addresses of tokens held by a smart contract?

My contract receives various types of ERC20 tokens. I'd like to know the addresses of the ERC20 tokens within the contract. The addresses are compulsory since they are still used within the contract. ...
user avatar
  • 38
0 votes
1 answer
59 views

Handle exchanging 6 Decimal Token to 18 Decimal Token (eg. USDC to ERC20)

I am trying to learn Solidity and write a contract that accepts USDC for my token which has 18 decimals. I'm getting confused as how to treat the amount being sent when I buy my ERC20. eg. function ...
user avatar
  • 115
0 votes
1 answer
24 views

Referencing OpenZeppelin in Solidity Contract, working with Etherscan

I think I am making a simple mistake, but I have been stuck for a while. I have a simple ERC-20 contract which I have publish on the Ethereum Mainnet and others on Polygon. This is a sample contract ...
user avatar
0 votes
0 answers
17 views

How to query all erc-20 contract addresses

Is there an easy way to search the chain (or maybe an off-chain source) for a list of all erc-20 tokens? Similar to how etherscan did it here
user avatar
0 votes
2 answers
29 views

Why ERC-20 interface uses uint256 while Uniswap router uint?

ERC-20 token interface functions like balanceOf, allowance returns an uint256. While the functions of the Uniswap router interface take uint for the token amounts and returns uint[] in some cases. My ...
user avatar
  • 63
0 votes
1 answer
13 views

VSC linter: Should be marked as Abstract

Can someone explain why contract ERC20_V1 is ERC20_STD, Ownership is being flagged inside of VSC with a warning of Contract "ERC20_V1" should be marked as abstract? I was under the ...
user avatar
  • 107
0 votes
1 answer
24 views

How can i resolve this Remix compilation error "TypeError: Invalid array length, expected integer literal or constant expression & Data location "

Here are the errors i'm getting with the code all coming from balanceOf function: TypeError: Data location must be "memory" or "calldata" for parameter in function, but none was ...
user avatar
0 votes
1 answer
16 views

How can i resolve this Remix compilation errors "TypeError: Invalid array length, expected integer literal or constant expression & Data location "

Here are the errors i'm getting with the code all coming from balanceOf function: Errors: TypeError: Data location must be "memory" or "calldata" for parameter in function, but ...
user avatar
0 votes
0 answers
23 views

How do I write redistribution and reflection based tokens using Vyper?

I'm writing a redistribution of reflection based tokens using Vyper, I've added a _swapTokensForETH function to my code which acts to swap my coins for DAI via Uniswap, if I'm only doing transfer ...
user avatar
  • 11
0 votes
0 answers
24 views

Minting a NFT using multiple tokens

I have two Tokens: Token A & Token B I want to make an NFT contract in which the user can choose to mint the NFT using either one of the two tokens or in ethers like: 0.05 ether or 10 Token A or 5 ...
user avatar
  • 5
0 votes
0 answers
20 views

Is there a way to prevent web3.eth.Contract being hacked/manipulated using from Dev Tool?

When I try to send a contract to make a custom token transfer It can get hacked using Dev Tools. Anyone can hack by going to the dev tools and can manipulate the contract address from javascript in ...
user avatar
0 votes
1 answer
97 views

Unable to get ERC20 token approval to accept BUSD

I've tried almost every tutorial and help available online trying to accept BUSD or any ERC20 token in my solidity smart contract. I'm deploying the contract on Binance Testnet and I have 20 BUSD in ...
user avatar
0 votes
0 answers
11 views

Trace back an ERC20 token back to its minter

I am creating an ERC20 token. Lets assume once I mint these tokens I transfer them to some buyers. Say, token 1 is minted and transferred to user 1. Again, from user 1 to user 2 and so on to user n. ...
user avatar
0 votes
1 answer
39 views

How to swap two custom ERC20 token using uniswap v2 routes?

Hi I am trying to swap my custom ERC20 token with my other custom-created ERC20 token but I am facing an issue, Every other function is working fine except the swapTokens function. When I am trying to ...
user avatar
  • 72
0 votes
1 answer
30 views

Why are we using payable modifiers in both the ERC20 transferFrom and approve functions?

Why are we using payable modifiers in the ERC20 functions below? function transferFrom(address _from, address _to, uint256 _tokenId) external **payable** { require (zombieToOwner[_tokenId] == msg....
user avatar
0 votes
1 answer
13 views

Questions on mapping command in ERC20 contracts

This is a part of ERC20.sol of OpenZeppelin contract. mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; I am learning ...
user avatar
0 votes
0 answers
16 views

Should ether be stored(in Proxy or Implmentation) if your Upgradeable contract is making a call to some ERC20 token contract?

I have made a contract(say MYNFT contract) which is upgradeable. Now I have a proxy contract and implementation contract (MYNFT contract). In Implementation, an user can mint a NFT if the user wires ...
user avatar
0 votes
0 answers
21 views

Pay gas fee using ERC 20 token instead eth [duplicate]

The problem is that anyone who does a transaction needs to have ETH to pay for gas fees. This forces new users to purchase ETH (or get it from a faucet if it's on the testnet) before they can start ...
user avatar
  • 1

1
2 3 4 5
45