Search code examples
soliditysmartcontracts

Difference of balance keyword between different blockchain


I know that the address(this).balance shows the eth balance of the target contract.

Does the balance keyword return the balance of the native currency of that blockchain, or always returns balance of the contract's eth's?

If my SC is deployed on the polygon, does the balance keyword return the matic balance of my contract?


Solution

  • It always returns native balance of the address on the specific network where the contract is deployed.

    • ETH on Ethereum
    • MATIC on Polygon
    • BNB on Binance Smart Chain
    • etc.