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.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
18 views2 pages
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 }); }