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

If a function calls another contract function that throws, will the initial function throw as well?

If I call a function in another contract that doesn't return a boolean, but has throw() invariant checks, is it safe to assume the function finished properly if the transaction isn't reverted? I ask ...
1 vote
3 answers
881 views

How to get the Total Number of Tokenholders of ERC20 tokens?

Is there any simple API or datafeeds where I can just get the total number of tokenholders of ERC20 tokens?
0 votes
1 answer
33 views

Is it best practice to check the token balance when withdrawing ERC20 tokens from a contract?

A smart contract which stores ERC20 tokens. When withdrawing an amount from the contract I found examples of checking the token balance before making the transfer: IERC20 token = IERC20(tokenAddress); ...
3 votes
2 answers
4k views

Fetch ERC20 Token Balance for given address using Web3 Python

I’m desperately looking for a method that allows me to retrieve all token owned by a wallet using python. I should insert the wallet address as I put and the code should return the list of the token ...
3 votes
1 answer
1k views

Passing one contract instance as an argument to the constructor of another contract

I need to use the functions of the ERC20 contract in another contract. The ERC20 contract is from the openZeppelin contract library. I found the following code on a website: import "../../...
1 vote
2 answers
1k views

Managing ERC20 tokens with a multisignature address

Say I have the following: Address A belongs to me and holds 10 ERC20 tokens, but does not hold any ETH Address B belongs to somebody else and I need to send 10 ERC20 tokens there from address A ...
0 votes
1 answer
315 views

Total Supply reading in as zero for deployed Ether Token contract

i am kind of new to solidity development and while following up this https://www.youtube.com/watch?v=XyoFT4QkoL4 tutorial by DAPP University on how to make your own ERC-20 Token, I ran into some ...
2 votes
1 answer
408 views

How to add my token to external exchange

I am planning to launch one ICO and before that I am checking how to list my coin in external exchange? If anybody knows please help here What are the mandatory things I have to consider
0 votes
1 answer
17 views

get_total_transfer(tx_hash, receipt) function to compute the total amount transferred for each token involved in an Ethereum transaction

How can I implement the get_total_transfer(tx_hash, receipt) function to compute the total amount transferred for each token involved in an Ethereum transaction (tx), using transaction data and ...
1 vote
1 answer
422 views

Cannot call ERC20 mint function from another contract's payable function

Scenario: Contract A is a contract that sells ERC20 tokens Specified in Contract A using Open Zeppelin's ERC20 implementation. Contract A has a payable function that receives ether from a caller, as ...
0 votes
1 answer
10 views

ERC20 test with chai issue

