otherwise anyone can use that function to transfer the token from any holder wallet to any other wallet

Jul 11, 2022, 12:28 PM
What? Hmm there must be some additional stuff in the transfer func (albeit I checked and no allowance checks)
But it’s a deployed token lol
I actually saw the transfer going before the allowance check on 2 different contracts
Just looked up
Oz erc20. Why the heck would forks have changed that lol?
Jul 11, 2022, 12:39 PM
It's pretty scammy, even if the tx of that transferfrom reverts the state of the balances affected by the transfer would change
Openzeppelin >> bible
Jul 11, 2022, 12:52 PM
What’s odd is that I looked at three different coins unrelated to each other, and they all have the same thing
Maybe they just originate from some other shitty codebase, But they are quite different in structure and implementation to be honest
Was is it a vulnerability fix?
Jul 11, 2022, 1:01 PM
No
Jul 11, 2022, 1:02 PM
Why move?
Jul 11, 2022, 1:02 PM
Just that it's best to make txs revert as early as possible if they have to revert
Jul 11, 2022, 1:02 PM
Ok
But will the balances revert too? Unlike this
Jul 11, 2022, 1:03 PM
My wrong, but from a workflow perspective was illogical πŸ˜…
Jul 11, 2022, 1:03 PM
Txs are atomic, all reverts
Jul 11, 2022, 1:03 PM
Ok thanks guys
Jul 11, 2022, 1:03 PM
Most gas optimization work is just trying to avoid touching storage as much as possible
Jul 11, 2022, 1:50 PM
why do you even need storage apart from mappings tbh
Jul 11, 2022, 1:53 PM
what
Jul 11, 2022, 1:54 PM
i hardly use storage in my contracts
Jul 11, 2022, 1:54 PM
What?
Jul 11, 2022, 1:54 PM
how do you stare a variable?
Jul 11, 2022, 1:54 PM
If you need persistence you need storage
Jul 11, 2022, 1:55 PM
yess, i mean storage keyword. Variables are automatically storage
Jul 11, 2022, 1:55 PM
:o!
You mean assign everything in a mapping?
Jul 11, 2022, 1:55 PM
no πŸ˜‚
Jul 11, 2022, 1:55 PM
Frankenstein vibes
πŸ˜‚πŸ˜‚πŸ˜‚
Jul 11, 2022, 1:55 PM
Why use multiple variables if a mapping uint->bytes32 can handle all my needs
Jul 11, 2022, 1:57 PM
Otherwise you should use ethers.js in console and write every single row everytime
πŸ‘€
Jul 11, 2022, 1:59 PM
it's what the t100 runs on
also
Jul 11, 2022, 1:59 PM
Foundry is something i want to learn soon
Seems very powerful
Jul 11, 2022, 2:00 PM
++i is better than i++ fyi
Jul 11, 2022, 2:00 PM
Yeah it's awesome, a bit acerb on some things but it's already great even lacking some stuff
Jul 11, 2022, 2:01 PM
guys, is it better to store everything in bytes over string?
Jul 11, 2022, 2:01 PM
The lack of something to check coverage is what keeps me still in truffle/hardhat on some projects
Jul 11, 2022, 2:02 PM
But HardHat + foundry 😱😱
Jul 11, 2022, 2:03 PM
When creating functions, it is best to remember that internal and external functions are cheaper than public functions. Public functions copy the function parameters to memory unlike internal and external. The cost becomes greater when the function has a lot of parameters. Also, it is cheaper to have one big function than to break it into smaller functions.
i need to spend a good day optimizing my contract
Jul 11, 2022, 2:05 PM
Idk where you are getting that info
Jul 11, 2022, 2:08 PM
https://mudit.blog/solidity-tips-and-tricks-to-save-gas-and-reduce-bytecode-size/#2a76
Jul 11, 2022, 2:09 PM
https://forum.openzeppelin.com/t/a-collection-of-gas-optimisation-tricks/19966/6
Jul 11, 2022, 2:10 PM
It really feels like gpt-3
There is nothing about function visibility there
Jul 11, 2022, 2:11 PM
I only remember external cheaper than public
Jul 11, 2022, 2:11 PM
That impacts just the deployment costs
Jul 11, 2022, 2:11 PM
yep? why we only talking about function visibility?
this is a good one.forgot about this
This extra costs can be avoided by caching the array length (in stack):
Jul 11, 2022, 2:12 PM
And having useless functions accessible from the outside impacts in a very small way the execution cost just because of the function dispatch
Jul 11, 2022, 2:12 PM
uint length = arr.length;
for (uint i = 0; i < length; i++) {
// do something that doesn't change arr.length
}
Jul 11, 2022, 2:12 PM
Your text was about that
Here
Jul 11, 2022, 2:12 PM
ahh, my bad. meant overall
Jul 11, 2022, 2:13 PM
when calling public vs external
external use calldata while public memory no?
oh wait
Jul 11, 2022, 2:14 PM
dunno about that. but i know call data is better for function params
Jul 11, 2022, 2:14 PM
my knowledge has stopped at old solidity version
Jul 11, 2022, 2:14 PM
πŸ˜‚
Jul 11, 2022, 2:14 PM
Wen solidity 1.0?
Can devs do something?
Jul 11, 2022, 2:15 PM
🀣🀣
Jul 11, 2022, 2:15 PM
Need to shill more guys
Jul 11, 2022, 2:16 PM
when lambo?
Jul 11, 2022, 2:16 PM
https://forum.soliditylang.org/t/public-visibility-or-external-visibility-from-an-auditing-perspective/427/4
Jul 11, 2022, 2:17 PM
(for now, u.u)
Jul 11, 2022, 4:15 PM
I don’t rly
Get how arbitrage works when dex pools have like 0.3% base fees and slippage. Are big players actually still having a good run in this niche?
Swapping from x to y to x cost almost a percent on some dex lol
Jul 11, 2022, 4:36 PM
oh boi there are so many opportunities but no meat for the poor devs
you can liderally send a transaction with 0 gas price if you are the block producer on bsc
and sort it to the top
https://bscscan.com/tx/0xc5fff8dfd621b964fabcd9e240d3a6d72927edb5f5195d9d41d6eb0a1859c92a
Jul 12, 2022, 10:18 PM
To be a block producer on bsc you need to be a validator, and there are only 21 on bsc by design, yeah that seems easy
Jul 12, 2022, 10:39 PM
is binance sorting txs on cex too?
i think yes the other scenario would be a little weird cz cant do anything for free
Jul 12, 2022, 10:50 PM
There are no txs on a cex
Jul 12, 2022, 10:50 PM
yeah i knw
you got the idea
Jul 12, 2022, 10:51 PM
Cex is a dictatorship where the owner of the cex is free to do whatever he wants, so up to the cex to decide the criterions that make one order fill or the other etc.
They'd also have the power to change your balances at will etc. They are only limited by the law
Jul 12, 2022, 10:54 PM
like a bank
Jul 12, 2022, 10:54 PM
Yeah
Jul 12, 2022, 10:54 PM
which law hehe
Jul 12, 2022, 10:57 PM

Β© 2024 Draquery.com All rights reserved.