Skip to main content

Questions tagged [erc-20-approve]

Filter by
Sorted by
Tagged with
0 votes
1 answer
26 views

Revoke ERC-20 Smart contract approval

Is it possible to revoke the approval given in ERC-20 smart contract in solidity.
Bhanu Partap's user avatar
0 votes
1 answer
47 views

withdrawing ERC20 tokens from a contract?

A smart contract which stores ERC20 tokens. When withdrawing an amount from the contract I found examples of checking the token balance before making the transfer: IERC20 token = IERC20(tokenAddress); ...
Ryan Cutter's user avatar
1 vote
0 answers
57 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
  • 11
0 votes
1 answer
18 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
35 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
56 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
1 answer
99 views

ERC20 Token Balance to Zero After Swap

I tried to do some token swaps on Uniswap. I also checked other topics in the forum but couldn't understand what really happened because I couldn't find any transactions that shows something happened ...
morez890's user avatar
0 votes
1 answer
51 views

transfer token from one address to another through a contract using solidity

I am trying to transfer a token from any address to my contract or another address using solidity but it is not working. the TransferTokenAddress function is the one I'm running. // SPDX-License-...
Jose's user avatar
  • 3
0 votes
0 answers
48 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
2 votes
2 answers
125 views

ERC20 without approve

Is is good practice if I have a custom-made ERC20 that takes its own tokens out of the user for doing other stuff? I ask since doing it this way there's no need for the user to call approve() ...
dNyrM's user avatar
  • 938
0 votes
1 answer
33 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
93 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
3 votes
1 answer
99 views

Is it possible to allow a third-party relayer to spend ETH on your behalf?

With the ERC-20 standard, it is possible to approve a third-party relayer to spend the tokens on your behalf. This can be done by calling the approve function and providing a high allowance value, ...
Paul Razvan Berg'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
46 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
3 answers
714 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 ...
HAT0ken's user avatar
1 vote
1 answer
168 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://...
Giovanni Maria Mazza's user avatar
0 votes
1 answer
63 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 ...
shem's user avatar
  • 3
0 votes
2 answers
44 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 ...
Eugene1111's user avatar
2 votes
1 answer
88 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 ...
alfheimrShiven's user avatar
1 vote
1 answer
137 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 ...
anonauditor's user avatar
1 vote
1 answer
140 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 ...
Jeffrey Dennison's user avatar
2 votes
1 answer
71 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 ...
Roger that's user avatar
0 votes
1 answer
51 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]; ...
stevealock's user avatar
0 votes
1 answer
72 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
1 vote
2 answers
251 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
1 answer
229 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 ...
Mark55's user avatar
  • 1,011
0 votes
1 answer
86 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 &...
kaay's user avatar
  • 7
0 votes
1 answer
75 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
91 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
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 ...
deKaV's user avatar
  • 1
2 votes
0 answers
214 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
0 votes
1 answer
2k 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 ...
Akshar Prajapati's user avatar
0 votes
1 answer
569 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 ...
PoorMillionaire'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
1 vote
1 answer
258 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 ...
anguser's user avatar
  • 25
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
1 vote
1 answer
1k 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 ...
matsmakeshift'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
0 votes
2 answers
2k 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 ...
qoze's user avatar
  • 13
1 vote
0 answers
359 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
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
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
0 votes
2 answers
60 views

Approve and disapprove a transaction

i want to develop a contract student in which student sign a transaction to update its record and owner would be able to approve or disapprove this transaction how would I able to do this.
Saira Rao's user avatar
0 votes
1 answer
550 views

Token approval questions and issues

I had a DEX approve 1000 USDT. I then traded 1000 USDT. The next day I want to trade another 1000 USDT from the same address, but the same DEX asks me for approval again! On Etherscan Token Approvals ...
user1754501'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
0 votes
1 answer
219 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
60 views

move approved ERC20 to another contract

I created a contract that acts as my entry contract and gets an address for my second contract that would then call UniSwap exactInputSingle(). for the token that I'm sending to the first contract, I ...
Patrick W. McMahon's user avatar
1 vote
4 answers
1k views

Allowing contract to take ERC20 tokens from msg.sender

I'm kind of new to Solidity and struggling with allowances and approvals. I want my smart contract to be allowed to take ERC20 tokens (LINK in this case) from the msg.sender. I'm using Remix on Goerli,...
TRS's user avatar
  • 131