Contract to contract interactions

A contract calling function of another contract

Context

  • Context is the data/states available to the function at the time of execution
  • EVM uses 3 areas to store data/states: storage, memory, stack
  • Other context includes account states and message call states

Non-Delegate Message Call

Call context

Delegate Message Call

Delegatecall context

Call V/s delegate Call Context

Examples of web3-eth

  • web3.eth.getBalance : balance of an address at a given block
  • web3.eth.signTransaction : sign a transaction
  • web3.eth.sendSignedTransaction : send a signed transaction to the Ethereum blockchain.

Examples of web3-shh

  • web3.shh.post : posts a whisper message to the network
  • web3.shh.subscribe : creates a subscription to incoming whisper messages

Examples of web3-bzz

  • web3.bzz.upload : upload files and folders to Swarm
  • web3.bzz.download : download files and folders from Swarm

Examples of web3-net

  • web3.*.net.getID : returns the network ID
  • web3.*.net.getPeerCount : returns the number of peers that the node is connected to

Examples of web3-utils

  • web3.utils.toWei : converts Ether to Wei
  • web3.utils.hexToNumberString : converts a hexadecimal value to a string
  • web3.utils.isAddress checks if a given string is a valid Ethereum address.

Recommended Resources