Loading...
In this smartbook, we'll discuss how to create a function to get the contract balance:
Connect with our pragma value
pragma solidity >=0.4.5 <0.9.0;
Create a smart contractÂ
pragma solidity >=0.4.5 <0.9.0;
contract MyContract {
}
Create a function and return our balance
function getter() public view returns(uint){
return address(this).balance;
}
pragma solidity >=0.4.5 <0.9.0;
contract Practice {
function getter() public view returns(uint){
return address(this).balance;
}
}