EVM deployed and now what: dAPP

EVM deployed and now what?
Read hours of the docs.astar.network but unfortunately could not find an answer to my simple Question: how I can use the ready deployed EVM smart contract build and tested on remix.ethereum.org

So for someone with a similar questions:

dAPP with javaSkript (snippets) …

  • done the MetaMask onbording
    const onboarding = new MetaMaskOnboarding();
    onboarding.startOnboarding();

-I took the ABI and created the Contract
const contract = new web3.eth.Contract(contractABI, contractAddress);

  • requsted the MetaMask Wallet
    let accounts = await web3.eth.requestAccounts().catch((err) ;

  • prepared the RPC Call
    const rpcmethod = contract.methods.myMethod().encodeABI();

  • do the call
    await web3.eth.call({
    to: contractAddress,
    data: rpcmethod,
    });

  • wait for response:
    resnum = web3.utils.hexToNumber(result);
    or a whole structure
    res = web3.eth.abi.decodeParameters(abistruct,result);
    amount = Number(web3.utils.fromWei(res[“amount”], ‘ether’)).toFixed(6);
    payout = Number(web3.utils.fromWei(res[“payout”], ‘ether’)).toFixed(6);

If you have more suggestions or questions, please comment.

1 Like

Hey, @sostern, thanks for sharing your doubts.

Actually, Astar forum is not a good place to have this conversation, I will be glad to give you technical support if you join our discord server where we can have a more fluent conversation.

Here is the link: Astar Network

1 Like

Hi,

thanks, next mobile phone tower is 20 miles away from my off grid location … will do the "Verification Required!" the next days …

Thanks

2 Likes

Don’t worry, you can do it at your own pace and at any time!

1 Like