Questions tagged [erc-20-approve]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
2 answers
154 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
16 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
439 views

How to run the approve method of Matic smart contract on Mumbai Chain?

I am trying to interact with Matic smart contract on Mumbai chain. The contract address would be - 0x0000000000000000000000000000000000001010. This code below is calling the approve method. ...
Abu Sayeed Mondal's user avatar
1 vote
2 answers
331 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
0 votes
1 answer
849 views

Staking and ERC20 Approve (RPC Error: execution reverted: ERC20: transfer amount exceeds allowance)

I apologize if this question might seem a bit simple beforehand. I'm trying call the deposit function from my frontend, but it gives me the error mentioned above. I am confused as to if this is a ...
HeeeeSark's user avatar
1 vote
0 answers
233 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
0 votes
0 answers
23 views

how to fix "ERC20: insufficient allowance" error? [duplicate]

I wrote a very simple contract to use the erc20 functions in another contract and the first thing I tried was transferFrom function, which works perfectly when I'm sending tokens from msg.sender(which ...
pardis.ti's user avatar
0 votes
1 answer
111 views

"insuffiecient allowance" running my unit test

I'm developing in remix a lottery SC. I have a problem when I run buyTicket() function. On remix I fix it giving approve to SC address from erc20 function, but I don't know how to do it when I run my ...
Federico's user avatar
0 votes
1 answer
131 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
2 answers
472 views

How IncreaseAllowance and DecreaseAllowance function solve mitgation problem?

I was going through openzeppline code for ERC20 Token and found that While working with approve function in IERC20 interface they describe mitigation problem : Link I don't understand how ...
Viraj's user avatar
  • 23
0 votes
1 answer
290 views

Testing `approve` function

I would like to test a contract where I use the approve function of an ERC20 token. Is there any test suite that allows doing that? truffle? hardhat? Any suggestion would be highly appreciated!
Abramodj's user avatar
  • 101
0 votes
1 answer
418 views

Can Metamask be used for all ERC20 token?

How can I use WETH with Metamask wallet? I can see ETH in my Metamask (Rinkeby TestNet, it works on Mainnet) but can not use other tokens. Any Repository or lead will be appreciated. If yes, What will ...
Rohit Mittal's user avatar
0 votes
0 answers
49 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
  • 13
0 votes
1 answer
2k 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
179 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
1 answer
1k 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. ...
john gomez's user avatar
0 votes
2 answers
663 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
739 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 ...
user3215072's user avatar
0 votes
1 answer
727 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); }
DigitalCannon's user avatar
0 votes
1 answer
412 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(...
antonio-fr's user avatar
0 votes
1 answer
249 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
1 vote
1 answer
2k 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 ...
Fabio Spadaro's user avatar
0 votes
1 answer
310 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() ...
Tendarito's user avatar
1 vote
2 answers
2k 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 ...
Adrian D.'s user avatar
  • 514
1 vote
1 answer
633 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 ...
Markus736's user avatar
4 votes
1 answer
2k views

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

Over the last few days, I have been looking up the best and clear explanation of the differences between Approve() and increaseAllowance() of the ERC20 contract. Still, I couldn't come up with a ...
Sina Rahimi'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
1 vote
3 answers
1k 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
Mjg's user avatar
  • 11
0 votes
0 answers
205 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
1 vote
1 answer
716 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 = ...
user66732's user avatar
  • 435
1 vote
3 answers
1k 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 ...
user92683's user avatar
4 votes
1 answer
21k 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 ...
David's user avatar
  • 153
2 votes
2 answers
484 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 ...
vajad57's user avatar
  • 205
0 votes
1 answer
474 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 ...
Marc's user avatar
  • 257
1 vote
1 answer
496 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 ...
Jochen Ruland's user avatar
0 votes
1 answer
54 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 ...
Prometheus's user avatar
3 votes
2 answers
18k 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);...
aj3423's user avatar
  • 251
0 votes
0 answers
2k 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 ...
user80100's user avatar
0 votes
0 answers
245 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 { ...
eth_sign's user avatar
1 vote
1 answer
474 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
0 votes
1 answer
395 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 ...
Ashish kumar's user avatar
0 votes
1 answer
217 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. ...
emnul.eth's user avatar
0 votes
1 answer
38 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 ...
Adam Surrey Smitson's user avatar
0 votes
0 answers
19 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 ...
hereyraa's user avatar
2 votes
2 answers
2k 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 ...
xcsob's user avatar
  • 157
0 votes
2 answers
134 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 ...
BeetleJuice's user avatar
0 votes
1 answer
144 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"); ...
Gajeel Redfox's user avatar
0 votes
1 answer
63 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 ...
Armindo Pereira's user avatar
0 votes
1 answer
1k 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 ...
Suisse's user avatar
  • 123
0 votes
1 answer
319 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 ...
Alexander Herranz's user avatar