2022 Developer Survey is open! Take survey.

Questions tagged [erc-20-approve]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
11 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
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
1 answer
41 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
0 answers
5 views

write contract for "access to your wallet and can transfer USDT to others"? [duplicate]

i have usdt in my wallet , is it possible to give a smart contract permission to access and transfer the usdt from my wallet on my behalf using the "approve" and "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
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
2 answers
34 views

how to use function approve() and function transferfrom() in a dapp?

hello Me and my team are working on a staking/subscribing dApp on the ethereum blockchain using erc20 stablecoins like usdt and dai. We encounterd an error on the approve() and transferfrom() ...
user avatar
0 votes
1 answer
96 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
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
1 answer
42 views

Is this the correct way to handle a approval for ERC20

Please let me know if this is correct. function handleApproval(IERC20 _token, uint256 _numTokens) public returns(bool){ _token.approve(address(this), _numTokens); return(true); }
user avatar
0 votes
1 answer
38 views

Differenciate logs entry Approval between ERC20 and ERC721

For a dapp, I'm currently focused on the Approval event to track and list the tokens approvals for a given address. ERC20 and ERC721 are quite similar. They offer Approval events : ERC20 : Approval(...
user avatar
0 votes
0 answers
12 views

Redo infinite approval?

If I have a function that adds liquidity to a Curve pool each time that it's called, and it gives infinite approval the first time, do I have to write a condition to go around the infinite approval on ...
user avatar
  • 265
0 votes
1 answer
61 views

ERC 20 Royalty implementation

Hello Guys i want to implement a royalty fee on whenever my custom ERC20 token gets transfer between accounts any idea to implement this or any tutorial pls any help would be appreciated function ...
user avatar
0 votes
1 answer
200 views

Reverted with reason string 'ERC20: insufficient allowance'

I'm newbie on solidity and I'm trying a simple ERC20 on hardhat with task for understand use case I follow this steps Mint in owner Owner owns N token Owner would to approve Receiver for receive ...
user avatar
0 votes
1 answer
107 views

How to call ".approve()" function of a token which ABI I don't have? In web3.js/ethers

I need to call .approve() function of a token which I address I know but which ABI I don't have. How to do it? Will it be enough to create ABI string which will contain the signature of .approve() ...
user avatar
0 votes
1 answer
318 views

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

I want to approve my tokens to allow a smart contract to transfer them for me to another contract. Steps: I approve my tokens for Contract A to spend on my behalf. Contract A transfers my tokens to ...
user avatar
  • 342
1 vote
1 answer
55 views

Is "approve" required only for transferring tokens? Not a native coin?

Speaking of Ethereum blockchain, or any other one compatible with it: Polygon, Avalanche and others: is calling the function approve(...) mandatory only, and only, when there's a token involved in ...
user avatar
2 votes
1 answer
115 views

Difference between Approve() and IncreaseAllowance() in ERC20 contract

Over the last few days, I was looking up the best and clear explanation of the differences between Approve() and increaseAllowance() of the ERC20 contract, but couldn't come up with a proper ...
user avatar
0 votes
0 answers
297 views

web3.py - How to get status from ERC20 approve?

I have a web3.py script that approves ERC20 tokens to maximum - Web3.toWei((2**256)-1,'wei') - to bunch of different ER20 tokens (some have 18 decimals, some have 6) on Fantom chain. When i try to ...
user avatar
  • 101
1 vote
3 answers
212 views

What does web3's approve do before a token sell?

I'm trying to implement a bot with python and web3 from some code examples. All of them call the approve function before selling a token? What is this function for and is it necessary? Thanks
user avatar
  • 11
0 votes
0 answers
39 views

Can I bypass the "approval" mechanism for tokens within my own ecosystem?

Let's say I have my own ERC20 token FOO. I'd like my users to be able to send their FOO to my smart contract FooSwap. Is it acceptable practice to bypass the approval mechanism in the ERC20 Foo ...
user avatar
1 vote
1 answer
75 views

