Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

131
Views
send ERC20 tokens not working: invalid address

Here is my javascript code: The address I'm sending it to is input address from user on app. The caller (currently selected metamask address has enough ERC20 tokens)

lookupVoterInfo: function() {
   let toAddress = $("#voter-info").val();
   Voting.deployed().then(function(contractInstance) {
     contractInstance.transfer(toAddress, 10);
   })

MyERC20 Contract:

// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;

import "../openzeppelin-contracts/contracts/token/ERC20/ERC20.sol";
import "../openzeppelin-contracts/contracts/math/SafeMath.sol";

contract MyERC20 is ERC20 {
    uint256 public INITIAL_SUPPLY = 20000;
constructor() ERC20("MyToken", "MYT") {
        _mint(msg.sender, INITIAL_SUPPLY);
    }
}

error message:

enter image description here

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I solved it by doing the following: You need to specify the gas fee and the account address.

contractInstance.approve(web3.currentProvider.selectedAddress, 100, {gas: 1000000, from: web3.eth.accounts[0]}); contractInstance.transferFrom(web3.currentProvider.selectedAddress, toAddress, 10, {gas: 1000000, from: web3.eth.accounts[0]});

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!