New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trouble with Distribute challenge #14
Comments
Hi @EWCunha we can't put hints here, but this particular problem is indeed quite challenging. Note that if you copy the addresses from storage to memory, this will be an additional cost compared to just reading them from storage and doing a transfer. Definitely try to think outside the box with this one! |
Well, that doesn't help at all. I am honeslty out of ideas. I tried googling for gas efficient ways to send ETH to a batch of addresses, but didn't find any. I am also doing the Yul and Assembly Udemy course and tried some Yul code, but also didn't achieve the gas target. I tried storing the contract's balance to a variable, because it seems to me that reading the contract's balance costs a lot of gas, but on the test script, the balance is set artificially, without actually sending ETH (which seems like cheating to me), which does not update state variables. If at least I knew I am going to the right direction... |
Everything which is far more than test case is able to use. Even let this contract just be able to use once. |
I am having some trouble trying to optimize the Distribute contract. I believe that I need to do something about the transfer functions. I tried putting the 4 transfers in a for loop and also defining a local memory array that copies the contributors storage array, so that it does not get cold access for each element. But nothing of that worked. Could you give some tip that can help me solve this challenge? Thank you
The text was updated successfully, but these errors were encountered: