Questions tagged [erc-20-approve]
The erc-20-approve tag has no usage guidance.
59
questions with no upvoted or accepted answers
6
votes
0
answers
193
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 ...
2
votes
1
answer
22
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 ...
1
vote
0
answers
71
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-...
1
vote
1
answer
1k
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'...
1
vote
1
answer
17
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 ...
1
vote
2
answers
89
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
0
answers
71
views
Approve and Transfer ERC20 Tokens in contract
I'm pretty new to solidity and struggling with some pretty simple stuff so I was hoping somebody would be able to help me out. Basically, I want to be able to send an existing ERC20 token (ie: USDT) ...
1
vote
3
answers
870
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
1
vote
0
answers
206
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
1
answer
312
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 ...
1
vote
0
answers
121
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, ...
1
vote
1
answer
615
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 ...
1
vote
2
answers
407
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
0
answers
528
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:
...
1
vote
0
answers
222
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 ...
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 (...
1
vote
1
answer
699
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
25
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
0
answers
23
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 ...
0
votes
0
answers
14
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.
0
votes
1
answer
47
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 ...
0
votes
4
answers
226
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,...
0
votes
1
answer
28
views
I am using safe-connect to make swaps between a wallet, i am not able to find how to approve for example in Pancake to enable cake
The implementation is based on this repository which is great: https://github.com/tschubotz/safe-connect/blob/main/src/App.tsx
I am able to handle swap transactions, but i cant seem to find a way to ...
0
votes
0
answers
20
views
How can I access current time inside transfer function in ERC20 contract?
I want to create a ERC20 contract in which inside the transfer() function I would check if the msg.sender can transfer tokens. This check will be like those we have in stock markets where when someone ...
0
votes
1
answer
117
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 ...
0
votes
2
answers
100
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 ...
0
votes
1
answer
85
views
Uniswap's swapExactTokensForTokensSupportingFeeOnTransferTokens gives "transfer amount exceeds allowance" error
I am experimenting with Uniswap's swapExactTokensForTokensSupportingFeeOnTransferTokens method by attempting to swap USDC -> WETH -> UNI-v2 using ethers.js just for the sake of understanding ...
0
votes
0
answers
79
views
I am unable to transfer an ERC721 token that is owned by the wallet calling the function to the contract address the function belongs to
This is the start of a contract i'm writing, to enable two parties to trade ERC721 tokens via an escrow service.
The first step in the contract is that the trade initiator will deposit a token to the ...
0
votes
2
answers
79
views
Is it possible to have another wallet execute a transaction on your behalf?
Is it possible to sign a message/transaction, then have another wallet execute the signed message/transaction without first calling "Approve"?
This question is for both ERC20 and ETH.
0
votes
1
answer
13
views
Why we give crazy amount of approval to DEXs?
I just discovered that we give a crazy amount of approval to DEXs when we approve to swap tokens. What is that?
Doesn't that mean their contract can take all the balance? The contract probably doesn'...
0
votes
0
answers
155
views
Transferring ERC20 tokens from a Multi Signature Wallets to a Smart Contract using `approve(...)` and `transferFrom(...)`
I believe I grasp how an on-chain Multi-Signature transfer works from MultiSigWallet → OtherWallet. I get that for a 2 of 2 Multi-Signature Wallet both Owner 1 and Owner 2 would need to individually ...
0
votes
1
answer
84
views
approve contract in wbnb
I deployed a contract on the bsc network to execute functions on the blockchain then I approved my contract at the wbnb address to make purchases and/or sales from the contract.
What am I allowing ...
0
votes
0
answers
113
views
How to allow adding liquidity to the pool only if you are the owner of the token
I have created an ERC20 in bsc (testnet), and I have added liquidity with the owner (BUSD-CustomToken), later I have passed a few CustomToken to another account, but I have also been able to create ...
0
votes
0
answers
20
views
Creating / Tracking ERC20 Transfers on Chain
I am creating a contract where users can come and deposit a certain stable coin to the contract.
Let's say using these invested funds, the contract owner can use it and be given a certain interest for ...
0
votes
0
answers
32
views
ERC721 transferring NFTs and currency
I have a contract that I want to use as an NFT marketplace. It extends ERC721URIStorage
contract NftMarketplace is ERC721URIStorage ...
In on function I use _transfer() to move an NFT from the seller ...
0
votes
0
answers
22
views
How to code an approval function
Can someone help me with coding an approval function for Ether, if you could show methe most basic way to do this i would be able to figure out the rest thanks.
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 "@...
0
votes
1
answer
124
views
transfer vs transferFrom "amount exceeds allowance" when sender is the same as msg.sender
I know the reasons for using transfer vs transferFrom but made the mistake of using the second one whilst doing some testing and I got the error "ERC20: transfer amount exceeds allowance". ...
0
votes
2
answers
454
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() ...
0
votes
0
answers
35
views
Should ether be stored(in Proxy or Implmentation) if your Upgradeable contract is making a call to some ERC20 token contract?
I have made a contract(say MYNFT contract) which is upgradeable.
Now I have a proxy contract and implementation contract (MYNFT contract).
In Implementation, an user can mint a NFT if the user wires ...
0
votes
0
answers
44
views
Redo infinite approval?
If I have a function that adds liquidity to a Curve pool each time that it's called, and it gives infinite approval the first time, do I have to write a condition to go around the infinite approval on ...
0
votes
1
answer
197
views
ERC 20 Royalty implementation
Hello Guys i want to implement a royalty fee on whenever my custom ERC20 token gets transfer between accounts any idea to implement this or any tutorial pls any help would be appreciated
function ...
0
votes
0
answers
933
views
web3.py - How to get status from ERC20 approve?
I have a web3.py script that approves ERC20 tokens to maximum - Web3.toWei((2**256)-1,'wei') - to bunch of different ER20 tokens (some have 18 decimals, some have 6) on Fantom chain.
When i try to ...
0
votes
0
answers
126
views
Can I bypass the "approval" mechanism for tokens within my own ecosystem?
Let's say I have my own ERC20 token FOO.
I'd like my users to be able to send their FOO to my smart contract FooSwap.
Is it acceptable practice to bypass the approval mechanism in the ERC20 Foo ...
0
votes
0
answers
2k
views
ethers.js - approve function returns "Error: cannot estimate gas"
I tried to create an ERC-20 token on the Ropsten testnet and then tried to call the approve() function but it returns this error:
Error: cannot estimate gas; transaction may fail or may require ...
0
votes
0
answers
216
views
Do I need to use the approve function to transfer erc20 tokens from one address to another?
I'm making an nft marketplace and I want the buyers to buy the nfts with WETH.
function createMarketSale(address nftContract, uint256 itemId)
public
nonReentrant
{
...
0
votes
1
answer
244
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
137
views
ERC-20 Token Approval Failure
recently I made a swap from ETH to WETH and immediately after that tried to grant another contract approval to spend my WETH. The TX immediately failed after it was created and was never submitted. ...
0
votes
1
answer
35
views
Send ERC20 Tokens directly to contract address to trigger to function in contract
We are trying to bypass allow method and make the contract more UX friendly. And instead of first allowing contract to spend and after calling transferFrom method, we are thinking about just sending ...
0
votes
1
answer
111
views
Transferfrom and approve not working
I have erc20 tokens. Now I want to send these tokens to the current contract. How can I send it?
function bid(uint256 tokens) public {
require(block.timestamp < time,"time exceeded"); ...