Skip to main content

Questions tagged [erc-20-approve]

The tag has no usage guidance.

64 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
6 votes
0 answers
300 views

Not able to use DAI's permit() function

I'm having trouble testing the permit() functionality from the DAI contract. I've read the documentation and a couple of other resources, although, I got the contract code and deployed myself a copy ...
João Quintanilha's user avatar
4 votes
3 answers
1k views

ERC-20 token approval fails if amount is close to maximum balance

So I am using Wagmi, which uses Ethers.js under the hood. I have to approve the router address first in order to buy the other token. It works when I use the exact or slightly greater amount than what ...
sanjay dev's user avatar
2 votes
0 answers
209 views

Can I cut a fee using multicall on Uniswap V3?

I developed my own frontend for Uniswap V3, and I was asking myself if I could cut a small fee of the input token using multicall. Basically, I would calculate what 2 percent of the input token would ...
Mhaas's user avatar
  • 29
2 votes
0 answers
113 views

Use Brownie to send ERC20 tokens to a payable function with the amount of tokens as an argument to the function

I have the following AlgoToken contract: interface StableCoin { function balanceOf(address account) external view returns (uint256); function allowance(address owner, address spender) external ...
Steven Hochstadt's user avatar
2 votes
1 answer
43 views

Manage tokens on the behalf of to call a smart contract

I would like to transfer tokens to defi smart contracts on the behalf of a third-party. I see no option apart from (1) the third-party to transfer to me directly (2) the third-party to pre-sign ...
Tango Juliet's user avatar
2 votes
1 answer
3k views

"gas estimation failed" error using Uniswap. Can't fix it, please help

I can't sell alt-tokens back into ETH. This is an issue with multiple tokens, not just one and they all have very high liquidity ($Kabosu and $OHMI). I immediately get the error 'gas estimation failed'...
UniSwapper's user avatar
1 vote
2 answers
228 views

Implementing an ERC20 Smart-Contract within another Smart-Contract

I’m trying to create a contract that lets people choose to pay for their transactions with either ETH, or another ERC20 Token - one that I’m creating and for now calling “DummyCoin”. So basically when ...
Mark55's user avatar
  • 1,011
1 vote
0 answers
348 views

estimateGas with prerequisites (gas estimation requires approvals first)

I am trying to estimateGas for an Ethereum transaction with ethers signer.estimateGas(). This transaction should execute several trades on arbitrary DEXs. To execute the transaction approvals of ERC-...
Philipp Schweiger's user avatar
1 vote
1 answer
21 views

What happened to these tokens?

I send some Matic token in one of my wallets to the other for cover fee of a transaction (0.05)matic but as soon as transfer succeeded, this amount transferred to another address, without any approval ...
Alireza's user avatar
  • 360
1 vote
2 answers
512 views

giving contract permission to spend eth

Since eth does not have a contract address, how does one allow a contract to spend it. For example - I put in a swap request - 10 eth for its amount in usdt for example - could the contract spend my ...
user avatar
1 vote
0 answers
403 views

Approve and Transfer ERC20 Tokens in contract

I'm pretty new to solidity and struggling with some pretty simple stuff so I was hoping somebody would be able to help me out. Basically, I want to be able to send an existing ERC20 token (ie: USDT) ...
l1nkm4rine's user avatar
1 vote
1 answer
580 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 ...
Chris's user avatar
  • 131
1 vote
0 answers
176 views

ERC20 approve attack: may its success be dependent on mainer decision about transaction order?

My question is related to the possible attack vector on ERC20 contracts described here. This attack effectively boils down to these steps: First transaction (mined): Alice calls approve(addressOfBob, ...
Ilya Loskutov's user avatar
1 vote
1 answer
742 views

How to call .increaseAllowance() from another token

I'm deploying a contract that is the owner of a token. In that contract i want to say that the token increaseAllowance to msg.sender and the amount that msg.send have putted in arguments of the ...
The Chimpy Dev's user avatar
1 vote
2 answers
980 views

Uniswap Liquidity Not Showing (please advise)

We created a meme token. Added it into the ERC20 blockchain and then went to add it to Uniswap. Can someone please advise as to why the coin was succesfull being added to Uniswap, but will not allow ...
Aarokosaki's user avatar
1 vote
0 answers
575 views

Cannot use transferFrom

no matter what I try, I am unable to call token.transferFrom without getting ERC20: transfer amount exceeds allowance - even though I have approved the allowance. Code speaks better than words: ...
Numis Matic's user avatar
1 vote
0 answers
265 views

Transferring ERC20 token to a contract using custom function

I have a couple of questions related to transferring ERC20 token to a contract. I am developing a protocol that has its own token to provide incentive mechanisms. For certain operations I need to lock ...
DN_Euler's user avatar
1 vote
0 answers
53 views

Does ERC20's transferFrom function fail if it doesn't meet the require statement?

I'm learning about the ERC20 contract by OpenZeppelin and curious about the approve function: function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (...
doctopus's user avatar
  • 315
1 vote
1 answer
737 views

Want to Access remote dai smart contract in another smart contract

I want to transfer Dai tokens from account1 to account2. My account1 has 50 DAI tokens. Kovan Dai contract address given by makerdao is: 0x4F96Fe3b7A6Cf9725f59d353F723c1bDb64CA6Aa. What I am doing ...
sunny radadiya's user avatar
0 votes
0 answers
13 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 ...
Korvent's user avatar
0 votes
1 answer
12 views

Automate the use of approve() without having to do it manually

I'm taking my first steps on Solidity. I would like the user to be able to use their funds by calling the dapp functions, but without having to use the approve() function manually on the token ...
Francesco Rossi's user avatar
0 votes
1 answer
25 views

what is the way to find out if a selected token will revert at 0 transfer

How can I find out if the selected token will revert to 0 transfer? Is there a list of tokens that revert at 0 transfer. As far as I understand USDC is one of them, is that correct ? Thanks in advance!...
kane333's user avatar
0 votes
2 answers
42 views

Approve does not increase the allowences

I'm encountering an issue with my Solidity smart contract where the allowance values for token transfers are not changing even after I've approved them. Here's the scenario: When I call the ...
Ferda-Ozdemir-Sonmez's user avatar
0 votes
0 answers
39 views

eth_call swapExactTokensForETH simulation error

I can do swapExactEthForTokens with no issue but when I try to do the reverse, swapExactTokensForETH, I run into this error: { "name": "ContractLogicError", "message&...
user132647's user avatar
0 votes
1 answer
31 views

Getting "insufficient allowance" error

// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "./TokenA.sol"; import "./TokenB.sol"; contract ...
soumyadeep.eth's user avatar
0 votes
0 answers
64 views

Pancakeswap V3 flash loan, receiving F0 error even though the flash loan has been repaid

I'm trying to finish up the callback function for a pancake swap flash loan. Everything is now working however for some reason the flash function fails due to an F0 error (ie. not paid the loan back). ...
Alexander Hunter's user avatar
0 votes
0 answers
11 views

USdt ERC20 1006

I am confused about this "Usdt erc20 1006" . In a website for withdrawal it is written "your Usdt Erc20 1006".. This is certainly address but which type of address is this.
Malik's user avatar
  • 1
0 votes
1 answer
42 views

Alert after spending approval

This is a simple dAPP i am running via metamask. I have tried many things. window.alert(`Connected Successfully`); I have tried to add this window.alert to my code but it wont do much. async function ...
Jim Mike's user avatar
0 votes
1 answer
14 views

Which contract should execute the approveAndTransferFrom function under one transaction?

I'm trying to perform approve and transfer under one tx but I don't understand which contract should be calling the approveAndTransferFrom function? Say contract A is trying to transfer tokens to ...
ratib90486's user avatar
0 votes
0 answers
102 views

How to check approvals for bunch of addresses

I have a list of ethereum addresses and I need to check which contracts and which approvals for a particular token they gave. I only need query approvals for one specific token. is there some ...
user122885's user avatar
0 votes
1 answer
68 views

ERC20 approval confusion

I have a smart contract which looks like this. // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/...
Joby Ingram-Dodd's user avatar
0 votes
1 answer
72 views

Token allowance of router address

Pretty much every coin with taxes has an allowance function to give the router allowance over max uint to be able to sell the tokens. However, I always see the allowance given to 'router', which ...
Andy's user avatar
  • 185
0 votes
1 answer
79 views

transferFrom not working. Estimate gas fee error. Cant find the bug

Code of contract followed by an explanation and requirements. Everything works but trade function. /** *Submitted for verification at Etherscan.io on 2023-05-16 */ // SPDX-License-Identifier: ...
SideChain Labs's user avatar
0 votes
0 answers
16 views

Verifying signed messages

I sent signed messages to claim ownership of various tokens yesterday. I'm wondering how long to get them verified as I couldn't do it via the source contracts.
Doojzie Official's user avatar
0 votes
1 answer
214 views

Uncertain how to correctly implement Approve and TransferFrom for ERC20, could you kindly help me to understand?

Having trouble understanding how to correctly implement Approve and transferFrom. Some guidance would be much appreciated, thank you for your time. Below is my Deposit function: / Users can deposit ...
Hari's user avatar
  • 1
0 votes
1 answer
42 views

I am using safe-connect to make swaps between a wallet, i am not able to find how to approve for example in Pancake to enable cake

The implementation is based on this repository which is great: https://github.com/tschubotz/safe-connect/blob/main/src/App.tsx I am able to handle swap transactions, but i cant seem to find a way to ...
ezIlj's user avatar
  • 1
0 votes
0 answers
57 views

How can I access current time inside transfer function in ERC20 contract?

I want to create a ERC20 contract in which inside the transfer() function I would check if the msg.sender can transfer tokens. This check will be like those we have in stock markets where when someone ...
Gaurav Pant's user avatar
0 votes
1 answer
593 views

Problem with setApprovalForAll( )

I was just scrutinizing the source code of an NFT marketplace. within the createNFT( ) function of their smart contract, I witnessed there is a setApprovalForAll(_marketplaceAddress) right after the ...
Sina Rahimi's user avatar
0 votes
2 answers
849 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 ...
Rustem Mustafin's user avatar
0 votes
1 answer
328 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 ...
astralmaster's user avatar
0 votes
2 answers
205 views

Is it possible to have another wallet execute a transaction on your behalf?

Is it possible to sign a message/transaction, then have another wallet execute the signed message/transaction without first calling "Approve"? This question is for both ERC20 and ETH.
ALL's user avatar
  • 11
0 votes
1 answer
17 views

Why we give crazy amount of approval to DEXs?

I just discovered that we give a crazy amount of approval to DEXs when we approve to swap tokens. What is that? Doesn't that mean their contract can take all the balance? The contract probably doesn'...
Bora Özenbirkan's user avatar
0 votes
1 answer
169 views

approve contract in wbnb

I deployed a contract on the bsc network to execute functions on the blockchain then I approved my contract at the wbnb address to make purchases and/or sales from the contract. What am I allowing ...
JhonatanAlfred87's user avatar
0 votes
0 answers
53 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 ...
Cb32019's user avatar
  • 113
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 "@...
Gervasius Twinklewinkleson's user avatar
0 votes
1 answer
236 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". ...
The Humble Rat's user avatar
0 votes
2 answers
735 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() ...
Ezeagu Chukwuebuka's user avatar
0 votes
1 answer
280 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 ...
Muhammad Kashif's user avatar
0 votes
0 answers
1k 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 ...
TaeWoo's user avatar
  • 101
0 votes
0 answers
242 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 ...
FromTheAshes's user avatar