Is there anyone sharing the same opinion that the use of UQ112X112 by Uniswap is unnecessary at all? Can all uint112, and uint32 be replace with uint256? Does the gas cost change much, considering the overhead costs of downsizing uint256 to uint112 and all other encoding, decoding functions?

Jun 13, 2021, 5:56 AM
reserves isย 112, for calc these reserves are conv to 224
112 was chosen because, in a 256 bits slot, these reserves can be stored in uint224, leaving 32 bits storage free.
Jun 13, 2021, 6:52 AM
This is no doubt a neat design with a lot of overheads. Although using plain uint256 can increase storage cost, it can save overhead costs. At the end, it's hard to tell whether using uint112 is a good choice, besides, it's making it hard to upgrade, let alone making readability worse. Just my thoughts and I'm trying to convert the contracts into 0.8+ versions.
Jun 13, 2021, 7:02 AM
There is an overhead yes, but in the longrun 112 is always preferred. Reserve balance gets modified on each and every swap and if your token in popular enough...
Jun 13, 2021, 7:08 AM
Yes, you are right on this point. Or alternatively, there ought to be like a vanilla version. Easier to read and implement at the cost of higher gas fees.
Jun 13, 2021, 7:11 AM
Uniswap never intended to make their code easier to read imo๐Ÿ™ƒ
Ok there might be gas fee concerns but still...
Jun 13, 2021, 7:13 AM
Their white paper says they try to reduce the exposure surface. They did well on this.
interface IPancakeCallee {
function pancakeCall(address sender, uint amount0, uint amount1, bytes calldata data) external;
}
@mrrobot3_3 Do you know what this function does?
Jun 13, 2021, 7:25 AM
Hmm where is this defined? Or being used
Jun 13, 2021, 7:31 AM
is it in pancake factory maybe?
Jun 13, 2021, 7:31 AM
It is in the swap function in PancakePair contract
Jun 13, 2021, 7:32 AM
Yes but you must send the function
Jun 13, 2021, 7:32 AM
I think it is a design to keep the ability of passing calldata open. There is no actual implementation anywhere else.
Jun 13, 2021, 7:34 AM
yes it must be
Jun 13, 2021, 7:35 AM
I assume it's safe to delete it, if I'm designing a swap contract for regular known ERC20 tokens which I do not expect having calldata being passed in. This is what I meant a vanilla version, keeping everything as simple as possible.
Jun 13, 2021, 7:36 AM
Thats for custom routers
Jun 13, 2021, 7:44 AM
are you trying to do a flash swaps?
Jun 13, 2021, 7:44 AM
What do you mean?
Nah, just for a normal ERC20 token.
Jun 13, 2021, 7:44 AM
Swap function takes in an additional parameter as data. So if the to address is a contract rather than eoa, it will call the function pancakecall on that contract with the given data
So if you build a custom router which instead of sending the tokens directly to the caller, takes the token to itself, perform some action based on the definition of pancakecall and then sends to actual sender, you need that
Normally the data is kept 0 I think
Jun 13, 2021, 7:49 AM
Nice, and to is supposed to be an EOA right? I think instead, putting require(!isContract(to)) can eliminate that kind of situation, what do you think?
Jun 13, 2021, 7:49 AM
To can either be eoa or normal address based on the parameter data. If the data is not empty, to must be a contract or the transaction will fail
Hence the check data.length > 0
Jun 13, 2021, 7:51 AM
@mrrobot3_3 Right, I guess they had smart contract traders in mind when designing this.
Jun 13, 2021, 7:52 AM
One usecase I can think of is building your own exchange, but with using the liquidity of pancakeswap itself.
Jun 13, 2021, 7:54 AM
@mrrobot3_3 Not sure if this is what you meant, were you thinking it is making sharing liquidity among exchanges possible?
Jun 13, 2021, 7:58 AM
You want to make an exchange
You don't have any capital for liquidity nor marketing skills
You create a fancy router with some extended functionalities than pancakes router
Instead of using your own lp, you refer pacakes factory
So custom router powered by pancakes liquidity
...
Profit?๐Ÿ™ƒ
Jun 13, 2021, 8:01 AM
Alright. That's beyond me for now. I'll take a note of this somewhere and come back at it. For now, I'll just delete it. I like this quote "Everything should be made as simple as possible, but not simpler."
Another quick question: I took a look at the USDT and BUSD contracts. They are no different from any other standard ERC20 token contract. So basically, the issuers say they are stable, because an equivalent amount of collaterals have been deposited to a trusted third party, and then the market takes it as stable coins. Is this how USDT and BUSD work?
Jun 13, 2021, 8:33 AM
Hmmm thatโ€™s scary
Jun 13, 2021, 8:38 AM
Yeah. They have a reserve in which for every usdt minted, corresponding amount of real USD is stored. I think there is provision to provide usdt and get actual us dollar (not sure, but there are stablecoins that does this).
Completely centralized. They can even blacklist users and recover funds if there was an accidental transaction
Jun 13, 2021, 8:58 AM
do you know about IRON stable?
I just discovered it few days ago. It should be like an algo stable but "safer"
Jun 13, 2021, 9:01 AM
https://www.coindesk.com/tether-first-reserve-composition-report-usdt