delegatecall approve of an ERC20 contract

I try to call approve from a contract of another ERC20 contract: The delegate call: // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract Delegate { address public constant f24 = ...
user avatar
  • 189
0 votes
1 answer
128 views

Why is there no approve function for MATIC token contract?

MATIC token is advertised as an ERC20 token. So why is there no approve function for MATIC token contract? https://polygonscan.com/address/0x0000000000000000000000000000000000001010#code What is the ...
user avatar
0 votes
0 answers
27 views

Does any Stablecoin have permit() or approveAndCall() function in polygon mainnet?

I'm trying to develop a DAPP with a stablecoin under the polygon mainnet. Having permit() or approveAndCall() in the token is necessary to complete a transaction in single call, for a better user ...
user avatar
  • 62
0 votes
0 answers
64 views

Best way for a smart contract to be approved to transfer tokens from a different ERC20 smart contract to an address

I have two smart contracts; tokenContract otherContract tokenContract is an ERC20 contract with a fixed supply of tokens. otherContract is a separate contract that users of our application interact ...
user avatar
  • 7
1 vote
1 answer
2k views

Ethers.js - Error: invalid BigNumber string

I am trying to approve a larger amount of erc-20 tokens (it has 18 decimals). await token.connect(signer).approve(contractAddress, BigNumber.from((1000*(tenToPowerOf18Digits)).toString())) : If I try ...
user avatar
  • 35
0 votes
0 answers
41 views

Approve many tokens with one transaction

I need the users to approve the ERC-721 token before the smart contract and transfer it to someone. the default "approve" function works fine. but I'm wondering how to approve many tokens at ...
user avatar
  • 135
0 votes
1 answer
125 views

Can a smart contract approve a pending transaction on a multisig wallet?

Suppose I have a multisig wallet like a Gnosis Safe, which requires (say) two or three signers to approve any given transaction. In other words, the multisig wallet has its own wallet address, and 2 ...
user avatar
  • 157
1 vote
1 answer
129 views

IWETH9 withdraw function - where is this function sending the ether to?

I've written the following function which swaps DAI back to WETH and then withdraws the WETH and returns the Ether. After running the function on REMIX I've got the Ether on the contract balance as I ...
user avatar
0 votes
1 answer
30 views

Contract reverts when making calls to erc20 token contract from my contract

i have this basic contract that should work, but it keeps reverting because of the approve call in the constructor, i also notice transferFrom calls from my contract also fails after manually ...
user avatar
1 vote
2 answers
4k views

Fail with error 'TransferHelper: TRANSFER_FROM_FAILED' even approved in contract

