New answers tagged

0 votes

i am getting attribute error while running erc20 brownie project on rinkeby testnet

You should post your source code and the main error, not the whole console output without source code. That being said, the error: AttributeError: Final argument must be a dict of transaction ...
user avatar
0 votes

Transfer ERC 20 tokens from a wallet which has no eth

Send your eth to wallet-A. wallet-A without any gas can't do anything but read.
user avatar
  • 104
0 votes

Get Token Balance of Address at Particular Block Number with Alchemy

We've released a new and updated version on how to get token balances that specifically includes the block number parameter as well. Check it out https://chainstack.com/ultimate-guide-erc20-token-...
user avatar
  • 51
1 vote
Accepted

Is it possible? send ERC20 token from user to user, but server pays gas fee

To begin with, there is no trivial way to achieve this. All of the options are a bit advanced. Using transferFrom requires the token owner to give allowance to withdraw the tokens, and usually giving ...
user avatar
0 votes
Accepted

Can an upgradeable token appear in the asset list?

Credit to the Gnosis team on Discord for this answer to my question: It turns out that a token with an empty name and symbol will not be displayed in the asset list on Gnosis. The contract given in ...
user avatar
  • 101
1 vote

Web3 Chainstack Guide to Batch Transactions gives Error: This contract object doesn't have address set yet, please set an address first

new versions of web3js have been released with changes in the API so you have to make sure to run the code in the article with the specific versions. On the other hand, we've released an updated ...
user avatar
  • 316
0 votes

ProviderError: Error: Transaction reverted: function selector was not recognized and there's no fallback function

I got this error when running this on the hardhat network. Once I switched to a real network like kovan it worked. If you're hitting this error try running against a real network.
user avatar
0 votes
Accepted

How IncreaseAllowance and DecreaseAllowance function solve mitgation problem?

If you follow the links you'll end up to the description of the vulnerability: https://docs.google.com/document/d/1YLPtQxZu1UAvO9cZ1O2RPXBbT0mooh4DYKjA_jp-RLM/edit . Basically an attacker (the one who ...
user avatar
0 votes

How IncreaseAllowance and DecreaseAllowance function solve mitgation problem?

In mitigation problem , If suppose Alice allows Bob to transfer N ERC20 tokens , initially and then changes want to change it to M. Then Bob can transfer N+ M Tokens , but using increaseAllowance or ...
user avatar
  • 21
0 votes

execution reverted: "ERC20: insufficient allowance" on transfer method (not transferFrom)

Have you checked balanceOf() with address of smart contract? Does it show any balance? Also, I don't understand why are you writing IERC20 token = IERC20(tokenAddress); You have already ...
user avatar
0 votes

How to send ERC20 token to another account using web3.py, rinkeby and infura

Here is a tutorial on how to transfer ERC-20 tokens using web3.py. It is using web3-ethereum-defi library for token helpers. import datetime import os import sys from decimal import Decimal from ...
user avatar
0 votes
Accepted

Ethers.js: Error when calling symbol() on Maker (MKR) contract but no problem for other ERC-20 token contracts

The Maker token does not implement the optional parameters symbol and name as proposed by EIP-20: As you can see here, Maker uses bytes32 for symbol and name. , where in the case of EIP-20 they are ...
user avatar
  • 135
0 votes
Accepted

Flashloan Arbitrage error 'SafeERC20: low-level call failed'

So I figured it out theIERC20 token; part of the smart contract had nothing to refer to so I wasn't approving anything
user avatar
  • 107
0 votes

Escrow.sol: The called function should be payable if you send value and the value you send should be less than your current balance

