okay, there is no way i was going to be able to sleep w/o knowing this. this is actually highly relevant to a contract i'm going to deploy soon. i should have a very good understanding of the scary things the solidity compiler adds to a contract behind the developer's back

Jul 19, 2022, 10:36 PM
turns out that in this case, it doesn't add anything scary
there is no implicit non-payable receive function
here is the contract
https://rinkeby.etherscan.io/address/0xb984eB854439eca48448621d3B647295D849ebFC
and here is the deployed instance
it's got a balance
and the tx that gave it that balance has empty calldata
see: https://rinkeby.etherscan.io/tx/0x021f34a07950baa9251473c283199a73f7bcdc094d46f3be915c16192941e521
Jul 19, 2022, 10:37 PM
Ahahahahahahahahahahah
Jul 19, 2022, 10:38 PM
you can receive w/o a receive function even using modern solidity (i used the latest release: 0.8.15) and w empty calldata
Jul 19, 2022, 10:38 PM
This is the way
So, if i implement the fallback, there is no need of receive to let the contract receive eth?
But you must trigger it
Jul 19, 2022, 10:40 PM
correct
wdym?
Jul 19, 2022, 10:40 PM
fallback runs when you pass a wrong function identifier to the contract, i call it "triggered"
I do a swap, i trigger the transfer function
Jul 19, 2022, 10:41 PM
no. i linked the tx. just look at it. it's got empty calldata
i'll take a video to make it perfectly clear. and if i somehow still have an incorrect understanding (it's 1 am here and i'm super tired), please tell me
Jul 19, 2022, 10:42 PM
this trigger the fallback i guess :o
👍 sure, ty
with these i'm like
"ok i want to use ETH on my contract >> copy-paste receive function, ok"
Jul 19, 2022, 10:46 PM
here's the video twice. once in good quality, once in poor quality. idk how fast your connection is...
Jul 19, 2022, 10:48 PM
sending calldata empty with 1 wei
without any value
sending 3wei with ciao1 to fallz
to fallzWithRec
(btw remix got new update :3 )
3 wei to fallzWithRec (notice no console.log)
so at the end of the story, you must use receive() if you want to manage eth inside that specific contract
or at least, i've used it (empty) in nearly all my contracts
Jul 19, 2022, 11:03 PM
Btw don't use the remix vm. It's buggy af
Jul 20, 2022, 3:46 PM
hehe, love & hate with remix, nowdays i use it only for testing random codes or to interact with a contract with gui, not developing on it anymore since months
VSCode > all
Jul 20, 2022, 4:00 PM
Remix is convenient and buggy, especially the memory leaking one
Jul 20, 2022, 4:03 PM
i still remember that day when i lost the entire workspace, with all cool contracts
but they fixed it some versions ago
also it supports hardhat/console.log
Jul 20, 2022, 4:04 PM
oof happened to me as well, but those were random shitty contracts lol
Jul 20, 2022, 4:05 PM
Most of the letters are right but the order is completely scrambled. You appear to have pressed C-t a couple of times. It's spelled emacs
They keep fixing it and they keep breaking it in new ways
Jul 20, 2022, 5:39 PM
Even vscode > vim?
Jul 20, 2022, 8:05 PM

© 2024 Draquery.com All rights reserved.