Here is my test code: it("Should fail if sender doesn't have enough tokens", async function () { const initialOwnerBalance = await BitCoinV20.balanceOf(owner.address); // Try to send ...
1 vote
2 answers
780 views

Prevent Transfer of ERC20 token to contract address?

I want my ERC20 contract to be transferred to EOA addresses only and some specific contract address only. I don't want to lose my tokens by mistakenly transferring to a contract address that cannot ...
0 votes
1 answer
910 views

How to interact with mainnet smart contracts by GOlang?

Please tell me an example of code in GOlang that connects to the contract and checks the balance of the ERC20 token / transfer tokens / gets the name of the token. I looked for examples and did not ...
0 votes
1 answer
339 views

Metamask false positive error: ERC20 transferFrom tx displays "Exception thrown" error in metamask, but tx confirms fine

I'm fairly certainly this is due to approvals- that metamask thinks that an error will be thrown because the contract does not have approval to transfer the ERC20- even though the approval tx is ...
0 votes
1 answer
339 views

ERC20 Network Fee

I have tried to withdraw 544K from my coinbase wallet, using ERc20, counbade is telling me that my withdraw amount caused the ERC20 Network to get congested, and it also triggered a fee of 20% fee on ...
0 votes
1 answer
3k 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 "@...
2 votes
1 answer
2k views

0x0000000000000000000000000000000000000000 address behaviour

I have a question about the possibly strange behaviours of address: 0x0000000000000000000000000000000000000000 We know that: ETH + ERC20 tokens sent there are burnt Upon creation of a new smart ...
0 votes
1 answer
465 views

How to get contract address with truffle?

The token .sol: // ---------------------------------------------------------------------------- // '0xBitcoin Token' contract // Mineable ERC20 Token using Proof Of Work // // Symbol : 0xBTC // ...
0 votes
1 answer
316 views

I can't deploy my Upgradeable contract using truffle plugins

I'm trying to deploy the following smart contract: // SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; ...
0 votes
4 answers
543 views

Use custom ERC20 addresses

I am pretty new to the Ethereum and ERC20. I am willing to create an ERC20 token. I see that ERC 20 tokens can be transacted using the Ethereum addresses. However, I am wondering if it is possible to ...
0 votes
1 answer
17 views

Why don't tokens use a standard transaction method (blockchain)?

If a token is a coin already created on the basis of some existing blockchain (let’s take Ethereum for example), then why does tokens need smart contracts? Why don’t they use regular transactions like ...
0 votes
3 answers
227 views

Upgrade ERC20 Onchain without hardhat with UUPS Proxy

I have a token governance token: import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol&...
1 vote
1 answer
897 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 ...
1 vote
1 answer
399 views

Web3JS: How to Identify that a given transaction was send with either "ERC Token" or "Ether" in value

I'm working on a Smart Contract and it almost ready. To watch transactions I'm using web2js on my server and its working fine. But from a transaction detail how I get confirm that given transaction ...
0 votes
0 answers
9 views

Governance execute proposal of the governance contract itself or any other contract or restrict functions to come from a proposal only in the erc20

Is it possible to have a proposal that executes a function from the governance contract itself? namely i would like to have every expense of the dao to come from a proposal. does the target have to be ...
0 votes
1 answer
20 views

How to restrict access to a public mint function to only to users to who have completed certain tasks (eg., tap and earn )

I have written an ERC20 smart contract where I have a onlyOwner mint function where only the owner is allowed to mint tokens and I also have a public mint function where users can able to mint ...
0 votes
1 answer
336 views

How to deploy string variable of solidly code in hardhat

In order to deploy a contract, we fetch the smart contract file with hardhat and then deploy it: const Token = await ethers.getContractFactory("Token"); const hardhatToken = await Token....
1 vote
1 answer
1k views

Getting correct decimals in ethers.io library, using getAmountsOut() ABI

I am using the getAmountsOut() interface to get the current PancakeSwap price of a random BSC token that has 9 decimals in its smart contract, see https://bscscan.com/token/...
1 vote
2 answers
331 views

function approveAndCall error

I creat token contract using remix. The function approveAndCall code is following. function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { ...
5 votes
2 answers
6k views

How to use ecrecover() and what it is?

It’s a simple question, but I couldn’t find an answer. In an ERC20 contract lies this code //The nonce for avoid transfer replay attacks mapping(address => uint256) nonces; . uint256 nonce = ...
0 votes
0 answers
20 views

tax in token result ds-math-sub-underflow

function swapTokenForFund(uint256 tokenAmount) private lockTheSwap { emit LogTaxWalletBalance(_balances[address(this)]); address[] memory path = new address[](2); path[0] = ...
1 vote
1 answer
484 views

Multiple timelocks on wallets in contract

I am developing an ERC20 token which needs to have a timelock on a certain wallet that unlocks a certain amount of tokens every month. I am currently using the openzeppelin function: function ...
0 votes
2 answers
987 views

Message Signing using MyCrypto and MyEtherWallet

I am trying to update my Token information and it is asking me to sign the message using either MyCrypto and MyEther Wallet and proceed. Unfortunately tried both and both of them are not creating ...
0 votes
1 answer
1k views

Opensea - To first time sell I need to sign messeage & Sign a message using your wallet to continue but it shows error afterwards [Picture shown]

This is my first time selling and it says that I need to "sign message" shown here. I did that but I got the error is shown below instead of approval: Any advice on how I can fix this issue ...
1 vote
1 answer
791 views

How to add ERC-20 symbol and logo to UniSwap?

We’ve created an erc-20 token and deployed it on Eth mainnet and listed plus added liquidity and received the LP’s on UniSwap. At the moment, on UniSwap, we can only search for the token by its 0x... ...
0 votes
2 answers
878 views

function depositTokens doesnt work in remix ethereum , please help

error in remix: Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending? Internal JSON-RPC error. { "code": 3, ...
0 votes
1 answer
330 views

Why UniswapV3 calls `_approve` in permit function?

As far as I know, permit function is implemented to avoid calling approve function before calling the transferFrom. That way instead of calling two functions for transfer, we would call only one ...
1 vote
1 answer
929 views

How to add a donation function in a smart contract

How would I add a donation function to this type of smart contract https://etherscan.io/address/0x39E5BD6AE0f2aA9240D2ae7fBF49e36F05dd339F#code Basically, what I would like to do is have a small fee ...
0 votes
1 answer
464 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
13 views

ParserError: Source Not Found Despite Correct Path

I'm encountering a ParserError when trying to compile my Solidity contract. The error indicates that the specified path is not found, even though I believe the paths are correct. Error message:...
1 vote
1 answer
328 views

Get balance of each erc20 permit supported token

I am trying to get the balance of each permit supported token with web3.js. Do I need to write each token down and iterate trough them? If yes, how can I manage to get this. Here is my code to get the ...
0 votes
1 answer
706 views

ERC20 token, override functions but state variable do not update as expected

I am trying to implement and test an ERC20 token by inheriting from ERC20.sol from OpenZeppelin. I want most of the functions to be by default from OpenZeppelin but I also want to overrride some of ...
0 votes
1 answer
776 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 ...
0 votes
2 answers
2k views

Help on transferFrom and Approve functions

We have a token contract A and an Escrow contract B. While transferring token from an address to contract B we are using transferFrom function which overridden from contract A. But in need to do the ...
1 vote
1 answer
727 views

Error Transaction revert / no balance but Balance is there

contract MyToken is ERC20 { constructor () ERC20("StableToken", "STBL") public { // Mint 100 tokens to msg.sender // Similar to how /...
1 vote
0 answers
28 views

Smart-contract works on local node and Sepolia but not Polygon Amoy

I have an ERC20 Token that I'm testing and I'd like to deploy on Polygon PoS. I deployed it on Polygon Amoy and for example, every time I call the approve method, my transaction fail. I then tested to ...
1 vote
2 answers
867 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
1 answer
544 views

Transfer ERC20 token in mainnet with web3js(succeed in ropsten, failed in mainnet)

I want to transfer some ERC20 tokens in ethereum. I did some preparation work and tried in ropsten, it succeed. Then I changed the used api, wallet address, httpProvicer, contract address, and ran the ...
0 votes
2 answers
1k views

Truffle Test AssertionError: error message must contain revert

I can't figure out why this error occurs Here my test js code: var YarockToken = artifacts.require("./YarockToken.sol"); contract('YarockToken', function(accounts) { var tokenInstance; ...
1 vote
1 answer
28 views

Help Needed: Resolving "EIP2612: Invalid Signature"

I am encountering an error message "EIP2612: invalid signature" when testing the permit function in my contract. This is my contract: // @inheritdoc IPayments contract Payments is IPayments {...

1
2 3 4 5
52