Questions tagged [erc-20-approve]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
0answers
24 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
29 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
13 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
20 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
49 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
26 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
1answer
32 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
395 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
39 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
156 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
38 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
489 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
100 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
593 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
21 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
33 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
14 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
313 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
1k 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
145 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
63 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
266 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
250 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
246 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 ...
7
votes
4answers
1k 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 ...