Skip to content
Discussion options

You must be logged in to vote

In solidity, we use the .call functionality as one way to send funds from one account to another. In this case, we are sending address(this).balance (the balance of our contract) to the recentWinner. Using .call returns two parameters and the first is a TRUE/FALSE value depending on whether the transaction (sending funds to the recentWinner) has suceeded or failed. We then store this value in a bool type variable called success
Afterwards in the next lines of code, we check to see if the success value was true or false. If it was false, meaning that the transaction failed then we can throw an error and revert saying that the transaction failed

if (!success) {
        revert Raffle__Transf…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@SerjSch
Comment options

Answer selected by SerjSch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants