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

Liquidity removal strategy ERC 20 UniswapV2 (max tx)

I deployed a token a few months ago, provided liquidity (1 ETH), locked liquidity, and renounced to the ownership. The specifics of the contract are: 1,000,000,000 supply 20,000,000 tokens max tx 5% ...
1 vote
1 answer
42 views

What is minting ERC20 in Uniswap v3 contract?

I have been deep-diving Uniswap V3 and I came across this code example: pragma solidity ^0.5.0; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/...
  • 1,330
0 votes
1 answer
96 views

Is there a way to attach a "memo" to an ERC-20 `approve` transaction

I know that an ERC-20 approve method has only 2 parameters: sender and amount. I'd like to get an extra hash recorded on chain with the approval, so I can test it later when coming to process ...
0 votes
1 answer
186 views

Differences between transferFrom and safeTransferFrom

What are the consequences of using "safeTransferFrom" for ERC20 instead of "transferFrom"?
0 votes
2 answers
277 views

Error encountered during contract execution [invalid opcode: INVALID]

I was using Web3.py to send Tether from address A to B: w3 = Web3(Web3.HTTPProvider('https://mainnet.infura.io/v3/REDACTED')) teth = '0xdAC17F958D2ee523a2206206994597C13D831ec7' # ...
  • 1
0 votes
1 answer
187 views

How to get v,r,s value for permit() signed token approval for a gnosis-safe as the owner?

I have a gnosis-safe and an ERC-20 contract with permit(owner, spender, value, deadline, v, r, s) method that requires v,r,s of the owner as the argument. I have calculated the required v,r,s value ...
0 votes
1 answer
785 views

Getting the "Fail with error 'ERC20: transfer amount exceeds allowance'" error when depositing to a smart contract through a function

I am developing an Ethereum smart contract where I want to deposit an ERC 20 token to. It seems that I can deposit it directly by sending the token from MetaMask to the contract address, but I also ...
  • 3
1 vote
1 answer
183 views

Usage of transfer Instead of safeTransfer

It is recommended to use safeTransfer instead of transfer. But I do not understand if it applies to all tokens even the ones that isn't an(other) ERC20 token. After reading more about safeERC20 my ...
0 votes
2 answers
90 views

When address A approves a contract S to spend X ERC20 tokens from it, can anyone invoke that spend, or just address A?

Assuming standard flow of events User, who is owner of address A approves to spend X ERC20 tokens, using approve method to a smart-contract S from address A. Then, user calls S to spend that amount X ...
0 votes
2 answers
127 views

How do I set an image for ERC20 tokens on Etherscan?

The picture above is an example. I want to set an image on the ERC20 token I created and display it on the Explorer page. Can anyone tell me how to set it up?
  • 189
0 votes
1 answer
19 views

Declaration Error when defining function to return token name