I'm rying to swap some BNB -> Token, then swap it back, all in one solidity function. Here's my code: interface IERC20 { function approve(address spender, uint256 value) external returns (bool);...
user avatar
  • 183
0 votes
0 answers
857 views

ethers.js - approve function returns "Error: cannot estimate gas"

I tried to create an ERC-20 token on the Ropsten testnet and then tried to call the approve() function but it returns this error: Error: cannot estimate gas; transaction may fail or may require ...
user avatar
0 votes
0 answers
17 views

Is it possible to add a creator royalty fee for ERC-20 tokens? [duplicate]

What the title says. Is it possible to add (on-chain) creator royalty fees to an erc-20 token. If not, are there any token standards that do allow for this?
user avatar
0 votes
0 answers
89 views

Do I need to use the approve function to transfer erc20 tokens from one address to another?

I'm making an nft marketplace and I want the buyers to buy the nfts with WETH. function createMarketSale(address nftContract, uint256 itemId) public nonReentrant { ...
user avatar
  • 21
0 votes
0 answers
99 views

ERC20 ‘TransferFrom’ function test within a ‘createStake’ function

During my searching, I would like a piece of advice on the following problem: I have this function to test in my smart contract createStake (uint256 _stake, address _tokenAddress) /** @notice ...
user avatar
  • 11
0 votes
0 answers
154 views

Estimated Gas in JS Doesn't Match Metamask Gas Fee

I need help with figuring out the estimated gas for an approval. I'm able to get a number but it doesn't match what's in metamask. I'm a noob to web3 and so I'm not even sure I'm passing the correct ...
user avatar
  • 111
0 votes
1 answer
123 views

In airdrop contract, I want each registered user to claim free airdrop tokens

I'm writing a simple airdrop contract in which user will register himself using register(), and his address will be added to an array registered[]. After the registration period is over, admin (who ...
user avatar
0 votes
1 answer
50 views

ERC-20 Token Approval Failure

recently I made a swap from ETH to WETH and immediately after that tried to grant another contract approval to spend my WETH. The TX immediately failed after it was created and was never submitted. ...
user avatar
0 votes
1 answer
26 views

Send ERC20 Tokens directly to contract address to trigger to function in contract

We are trying to bypass allow method and make the contract more UX friendly. And instead of first allowing contract to spend and after calling transferFrom method, we are thinking about just sending ...
user avatar
0 votes
0 answers
14 views

Solidity: Error from function transferFrom even after approval [ERC20] [duplicate]

I'm new to Solidity. My contract tries to receive the Chainlink ERC20 token on Rinkeby testnet from a users address. First transaction: user gives approval. This goes through. Second transaction: user ...
user avatar
0 votes
0 answers
271 views

ERC20 _transfer with Tax

I'm wanting to add in every transfer a rate of 5% that will go to another wallet, below for example I'm putting the _transfer function that I edited. /** * @dev overrides transfer for ...
user avatar
  • 121
2 votes
2 answers
730 views

Approve ERC20 token inside a contract function

I would like to understand why, approving an ERC20 token inside a contract function doesn't work. Suppose that I create a function in my contract, that calls an approve for an ERC20 token for the ...
user avatar
  • 145
0 votes
2 answers
44 views

Be notified when an Ethereum event occurs

I recently asked another question, but I deleted that one because I can narrow down my question to something simpler. Suppose an ethereum ERC-20 token contract can emit the following event: event ...
user avatar
0 votes
1 answer
40 views

Transferfrom and approve not working

I have erc20 tokens. Now I want to send these tokens to the current contract. How can I send it? function bid(uint256 tokens) public { require(block.timestamp < time,"time exceeded"); ...
user avatar
0 votes
1 answer
39 views

ERC20 Token Transfer Issue

I have a test token (ERC20) deployd on ETH test network (Kovan) The token was deployed using Unicrypt tool So far everything ok, but the issues is how can i transfer tokens from an outside smart ...
user avatar
0 votes
0 answers
35 views

How to save users that already approved a token

I'm making a dApp, i see that a lot of dApp asks to approve a transaction only one time How they know if someone already approved it? they save the address in a db? if yes, how they know if the user ...
user avatar
0 votes
0 answers
66 views

How to get the token approval list for my mutlisig wallet?

Etherscan recently launched a tool to exactly do this, but it doesn’t works on smart contracts and thus my multisig wallets. I have an OpenEthereum full archival node, but getStorageAt() isn’t that ...
user avatar
0 votes
1 answer
788 views

How can I send my NFT (ERC721) Token (minted on ContractA) to another Smartcontract (ContractB) so that it is allowed to transfer it?

I try to send my NFT token#300, which is an ERC721 token, minted on ContractA, to antoher ContractB, so that ContractB is now the owner of this Token#300 - so that the ContractB is now allowed to ...
user avatar
  • 113
0 votes
1 answer
175 views

Accept tokens in Smart Contract without allowance [duplicate]

I'm trying to develop an Smart Contract function that accepts and ERC20 token, and send it to another address. I know that I make the user to call approve and later execute the function: //check SC's ...
user avatar
  • 584
0 votes
0 answers
102 views

ERC20: Transfer amount exceeds allowance [duplicate]

I have created a contract which is a ERC20 contract. Once the contract is created, I have specified some amount of ERC20 tokens to be minted and sent to the contract. Moreover, I have defined that ...
user avatar