Here is an interested question related to PUblic vs External visibility specifiers in Solidity.

Basically Public functions leads to more gas costs than external ones.

Reason being : in a public function, the arguments of the function are copied to memory while in External function, it's directly read from CALLDATA.

and since CALL DATA is cheaper than memory, external function costs less gas.

Now here is my question:

When a PUBLIC vs External function has no arguments at all and still the external function consumes less gas. What exactly is the reason behind it?

Would love to hear from you guys.

Jul 15, 2021, 2:23 PM
its only a bit of gas
what i would do, is if the function doesn't need to be used by the contract, then make it external
not sure
you can't call an external function from inside the contract
one sec
this wont compile
change func() to public and it will
Jul 15, 2021, 2:30 PM
Ah. I know that part sir. I am a Smart contract developer myself.

I am interested in knowing the mechanism behind..

The reason behind why this happens.
Anyone willing to discuss this ?
Jul 15, 2021, 2:32 PM
search google :S
Additionally, its only like a 200 gas difference
as if they are doing x that way, there is probably a reason
uniswap and openzeppelin have really good code
for example
Jul 15, 2021, 2:54 PM
Yeah, I agree!
Spaceowl going well btw? πŸ™‚ I was FOMO'd out of it by promises of pumps. I'm a TERRIBLE investor, better off sticking to code!
Jul 15, 2021, 2:56 PM
what is spaceowl?
me? lol
Jul 15, 2021, 2:56 PM
Your name? Thought you might be the dev.. πŸ™‚
A token, anyway. Been around a while.
Jul 15, 2021, 2:57 PM
I remember someone telling me that my name was same as a the name of a rug lol
that is what your talking about?
Jul 15, 2021, 2:57 PM
Oh, it rugged? Seemed stable and real, was around for a good while I think. Haven't really been market focused at all for quite a bit.
Jul 15, 2021, 2:59 PM
Lol, i don't even know about that token, other than someone telling me that there is a token with the same name as me
Jul 15, 2021, 2:59 PM
Righty-o. Maybe they saw you somewhere and thought "that's a cool name for our rugpull!"
Jul 15, 2021, 3:01 PM
when will someone ask for an actually serious project that isn't a fork? seems like 40% of people want forks
Jul 15, 2021, 3:03 PM
Why to reinvent the wheel... When can get open source code then make changes in front/back end ..
Jul 15, 2021, 3:05 PM
don't reinvent the wheel
make it better
instead of the same safemoon fork 1000 times
seems like everyone wants to make shit tokens
instead of actually building something
Jul 15, 2021, 3:06 PM
Safemoon blah ... Pancake swap for me is better
But bnb still can be very costly if you do even simple airdrop
Jul 15, 2021, 3:07 PM
pancakeswap clone is still shit
bro, if all you do is clone and not build on top of it. consider yourself a shit dev
Jul 15, 2021, 3:08 PM
And i personally prefer Kardiachain .. so develop a project ..fast secure and transactions are dirt cheap
Jul 15, 2021, 3:08 PM
sorry
Jul 15, 2021, 3:08 PM
Ok mr.Pro dev ...you build every single contract from scratch or ....
Jul 15, 2021, 3:09 PM
I am not a pro dev
Jul 15, 2021, 3:09 PM
Don't reinvent the wheel for things like standard interfaces, security stuff etc - definitely DO for the actual FEATURES of the project. Everything gets beaten to death in this space, sick and tired of it, feel so privileged to be leading and participating in a community that is going in the OPPOSITE direction!
Jul 15, 2021, 3:10 PM
this
Jul 15, 2021, 3:10 PM
Me neither bit i do my best to improve myself
Jul 15, 2021, 3:10 PM
"Oh indeed" -- Omar
Jul 15, 2021, 3:10 PM
but I just feel like if all you know how to do is copy and paste code, then your not a dev
Jul 15, 2021, 3:11 PM
Quite. But it's a starting point. I think anyone who is serious about Eth-based investment NEEDS to learn to at least read solidity, maybe even code simple stuff!
Jul 15, 2021, 3:12 PM
Copy /paste is not working like that ....you must know what are you doing if necessary change few lines of the code or add some function... Bsc is full with useless tokens that ppl just copy paste
Jul 15, 2021, 3:12 PM
πŸ‘πŸ½
Jul 15, 2021, 3:12 PM
You don’t sound like a dev
Jul 15, 2021, 3:15 PM
Techrate have good reputation
Jul 15, 2021, 3:31 PM
No got very bad name
Jul 15, 2021, 3:32 PM
So you want audit that's check the code line by line but also Free ....???
There's no free lunch Mr
Jul 15, 2021, 3:34 PM
I am not saying free Mr
Jul 15, 2021, 3:34 PM
whats your budget?
Jul 15, 2021, 3:34 PM
20K
Jul 15, 2021, 3:34 PM
consensys?
20k is enough for consensys iirc
Jul 15, 2021, 3:35 PM
OK we will check i thought they are costly
FYI i am also auditor Mr, i am checking one external audit for our platform
First read correctly
Jul 15, 2021, 3:36 PM
My bad :) excuse me
Jul 15, 2021, 3:36 PM
OK no issue, we have to respect each other
Jul 15, 2021, 3:37 PM
Of course
Jul 15, 2021, 3:37 PM
Thanks
Jul 15, 2021, 3:37 PM
RugDoge....
Kick that spammer
Jul 15, 2021, 4:20 PM
why would you say: "Do you think i'm a spammer?" Lol
Jul 15, 2021, 4:24 PM
+1
Jul 15, 2021, 4:24 PM
Anyone here has react and typescript UI developer I have a short term project
Jul 15, 2021, 4:25 PM
not sure if that would help though
Jul 15, 2021, 5:29 PM
Tbh, what are things like npm if not copy/paste on steroids, with usually good and reliable code that many people have used, reviewed and liked? If you can find a lazy solution to something mundane, or very useful like upgradeable contracts and new token standards, you're probably getting better code than you could create on your own and you get to work on your own idea! Sure, you should familiarise yourself with the code base you're using, but not "reinventing the wheel" is a great example of best practices that lead to higher quality code - package repositories and managers have been such a boon for developers imo.
Jul 15, 2021, 5:37 PM
but they have to be in the same folder, so import "./dir/dir/file.sol" wouldn't work
As it would've created the pair, or just call createPair on uniswap v2 factory
Jul 15, 2021, 6:11 PM

Β© 2024 Draquery.com All rights reserved.