After several trying, I combined the sol from @Kerry99 and my original code, and it works perfectly! the func approve() has been overriden. contract MyEscrow { mapping(address => mapping(...
user avatar
  • 51
1 vote

Escrow.sol: The called function should be payable if you send value and the value you send should be less than your current balance

Your MyEscrow smart contract have any issues, let me explain them: When you declare this statement MyToken token; like storage variable, you must instantiate it with the erc20's smart contact address ...
user avatar
  • 1,528
1 vote

Can an upgradeable token appear in the asset list?

I suspect you are right that the reason is that your proxy contract is not an ERC20 contract. Since you are using OpenZeppelin upradeability, your proxy contract doesn't expose the methods of an ERC20 ...
user avatar
  • 11
0 votes

What address(0) stands for?

Typically, address(0) indicates an unknown/anonymous address where you would send to burn the tokens.
user avatar
1 vote

How to make a transaction to wait until the first one get mined in React

Referring to https://web3js.readthedocs.io/en/v1.2.11/web3-eth-contract.html?highlight=transactionHash#id36 If you would like to wait until its mined you should use on 'receipt' or 'confirmation'. ...
user avatar
2 votes

Can an upgradeable token appear in the asset list?

Gnosis Safe works with any ERC-20 token, including proxy tokens. There must be some other problem that is not obvious from your question as it lacks Method how you test with your token with Gnosis ...
user avatar
0 votes
Accepted

Different gas amount for erc20 Transfer functions

Probably you are transferring tokens to an address which previously had a balance of zero In order to understand the difference you should know the gas cost of the following operations: Gsset 20000 ...
user avatar
1 vote

How do you approve + transfer ERC20 tokens in 1 transaction?

ERC777 might help. "The tokensReceived hook allows to send tokens to a contract and notify it in a single transaction, unlike ERC-20 which requires a double call (approve/transferFrom) to ...
user avatar
  • 11
0 votes

How to change balances from another contract?

You can't directly access the functions of another contract. As you have defined the interface and functions of your second contract you have to instantiate an object or reference to that second ...
user avatar
0 votes

How do I send my custom erc20 token from ethreum to arbitrum?

If your token does not exist on arbitrum testate and you send your tokens from ethereum, then arbitrum would first deploy the smart contract associated to the token and then transfers it to your ...
user avatar
0 votes

Smart contract is not available on the blockchain during the constructor call

it does'nt make any point of using IERC20 token = IERC20(address(this));, This can be only use where you use interface.
user avatar
  • 13
1 vote

Smart contract is not available on the blockchain during the constructor call

If I modify the contract as follows: // SPDX-License-Identifier: MIT pragma solidity ^0.8.7; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/token/ERC20/...
user avatar
0 votes

How to get my ERC20 token listed on Metamask

I'm guessing Metamask is using some sort of Popular Tokens lists from Coinmarketcap or Coingecko APIs. If you want to appear there you probably need to be a high market cap token. Edit: Actually they ...
user avatar
  • 49
1 vote

How to get my ERC20 token listed on Metamask

There's an example of how to do this on MetaMask's website - const tokenAddress = '0xd00981105e61274c8a5cd5a88fe7e037d935b513'; const tokenSymbol = 'TUT'; const tokenDecimals = 18; const tokenImage = '...
user avatar
  • 2,435
0 votes

Convert contract ETH to WETH via function call

did you make sure you are the using the functions correctly? "Note: Do NOT send WETH tokens back to the WETH contract. They will be stuck there, and that isn't the way to get them refunded back ...
user avatar
  • 1
0 votes

What is the preferred Inheritance for ERC20 token and why?

ERC20Burnable inherits ERC20 contract so both ways are same. https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/extensions/ERC20Burnable.sol Inheriting ERC20 ...
user avatar
0 votes

What is the preferred Inheritance for ERC20 token and why?

Found this openzeppelin's discussion openzeppelin-contracts github discussion
user avatar
1 vote

Please help me find what this function does? Is there is a way around it

Stay away from this kind of contract. Actually, with that function in place, the contract owners can change the balances of the tokens as they prefer. Moreover, the contract is bugged or tries to hide ...
user avatar
0 votes

How can I secure my custom transferFrom function?

Please read through the ERC20 documentation to understand what the standard is about before posting questions. https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/...
user avatar
0 votes

Approval and Transfer From Function in ERC 20 Tokens

How does the spender transfer these tokens? They can use the transferFrom(from, to, amount) function. Lets assume we have addresses A and B. If A has approved B to use an amount X then B can call ...
user avatar
0 votes

How can I secure my custom transferFrom function?

add an onlyOwner modifier to sensitive functions you have to set an owner state variable, preferably on deployment and add couple of functions. They are very familiar patterns, and you should use ...
user avatar
  • 387
0 votes
Accepted

Finding a balance storage slot of a token contract written in Vyper

The key in mappings is computed differently. In solidity the hash is computed on packed variables and the order is user address first and then balances mapping slot. In vyper it's the other way round. ...
user avatar
0 votes

I can't deploy my Upgradeable contract using truffle plugins

const MonstersOnTheWayUp = artifacts.require('MonstersOnTheWayUp.sol');
user avatar
  • 1

Top 50 recent answers are included