1

I have one contract that I give tokens from a ERC20 contract implemantation. When I call the balanceOf function from the Token conract. Response me that I have x Tokens. Nice !!

But when I try to send and amount of tokens(x/2 for example) from the smart-contract that have the X tokens to and specified address. I get the following error:

VM Exception while processing transaction: revert Not enough token

The question is, is necessary to have ether in the smart-contract to make the transaction?? It´s possible to a deployed smart-contract address give ether for making transactions??

Thx for the help

  • 1
    Yes, you need the amount that you want to send plus the gas cost of the smart-contract function which performs the address.transfer or address.send operation. I suggest that you check how many gas units this function consumes, and then transfer your amount minus that amount times the gas price. – goodvibration Feb 25 at 12:57
  • Please share your code (on-chain and off-chain), in order to clarify what you mean by send an amount of tokens from the smart-contract. – goodvibration Feb 25 at 14:55
0

Being the error "revert Not enough token" I guess the problem is the wallet/address from you are sending the transfer transaction has not enough tokens.

The smart contract does not need to have any funds. Just have enough ethers on the sender wallet to pay the fees and enough tokens (more or equal to the amount you are sending).

Unless the sender is the very contract, in that case you need to have enough tokens but not ethers. Fees are always paid by wallet origin sender, not the contract.

  • To me, the statement I try to send an amount of tokens... from the smart-contract implies that this dude has a contract which provides a function for transferring funds from the contract to some other address. If this is indeed the case, then your claim about The smart contract does not need to have any funds is incorrect in this context. – goodvibration Feb 25 at 14:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.