Questions tagged [erc-20-approve]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
0 answers
164 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
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 ...
Kane Lawless's user avatar
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 ...
The Chimpy Dev's user avatar
0 votes
1 answer
363 views

Metamask: Is aprove equivalent to 100% automatic transactions?

When we do an approve in metamask we see this text: Is this site trustworthy? By granting this permission, you authorize [Site] to retire your [Token] and automate transactions for you. What does ...
user2983041's user avatar
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 ...
Owen Robert's user avatar
2 votes
1 answer
902 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 ...
MoonGusto's user avatar
0 votes
1 answer
944 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 ...
aj3423's user avatar
  • 251
0 votes
1 answer
2k 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 "...
SolidityV2's user avatar
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 ...
Aarokosaki's user avatar
0 votes
1 answer
739 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 ...
Royal.Flush's user avatar
1 vote
0 answers
568 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
2 votes
1 answer
3k 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/...
Radu Ștefănescu's user avatar
0 votes
1 answer
4k 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 ...
eMax swapper's user avatar
0 votes
0 answers
556 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,'...
doğa özcan's user avatar
4 votes
1 answer
2k 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: ...
Ingtellect's user avatar
0 votes
1 answer
250 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 ...
EatLiftProgram's user avatar
1 vote
1 answer
493 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. ...
doctopus's user avatar
  • 315
1 vote
0 answers
88 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 ...
Kushagra Jain's user avatar
0 votes
1 answer
575 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 ...
Arvinth Saravanan's user avatar
1 vote
0 answers
249 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
2 votes
1 answer
1k 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(...
0x_Anakin's user avatar
  • 121
0 votes
1 answer
105 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 { ...
Alexander Herranz's user avatar
1 vote
0 answers
52 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
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 ...
Barney Chambers's user avatar
0 votes
2 answers
528 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 ...
Terence Chow's user avatar
4 votes
2 answers
12k 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) { ...
user938363's user avatar
0 votes
1 answer
349 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 ...
Amin's user avatar
  • 76
1 vote
3 answers
5k 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(...
Saehun Sean Oh's user avatar
1 vote
1 answer
3k 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 ...
Sergi Juanati's user avatar
0 votes
0 answers
435 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); ...
Hakob Arshakyan's user avatar
2 votes
1 answer
2k 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 ...
Shubham Singh's user avatar
0 votes
1 answer
29 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/...
好味道's user avatar
0 votes
1 answer
171 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 ...
porton's user avatar
  • 1,744
0 votes
0 answers
80 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?
Patoshi パトシ's user avatar
2 votes
1 answer
2k 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 ...
Tk Gz's user avatar
  • 23
4 votes
1 answer
6k 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,...
kavofa's user avatar
  • 43
1 vote
1 answer
909 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....
Damir Olejar's user avatar
6 votes
0 answers
266 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
1 vote
1 answer
1k 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 ...
Muni V K's user avatar
1 vote
1 answer
2k 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?
Michael C's user avatar
  • 433
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 ...
sunny radadiya's user avatar
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 ...
Paul Razvan Berg's user avatar

1 2
3