Jasaka / Cacao-DAO

CacaoDAO - Consensus finding made trustless and easy
https://dorg-platform-production.up.railway.app/
MIT License
5 stars 1 forks source link

Research Blockchain Development Basics #16

Closed Voidcake closed 2 years ago

Voidcake commented 2 years ago
mheimes commented 2 years ago

How to call methods from a Smart contracts: https://ethereum.org/en/developers/tutorials/calling-a-smart-contract-from-javascript/#:~:text=Call%3A%20Reading%20value%20from%20a%20smart%20contract,-The%20first%20example&text=You%20can%20access%20an%20instantiated,result%20of%20executing%20the%20function.

-> You can access an instantiated smart contract methods that you provided the ABI for as follows: yourContract.methods.methodname. By using the call function you’ll receive the result of executing the function.

Example:

daiToken.methods.balanceOf(senderAddress).call(function (err, res) {
  if (err) {
    console.log("An error occured", err)
    return
  }
  console.log("The balance is: ", res)
})