Questions tagged [erc-20-approve]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2
votes
1answer
31 views

Current ERC20 approval best practices?

I've been reading some (old) discussions about the potential attack vector of using ERC20 approve (for example: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729) but I've been ...
0
votes
1answer
56 views

Fail with error 'TransferHelper: TRANSFER_FROM_FAILED', all gas used up

I'm trying to buy some CHY with USDT on Uniswap main net, fails with error 'TransferHelper: TRANSFER_FROM_FAILED', This is my failed tx link. This is a successful tx link from someone else. I notice ...
0
votes
0answers
12 views

Error in construtor when deploying: ERC20 approve method

I have this code in my constructor, which is raising an error on deployment: constructor(){ owner = msg.sender; wETH.approve(msg.sender, type(uint256).max); //Approve the owner to transfer ...
0
votes
1answer
21 views

How can I check on the frontend if an ERC20 address has approved a contract? (Approval)

I see Uniswap and a lot of other frontend UIs can check if an ERC20 token has approved the contract to use the address's funds, and dynamically change their buttons to "Swap" from "...
0
votes
0answers
13 views

Gas estimation failed:“transfer amount exceeds spender allowance” [duplicate]

0 I want to execute function Tip and transfer IERC20 Token. However, this message is shown. Uni::transferFrom: transfer amount exceeds spender allowance { "originalError": { "code"...
1
vote
1answer
43 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 ...
0
votes
1answer
23 views

Solidity: ERC-20 TransferFrom reverts after approval

i am trying to code a smart contract which takes the tokens of the player who enters. function enterToken(address token, uint amount) public { uint _amount = amount * 10 ** 18; IERC20 ...
0
votes
0answers
20 views

can mint function be included in the erc20 reflection contract?

mint function to increase the supply of tokens be included in an erc20 contract with reflection keeping the existing reflection total , when mint function occurs can it should sync with existing ...
0
votes
0answers
32 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: ...
2
votes
1answer
52 views

How to interact with a smart contract without ABI

So I bought a scamcoin (I know). I have the contract and I've managed to decompile the bytecode. How can I interact with the contract to approve the token? https://bscscan.com/address/...
0
votes
1answer
275 views

Uniswap Approve Succeeded But No ETH Returned in “Swap”

I attempted to swap some eMax (using the Uniswap Swap feature) for ETH and the Approve went through, in the end I received another token (old version of token before hard fork). It seems to be the ...
0
votes
0answers
29 views

when call solidity token approve method via web3js, my metamask is locking

i have got code like following; when i call that code, my metamask is locking and didn't respond. what can you suggest? thank you var MyContractToken = new web3.eth.Contract(abiToken,'...
4
votes
1answer
353 views

What is the best way to use uniswap without router?

I just bought a scam token. The liquidity pool is still there but I couldn't sell because I couldn't approve the token in Uniswap. When I try to approve, the error "execution reverted: ERC20: ...
0
votes
0answers
20 views

Approve() and transferFrom() functions seems to be giving errors

I am trying to develop a smart contract very similar to: https://github.com/tapmydata/tap-protocol/blob/main/contracts/VestingVault.sol So , I deployed ERC20 token and passed the contract address to ...
0
votes
1answer
45 views

Logic in approveAndCall function for erc20 token deprecated & not working

I am following along with a older tutorial on making an ERC20 token in order to learn Solidity a little better. Since the tutorial is old, I've had to change a lot of things so far to get it up to ...
1
vote
1answer
38 views

Approve and Swap/Deposit at the same time [duplicate]

So one of the most annoying things for me is having to Approve before calling Swap or Deposit. I would love there to be a proxy contract which just calls Approve and Swap/Deposit in the same function. ...
1
vote
0answers
42 views

How do I approve a smart contract to spend my ERC20 tokens? [duplicate]

My first time here, please forgive me for any mistakes. I made a custom ERC20 token using Openzeppelin ERC20PresetFixedSupply. I want to use that in my contract. I was using this code to test how ...
0
votes
0answers
10 views

How to list to Uniswap on User behalf

Currently, DAPP is under development. Is it possible for us to handle the GAS payment and approval process on behalf of the user who created the token using DAPP when trying to list the token in ...
0
votes
1answer
79 views

Sending ERC20 token to the constructor of a contract

I want to send an erc20 token to the constructor of a contract. I can't manually use the approve(spender, amount) function before deploying the contract as the spender address needs to be the address ...
1
vote
0answers
104 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 ...
0
votes
0answers
320 views

Fail with error 'TransferHelper: TRANSFER_FROM_FAILED' Although approved

I'm trying to make a swap programmatically, I did the following approvals using ethers.js: token0.approve(wallet.address, amount); token1.approve(wallet.address, amount); token0.approve(...
0
votes
1answer
34 views

Previous call to approve is mandatory?

I was trying this tutorial that implements a simple DEX. I am specially interested in the non payable function sell, that exchange custom tokens for ETH. function sell(uint256 amount) public { ...
1
vote
0answers
34 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 (...
0
votes
0answers
191 views

Web3 + Truffle, is this the correct way to approve a spend?

I have created an ERC20 token using Web3, Openzeppelin and Truffle, and minted some tokens. const LToken1 = await ERC20.new('Test L Token 1', "TEST1", web3.utils.toWei('1000000')); I would ...
0
votes
1answer
136 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
2answers
70 views

Is there a way to approve all future erc20 tokens for a contract?

I wanted to write a Smart Will contract that basically sends everything in my address to a beneficiary's address if I die. However I don't want to send everything to the smart contract in advance ...
1
vote
1answer
1k views

What is the use case of transferFrom function in ERC20 token contract?

In @openZeppelin's ERC20 implementation here is the code for function transferFrom: function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { ...
0
votes
1answer
82 views

Is it possible to use both approve and trasferfrom functions in a single function in other contracts? [duplicate]

I realized that you need to approve the amount of tokens you are gonna send to contract. for this you should first use approve function in token contract and then call the trasferfrom function in ...
0
votes
3answers
660 views

IERC20.approve(spender, amount) thinks the owner is also the contract

I have these functions and deployed my contract to Ropsten testnet. function setSmartContractAllownace(uint daiAmountIn) public { IERC20 daiToken = IERC20(ropstenDAI); daiToken.approve(...
0
votes
0answers
61 views

Approval notification

Is there a simple way that I can be notified (or check easily) when my address (an EOA) is approved by some other address (EOA, not contract) for an allowance of x amount of any ERC-20 token? It seems ...
1
vote
1answer
883 views

Contract with function payable to receive ERC20 token in one shot?

I am trying to write a smart contract with a function that receives an ERC20 token (i.e.: DAI), but the transaction to call this function is always failing. Let's assume I first record the ERC20 ...
0
votes
0answers
198 views

Approve Allowance ERC(20)

Can you please tell why do we have to approve ERC20 tokens before sending them? contract Transfer { function version1() { ERC20(someToken).transferFrom(msg.sender, address(this), 122); ...
2
votes
1answer
994 views

How to approve user to spend all my ERC20 tokens?

In ERC20 we approve a user to spend our token and then they can spend as much allowed using transferFrom, but if the allowance limit exceed then I have to approve again, is there any way to allow them ...
0
votes
1answer
22 views

Unable to approve [closed]

/// pragma solidity ^0.6.0; import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/IERC20.sol"; import "https://github.com/OpenZeppelin/...
0
votes
1answer
42 views

An attack to my contract similar to ERC-20 approval() exploit

I have function setNonRecurringFlow(uint256 _child, int256 _remainingSwapCredit) external; function setRecurringFlow( uint256 _child, int256 _maxSwapCredit, int256 ...
0
votes
0answers
28 views

What is the cause of an “APPROVED” transaction but doesnt do a “TRANSFER” for an ERC-20 Token?

I have a transaction that was approved and I paid $3 in fees. But the token was never "transfered" where and how can I debug what happen to my transaction of why it didn't transfer?
2
votes
1answer
594 views

i am new to this, can someone steal my erc20 token with the Function approve()

I have been using yield Farming (YFValue) and I noticed when I accept the contract via MetaMask. I set faming 500 USDT but in the contract the input was: Function: approve(address _spender, uint256 ...
2
votes
1answer
2k views

How to transfer ERC20 token to another contract and calling contracts function

I need to send an ERC20 Token from a contract to another contract and calling a function of the other contract at the same time. I know how to transfer an ERC20 Token from solidity to another contract,...
1
vote
1answer
234 views

How to make a delegatecall to external ERC20 token's approve function?

What I would like to do is something like this: function testCall(uint amount) public virtual returns (bool) { address tta = address(0xE7B6....); (bool success, bytes memory result) = tta....
5
votes
0answers
75 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 ...
1
vote
1answer
531 views

Usecase for approve and allowance functions of ERC20 token

Could you please enlighten me on how approve and allowance functions work using a usecase? I dont understand the underlying operations of these functions. Especially, when a token owner delegates the ...
0
votes
1answer
539 views

Is it possible for a contract to erc20 approve another contract?

I want my contract (#1) to be able to approve another contract (#2) to transfer erc20 tokens from #1 to #2. Is this possible?
0
votes
1answer
369 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 ...
8
votes
4answers
2k views

Is it possible to batch approve + transfer with CREATE2?

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 ...