Questions tagged [erc-20-approve]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
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.
1 vote
1 answer
476 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 ...
4 votes
3 answers
673 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 ...
0 votes
1 answer
27 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 ...
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
0 votes
1 answer
12 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 ...
0 votes
2 answers
48 views

ApproveUSDT function not working internally, how do I fix this?

I’m experimenting with a presale contract based on the BSC testnet, and in the contract I’m attempting to achieve the purchase of my token with USDT. Using my own code within the contract itself, I ...
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 "@...
2 votes
1 answer
2k 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'...
0 votes
1 answer
380 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 ...
1 vote
2 answers
332 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 ...
1 vote
2 answers
698 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 ...
1 vote
1 answer
49 views

Metatransaction EIP-712 compliant reverted on Tether USDT Polygon contract

I have a problem with the execution of a metatransaction EIP-712 compliant, I show you the backend code with ethers.js and the link of the contract on mainnet :slight_smile: Contract : https://...
1 vote
1 answer
700 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 ...
0 votes
1 answer
33 views

Approval question

Beginner question: I have trusted wallet with 1000 LINK erc20. I want to swap it to get USDT erc 20. It ask to approve the LINK. How long approval takes? In some time after I got the USDT, I wish to ...
12 votes
4 answers
5k views

Is it possible to batch approve + transfer an ERC-20 token?

In our dapp, we currently have the following user flow: Approve the Sablier contract to spend up to x ERC20 tokens Transfer the x ERC20 tokens to the Sablier contract This is not super bad UX, but ...
0 votes
2 answers
20 views

transferFrom exceeds allowance though it's approved

I think I do everything correctly but... I get the transfer amount exceeds allowance error..... yes I could just use transfer() and that's it, but... should the transferFrom() also work? I don't get ...
2 votes
1 answer
36 views

Getting error ERC20: insufficient allowance even after the user approving the tokens. Need help with debugging

The following code is from a Stablecoin project. To gain more context, please refer to this Github repo. I've added a new function to the DSCEngine.sol name collapseDsc() which is responsible for ...
1 vote
1 answer
25 views

Can approve function be malicious?

I'm so confused on how approve functions works: If myToken contract has an approve function but the owner did not approve the contract B. Then contract B deploys a function and create a function that ...
0 votes
2 answers
664 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() ...
1 vote
1 answer
53 views

Invalid Permit Signature - Same Signature Generated by Different Address?

Our dApp uses Permit for gasless token approvals. We are generating a signature request with signTypedData, and it works except for a few strange occurrences where I am getting back an invalid ...
0 votes
1 answer
3k views

How can I remove custom spending cap on Metamask?

When I call the approve function of the ERC20 token standard, it asks me to set a custom spending cap, as shown below. But I need to use the default value every time without clicking "use ...
2 votes
1 answer
34 views

Transfer tokens to and from smart contract [closed]

I would like to have a new ERC20 token and one or two smart contracts to do automatic trade with specific cryptos. Example: I can buy 1 token from the contract in exchange for 1 USDT. I can sell a ...
0 votes
2 answers
553 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 ...
1 vote
1 answer
728 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 ...
0 votes
1 answer
457 views

Why is my approve() function using incorrect token_id

I have created an ERC20 token using openzeppelin and web3. I am then trying add some of this new token to a contract (An instance of UniswapV2Router02.sol) in order to add liquidity to a liquidity ...
0 votes
1 answer
1k views

Can't sign approve transaction in Uniswap

I created a simple Erc20 token contract, i'd like to make the token approval on exchange(uniswap) only avaliable for just the owner of the contract. Everything seem to work fine but when a user goes ...
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 ...
0 votes
1 answer
28 views

Execute ERC20 Approve outside of ERC20 contract

I am rewriting the solidty-by-example.org crowdfunding exercise. IERC20 public immutable token; function pledge(uint _id, uint _amount) external { Campaign storage campaign = campaigns[_id]; ...
0 votes
0 answers
46 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 ...
0 votes
1 answer
46 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/...
1 vote
2 answers
94 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 ...
0 votes
0 answers
49 views

Fantom cannot approve spending USDC token

I am doing simple approve operation on USDC token in Fantom network. Here is my payload: functionParams { from: '0xd775b00b5cf6e954aed8408202367a1bae6ac55f', to: '...
0 votes
1 answer
118 views

Metamask - get value entered from calling ERC20 "approve()" method

When we're asking a user to approve() the spending of a proprietary ERC20 Token for the first time (like say DAI, or SUSHI, etc.), the user has to enter the amount they're willing to approve - like ...
0 votes
0 answers
23 views

I am trying to create a contract to stake ERC20 token and getting this error "ERC20: insufficient allowance". I used approveContract to approve

I first approve allowance through 'approveContract' function and then try to transfer the amount using 'transferFrom' function of ERC20. But getting error :ERC20: insufficient allowance: function ...
0 votes
1 answer
49 views

insufficient allowance Error .. ERC20

// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import &...
0 votes
1 answer
52 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 ...
0 votes
1 answer
55 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: ...
2 votes
2 answers
486 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 ...
1 vote
0 answers
161 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 ...
0 votes
0 answers
22 views

Why my ERC20 approval function has the same owner and spender?

Why my ERC20 approval function has the same owner and spender? //SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/...
0 votes
1 answer
397 views

Getting Fail with error 'ERC20: insufficient allowance'

First I'm deploying Cafe contract and get deployedId from it and then deploy CAFToken contract with deployedId of cafe contract. I've also added deploy script and test case, I guess everything is ...
1 vote
2 answers
2k views

Cant pass large uint in react.js (2**256-1) into solidity approve function

I am trying to call a simple approve() to allow my contract to spend my tokens. Trying to make the amount argument = (2**256 - 1) however I am getting the below error message every time. Unhandled ...
0 votes
1 answer
241 views

ERC20 increaseAllowance exploit?

I have my own smart contract. Users on my webpage needs to first approve (increaseAllowance) and then they call "donate" function and part of the assets are sent to my vault and the other ...
1 vote
1 answer
161 views

TranferFrom in delegate call

I have an ERC20 test contract, also I did multicall with delegatecall function instead of call. I have a three accounts: account1, account2, and account3. account1 can spend tokens from account2 (I ...
2 votes
0 answers
88 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 ...
1 vote
1 answer
797 views

ERC20 Tax on sell (via swap)

I'm struggling with taxing upon swapping a token back for ETH. I can't figure out what I'm doing wrong here. I'm using Hardhat testnet forking Goerli to work with the Uniswap contracts. Also made ...
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 ...
0 votes
2 answers
942 views

Failing to trying to approve contract using ethers.js (CALL_EXCEPTION or cannot estimate gas)

I am having trouble calling a simple ERC-20 approve function from the front end on the Arbitrum network. Any insight is greatly appreciated. I will outline my code below. I am retrieving the provider ...
2 votes
1 answer
33 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 ...