I am trying to create an ERC20 contract. Below is my code for it. pragma solidity ^0.8.0; contract ERC20Interface { mapping(address => uint256) private _balances; mapping(address => mapping(...
  • 1
0 votes
0 answers
141 views

Cannot Estimate Gas | Why am I getting this error?

I am trying to set up a marketplace where I will sell with my own erc20 token. But whenever the following function works, it returns this error to me on the client side. Error: cannot estimate gas; ...
  • 3
4 votes
2 answers
233 views

Different compiler versions of solidity don't match?

I am currently using the 'Hardhat documentation' to use a correct solidity compiler version, but while precisely compiling my file.sol with pragma solidity ^0.6.0, I am still getting an error: module....
  • 55
0 votes
2 answers
143 views

How can I list all ERC20 transfers to a specific ETH address?

I'm trying to pull up a list of all incoming transfers to an ETH address. The research I've done seems to indicate this can be done via etherscan using the logs module. (https://docs.etherscan.io/api-...
0 votes
1 answer
82 views

Uniswap's swapExactTokensForTokensSupportingFeeOnTransferTokens gives "transfer amount exceeds allowance" error

I am experimenting with Uniswap's swapExactTokensForTokensSupportingFeeOnTransferTokens method by attempting to swap USDC -> WETH -> UNI-v2 using ethers.js just for the sake of understanding ...
0 votes
1 answer
35 views

Does the 0x00 address has some amount of any ERC20 token? Want to simulate

I want to be able to generate txid simulations on a forked blockchain programmatically, with the only details being known to the program are the functions to be executed. This will be used for ...
0 votes
1 answer
103 views

revert SafeERC20: low-level call failed

SIO2 is aave v2 foked version on Astar chain. I want to execute flash loan on it and have the following code: function myFlashLoanCall() public returns (bool){ address receiverAddress = ...
0 votes
0 answers
23 views

What is preferred/recommended way to handle ethereum contract events in spring boot?

What is the appropriate way to handle live events (i.e. service/component should keep on listening to events and save it to offchain db (h2/postgres)) How to close event subscription gracefully? ...
  • 35
0 votes
1 answer
14 views

I have a problem with tis array of struct please help me create a tag also

struct people { uint256 favouriteNumber; string name; // now we have a new type of people, } //and the much better way to create a list of people is to add a data structure called an ARRAY of struct //...
  • 1
1 vote
1 answer
95 views

getContract from forked testnet

when I run hardhat on forked testnet and try to run test script that includes dai = await ethers.getContractAt("IERC20", DAI) I get this error: NomicLabsHardhatPluginError: ...
  • 113
2 votes
1 answer
213 views

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

I'm looking into Uniswap V2 code and found that it uses _safeTransfer function to transfer ERC20 tokens in the Pair contract. function _safeTransfer(address token, address to, uint value) private {...
  • 137
0 votes
0 answers
32 views

swap 2 erc20 with each other at one method between 2 different user. -- Reentrancy guard problem

I know I have to use nonReentrant modifier for this method, but I also know it's wont work can someone tell me what should I do to create a mechanism something like this with safe pattern? function ...
0 votes
1 answer
97 views

Why is from balance and require check not within unchecked function in latest open zeppelin erc20 transfer?

If it is not possible to over/underflow in this transfer due to a check at the mint function, then why are these 2 lines (236/237) not within the unchecked field? https://github.com/OpenZeppelin/...
  • 172
0 votes
1 answer
39 views

Minting an ERC20 from another non-ERC20 contract

I am trying to build a contract that mints different LP tokens to represent positions in liquidity pools. My main contract creates instances of my lpToken contract (an ERC20) and stores them in a list ...
0 votes
1 answer
41 views

How to transfer an ERC20 token to a smart contract w/o directly calling token.transfer?

I've an ERC20 token: // SPDX-License-Identifier: MIT pragma solidity ^0.8.9; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; contract Token is ERC20 { constructor(string ...
0 votes
0 answers
121 views

Tracking all ERC20 token transfers without using the event logs

I'm currently using the geth implementation. The problem is currently I am tracking erc20 token transfers using purely the erc20 contract event logs and filtering for Transfer event, then saving that ...
  • 1
0 votes
1 answer
30 views

How to automaticly burn erc-20 tokens after 1 month

Im working on a code to automaticly burn tokens after 1 month, is this even possible and if so how can i do this? Kind regards, Murk
  • 1
0 votes
1 answer
67 views

How to distinguish `approve` methods in ERC20 and ERC721

In my app, I need to parse user transaction data and show users what's going on. Now the problem is, ERC20 and ERC721 both have an approve method, even with the same interface: approve(address,uint256)...
  • 109
0 votes
2 answers
42 views

What happens if `transferFrom` fails after `approve` (Risk of remaining allowance)

I'm trying to call Uniswap V2 addLiquidity function, which calls transferFrom internally, and therefore approve must be called beforehand. I would like to do it from a TypeScript code. In that case, ...
  • 137
0 votes
1 answer
118 views

ERC20 - Bad overwrite of _beforeTokenTransfer() hook

I was reading that its posible to use hooks on ERC20 to implement new functionality without touch the original code. In this case im worried about why its necessary to add super call when you redefine ...
  • 3
0 votes
0 answers
6 views

Error when accessing swap/v1/quote

Getting error when try to access quote API. My API request is below https://api.0x.org/swap/v1/quote?sellToken=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2&buyToken=...
0 votes
1 answer
123 views

I'm trying to call a function from a deployed contract, But I'm getting the following error:

Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending? execution reverted: ERC20: insufficient allowance { "...
0 votes
0 answers
81 views

Explanation for payment logic in Uniswap FlashLoan example?

The code is here (see below): https://github.com/Uniswap/v2-periphery/blob/master/contracts/examples/ExampleFlashSwap.sol#L28 question1: to confirm, to transfer tokens, you have to first deposit into ...
  • 113
0 votes
2 answers
75 views

Gas Less ERC-20 Token Minting

How can I create ERC-20 token on Ethereum blockchain without paying gas fee using Remix.ethereum.org Please provide code to help I saw Zeroswap DEX allow us to trade without paying gas fee.
0 votes
0 answers
117 views

Permit for ERC-20 find v r s value using metamask

I want to create ERC-20 token on Ethereum Blockchain. MyToken use Permit function to send transaction without need to pay gas fee. I use code of Open Zeppelin Wizard and working on Remix.ethereum.org ...
0 votes
1 answer
360 views

Uniswap V3: quoteExactInputSingle throws an unexpected error for USDC-CVX but works fine for USDC-WETH

I am using quoteExactInputSingle to get the exchange amount output for different tokens, the implementation works fine for USDC-WETH pair, but not for USDC and CVX pair. When I am trying to get the ...
  • 117
0 votes
1 answer
65 views

it is possible to do ERC20 accept/transferFrom on a contract?

I'd like to be able to create a pool where users can deposit and withdraw ERC20 tokens. The caveat is that I don't have access to the assets in the pool but can only approve/reject the withdraw ...
  • 105
2 votes
2 answers
542 views

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

In openZeppelin's SafeERC20, the functions safeTransfer and safeTransferFrom call an internal function called _callOptionalReturn, which makes a low-level call to the token's transfer and transferFrom ...
0 votes
2 answers
357 views

How to override ERC20 _beforeTokenTransfer and _afterTokenTransfer functions if there is no need of this in my contract

I am trying to use openzepplin's ERC20 token and because of this two functions _beforeTokenTrandfer and _afterTokenTransfer I has to use abstract in my smart contract and because of abstract its not ...
  • 13
0 votes
0 answers
44 views

0x Protocol | Getting error when validating Order: execution reverted: Wrong trade direction

I'm trying to make an Sellorder to sell NFT's against ERC20 tokens. I can generate the r,s and v signatures, and the orderstatus is checking to true (logs "1" in the console). But when ...
  • 11
0 votes
1 answer
22 views

Q&A: Is it possible to mint many tokens by single call?

This part of own Q&A serial of posts which shares knowledge gained during work on one project I was curios about options we have to mint a token. Is it possible to mint many tokens by single call?
  • 380
0 votes
0 answers
27 views

Mint function is not working correctly in safemooon contract

I have implemented the mint function in safe moon contract, but it is getting marked on the owner's address and not the other address which I have passed. function _mint(address account, uint256 ...
0 votes
2 answers
39 views

Can an ERC20 Contract receive information from BEP20 contract?

are there a way for an ERC20 contract to receive information from a BEP20 smart contract ? i would appreciate any help or links to documents or articles that give some info about this subject.
  • 21
0 votes
0 answers
24 views

Detection of ERC20 tokens sent to Contract -?

I'm developing a game. Energy will be purchased with my own token. For example, to buy energy, you will use the "X" token you purchased earlier. It's like buying 1 energy for 1000 "X&...
  • 1
0 votes
0 answers
17 views

Security caveats upgrading ERC20 contracts

I have an ERC20 upgradeable contract using UUPS from OpenZeppelin and was curious about the security risks involved with upgrading the contract while transactions are occurring or while the contract ...
0 votes
0 answers
3 views

Need help with the code for Burn_fee and also need the code for putting a a time lock a percentage of tokens [duplicate]

If any one can send me the solidity functions for the 2 functions I would like my token to have I would apricate it greatly. I am making a token that has a burn_fee on sell transactions of 8% and a 2% ...
  • 1
0 votes
1 answer
80 views

Could someone explain me what are the importance of hooks in smart contracts?

I was studying the ERC20 token and came across the following hook- function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} But I ...
0 votes
0 answers
18 views

Getting chain name from transaction query

I'm trying to get the get a list of transactions a wallet has had with a specific chain. Initially I thought I could just filter by the contract address, but it seems like there are multiple chains ...
0 votes
2 answers
247 views

Deployed an ERC20 with Hardhat, trying to mint token but getting "TypeError: _mint is not a function"

A bit of messing around with Hardhat and ERC20 deployments. I've deployed a created and tried to mint tokens for an account using this small snippet of code: const ERC20 = await hre.ethers....
1 vote
1 answer
53 views

Is it possible to create a smart contract that recieve a specific BEP20 token from an address, and send it back same amount of an ERC20 token?

Is it possible to create a smart contract that receive a specific BEP20 token named X, from a wallet address, and send it back the same amount of a specific ERC20 token named Y ? of course the smart ...
  • 21

1 2 3
4
5
49