Section 6: Mox Coffee - Mid Sec Work #39
Replies: 2 comments 21 replies
-
Hello @Jon-Mervedel, below is the @external
def withdraw():
self._only_owner()
for funder: address in self.funders:
self.address_to_amount_funded[funder] = 0
self.funders = []
# send(OWNER, self.balance)
raw_call(OWNER, b"", value = self.balance) So if you have the same withdrawal = coffee.withdraw() Obviously, you have withdrawn the balance of the contract to the owner with the line of code above, but when you do the assertion below, you will be comparing assert boa.env.get_balance(coffee.OWNER()) // this will return the actual balance of owner (!0) == withdrawal // this is `0` because the `withdraw` function of the `buy_me_a_coffee` does not return any value. I hope I did justice to this explanation. Please ask questions if anything is still unclear |
Beta Was this translation helpful? Give feedback.
-
For OWNER with previous funds in account without resetting the balance: edit:
|
Beta Was this translation helpful? Give feedback.
-
Hello all!
I took a few days to give myself a refresher in Python and am now back to the course.
I have a question concerning my logic of the workshop. When the following code is given these are the results:
1 passed, 6 deselected in 0.10s
However, when the following is added there is a problem:
And the following error:
What am I possibly doing to cause the error? I know it has to be coming from the added assertion, but can not solve what it may be. I also know its probably a simple error I'm making.
Any help is appreciated!
Beta Was this translation helpful? Give feedback.
All reactions