Did a quick google and this is what came up. So yeah, not really 1:1 reserve, but reserve is there
Never heard of it
Jun 13, 2021, 9:02 AM
If someone is interested https://docs.iron.finance/
Jun 13, 2021, 9:03 AM
Honestly, my real life job is not even remotely related to blockchain. No kidding
Jun 13, 2021, 9:07 AM
do you want it to be?
Jun 13, 2021, 9:09 AM
Not really. I am happy with my current job and makes a decent amount out of it
Life is good๐Ÿ™‚
Yeah. Search in the jobs group, I'm sure there are many pros in there @AdamTokenAdvisors
Jun 13, 2021, 9:12 AM
https://soliditydeveloper.com/deploy-to-binance-smart-chain
Jun 13, 2021, 9:24 AM
you can if you modified the renounce function
you should save the last owner before the renounce is called
here you should add something like:
if(_lastOwner == my address) can do things
Jun 13, 2021, 9:54 AM
Can u check with this link? what the hack?
NO these lines not being added
Looks like dev extra smart, He renouced correct and aftr that made it honeypot
I'm not very good at it, so can u guys understand it?
Jun 13, 2021, 9:57 AM
This will not be possible on actual ownable contract. There would be some backdoor. Gimme a min
Jun 13, 2021, 9:58 AM
wtf it is private
how did he called it
ahhhh
transferOwne
not transferOwnership
Jun 13, 2021, 9:59 AM
ohh fuk
Can't beliive skilled devs are doing scams
Jun 13, 2021, 10:00 AM
Haha figured it
Jun 13, 2021, 10:00 AM
this is
Jun 13, 2021, 10:00 AM
That's one sneaky mofo
Jun 13, 2021, 10:00 AM
wow, please tell, I'm curios
Jun 13, 2021, 10:00 AM
There it is
Jun 13, 2021, 10:00 AM
owner and Owner
Jun 13, 2021, 10:00 AM
Two variables
Jun 13, 2021, 10:00 AM
very smart the dev ahah
Jun 13, 2021, 10:01 AM
why 2 times?
Jun 13, 2021, 10:01 AM
to scam ahah
Jun 13, 2021, 10:02 AM
what happened if he used 2 variables?
Jun 13, 2021, 10:02 AM
He changed _owner while renouncing, but kept _Owner as real owner
Jun 13, 2021, 10:02 AM
What actually happened, can u explaing? how he executed this? my one friend stuck
Jun 13, 2021, 10:02 AM
To give the illusion of renouncing
Check line 412 and 419
Using _owner while renouncing and _Owner for actual owner check
Jun 13, 2021, 10:04 AM
so the He changed the real owner and renounced using old owner?
Jun 13, 2021, 10:04 AM
No he used one additional variable as decoy and changed it while keeping the real one unchanged
Jun 13, 2021, 10:05 AM
so he was doing these changes while renouncing?
Jun 13, 2021, 10:06 AM
Can we talk PM?
Jun 13, 2021, 10:06 AM
Is it also new to you?
Jun 13, 2021, 10:06 AM
Two variables
_owner - fake
_Owner - real
While renouncing
Changed _owner to 0x0
_Owner remain unchanged

Since _Owner is unchanged, he can call all the onlyOwner functions
Jun 13, 2021, 10:09 AM
๐Ÿ˜ต
Jun 13, 2021, 10:10 AM
Yeah sure
Jun 13, 2021, 10:11 AM
You tried tweaking it to your standard? Or are you just missing steps on launching
What procedure did you use?
Jun 13, 2021, 10:52 AM
lol, best thing is people actually thought he renounced
how knowing solidity can save you from getting rugged :P
Jun 13, 2021, 11:15 AM
My little miniSwap is up and running. Every contract has been rewritten to 0.8.4. @mrrobot3_3 The code is so much cleaner.
Jun 13, 2021, 1:14 PM
Good job๐Ÿ™‚
Your own lp or pancakes?
Jun 13, 2021, 1:24 PM
Will use CAKE eventually. Right now, it's a toy lp token.
Jun 13, 2021, 1:24 PM
Is it open source
Jun 13, 2021, 1:54 PM
these swap tokens for bnb/eth and send to charity
or you want privacy
Jun 13, 2021, 3:27 PM
anyone know how to fetch the jazzicons metamask uses?
not really solidity
but this is the best place I can think of to ask
๐Ÿ‘€
Jun 13, 2021, 3:47 PM
it is the right one
Jun 13, 2021, 3:48 PM
๐Ÿ˜
Jun 13, 2021, 3:51 PM
It will be.
Jun 14, 2021, 12:26 AM
It's what's it says
Jun 14, 2021, 2:15 AM

ยฉ 2024 Draquery.com All rights reserved.