Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

157
Visualizações
how to figure out IERC20 token address from javascript

I would like to send some IERC20 tokens from metamask to a contract controlled by my webpage

I link an HTML button action to the following javascript function. This works well when ether is sent directly from metamask after accepting confirming/linking account from metamask with webpage

  const placeFunds = async (side, e) => {
    e.preventDefault();
    await contract.getFunds(
      side, 
      {value: e.target.elements[0].value}
    );

Now for the IERC20 token, I would like to figure out the IERC20 token address before passing to the contract function. Where is the token address stored in javascript/how do I get that info, as I want the contract to accept only specific ERC20 tokens?

  const placeFunds = async (side, e) => {
    e.preventDefault();
    await contract.getFunds(
      side, TOKENADDRESS, 
      {value: e.target.elements[0].value}
    );
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The tokens are not stored in javascript. Whenever you want a new token to be added in metamask, you might have to add it yourself because metamask also doesn't know about it. If you don't know the token you are going to transfer, you can use some tool like Moralis to get all erc20 tokens of the user with Moralis.Web3.getAllERC20

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda