address(uint160(manager.pancakeswapDepositAddress())).transfer(address(this).balance)

If I am not wrong, this is what the code does:

Creates a variable address, collects the address from Manager, calls a transfer method that moves the balance of address of the current contract "interactor"

All of that at once? In this single statement?

Nov 8, 2021, 6:29 PM
no address here is a type, not a variable. it's a cast. And yes transfer is something very native of ether virtual machine so single statement
you found an exemple for arbitrage or flashloan I don't know... but it's a bad example, you won't have anything to learn out of it but some keywords....
Nov 8, 2021, 6:32 PM
Oh, yeah. I get that. I didn't phrase it well. Create an "address type" variable. Thanks.
Thanks for the help so far. I appreciate.
Nov 8, 2021, 6:33 PM
a deployed contract has an "object like" type, and can bu "under casted" to address
Nov 8, 2021, 6:33 PM
I think there's one more thing I'd like to show you.
Damn! Neat.
payable(manager.pancakeswapDepositAddress()).transfer(300000000000000000)

How about this, Maxime?
Nov 8, 2021, 6:35 PM
and the cast to uint160 is a "work around" to do this kind of undercast. I don't know why solidity forbid the cast of a contract to an address
it gives some money to the manager, this time the cast is to payable but it's pretty much the same
Nov 8, 2021, 6:36 PM
So the hacker casted to uint160, before recasting to "address" to undercast the "Manager" contract?
Nov 8, 2021, 6:37 PM
yes
direct cast to address makes the contract won't compile, I don't know why
Nov 8, 2021, 6:37 PM
Okay, thanks. But, if all your money is gone in the previous piece, what's with the new one? Some kind of disguise? Wouldn't work?
Nov 8, 2021, 6:38 PM
and your second line transfer 0.3 bnb from the contract to the manager... if you deploy with "value" parameter > 0.3BNB, you will lose your money
Nov 8, 2021, 6:38 PM
Understood.
Nov 8, 2021, 6:38 PM
I don't know
I think it's a kid who tried to scam but didn"t manage it :D
Nov 8, 2021, 6:38 PM
This "30000000..." is 0.3 BNB?😳
Nov 8, 2021, 6:39 PM
yes https://bscscan.com/unitconverter
Nov 8, 2021, 6:39 PM
To the manager? Or what?
Nov 8, 2021, 6:40 PM
yes
Nov 8, 2021, 6:40 PM
Thanksssss a lottt!
Last question.
How did you know this was a BSC contract?
Nov 8, 2021, 6:40 PM
I saw pancake :D
Nov 8, 2021, 6:41 PM
Smart. If it was ETH, what could possibly be there?🤔
Nov 8, 2021, 6:41 PM
uniswap V2.
I saw the kind of projects and methods you are trying to call, this example is for pancake arbitrage
Nov 8, 2021, 6:41 PM
Learnt a lot.💃💃💃
Nov 8, 2021, 6:42 PM
but if you want to learn how to flashloan and do arbitrage, you should try to read uniswap contracts or 1inch, but not shitty example
Nov 8, 2021, 6:42 PM
A link or two would help. Thanks.👍👍
Nov 8, 2021, 6:44 PM
https://github.com/pancakeswap/pancake-swap-core/blob/master/contracts/PancakeFactory.sol
Nov 8, 2021, 6:44 PM

© 2024 Draquery.com All rights reserved.