The document outlines a Solidity smart contract named 'Assessment' that allows the contract owner to deposit and withdraw funds while maintaining a balance. It includes functions to check the balance, return the owner's address, and verify ownership. Custom error handling is implemented for insufficient balance during withdrawals.
Download as TXT, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
2 views
Assessment.sol file
The document outlines a Solidity smart contract named 'Assessment' that allows the contract owner to deposit and withdraw funds while maintaining a balance. It includes functions to check the balance, return the owner's address, and verify ownership. Custom error handling is implemented for insufficient balance during withdrawals.
function withdraw(uint256 _withdrawAmount) public {
require(msg.sender == owner, "You are not the owner of this account"); uint _previousBalance = balance; if (balance < _withdrawAmount) { revert InsufficientBalance({ balance: balance, withdrawAmount: _withdrawAmount }); }