hello guys.. i have contract with just one fallback function, which delegate execution to another one contract. my question is, how to call this fallback function in order to execute code in another one contract? i figured out how to do this from my contract via abi.encodeWithSignature, but i need to execute this fallback not from contract.
if i understood right, fallback to be executed when you are trying to call not-existed method, but if i try to execute contract.something() i got an error that this function doesn’t exist… any advice how to do this? thank you!
Feb 14, 2022, 12:59 PM
you could try calling the fallback by just sending 0 ether to the contract
Feb 14, 2022, 2:27 PM
yeah, i’ve already figured out, thank you! 😁
Feb 14, 2022, 2:29 PM
https://docs.uniswap.org/protocol/V2/reference/smart-contracts/library
Feb 14, 2022, 2:48 PM
anybody knows how to fill smart contract’s balance without fallback / receive functions?
Feb 14, 2022, 3:09 PM
simply send to the contract of the sc?
Feb 14, 2022, 3:09 PM
no, it doesnt work
Feb 14, 2022, 3:10 PM
Without those, you'd need either some other payable function to call, or prefund the address before contract creation and use create2 to create contract at the address
Feb 14, 2022, 3:11 PM
the challange is to fill already deployed contract ))) btw, its the contract code 😂
Feb 14, 2022, 3:13 PM
Yeah if already deployed without a payable/fallback/receive, I don't think there's any way to add ether to it
Well, I guess you could also mine a block to that address, or selfdestruct another contract to that address...those may be the only ways
Feb 14, 2022, 3:15 PM
https://ethernaut.openzeppelin.com/level/0x22699e6AdD7159C3C385bf4d7e1C647ddB3a99ea
i don’t think this guys have tasks which you can't solve in any way))
i tried to fill from another one contract, but without any success
i don’t think this guys have tasks which you can't solve in any way))
i tried to fill from another one contract, but without any success
Feb 14, 2022, 3:15 PM
Never looked at that site but maybe selfdestruct
Feb 14, 2022, 3:16 PM
this guys have nice challenges about sc security.. why self destruct? you mean to deploy my own, implement their self destruct and call this method with target sc address as parameter?
Feb 14, 2022, 3:19 PM
yeah
forwards ether to the target
Feb 14, 2022, 3:19 PM
i’ll try, didn’t think in this way.. thanks for a clue))
Feb 14, 2022, 3:19 PM
no prob 😉
Feb 14, 2022, 3:20 PM
You can use function() payable if that's what they're asking for.
Feb 14, 2022, 3:21 PM
selfdestruct works.. could you explain why, please?)) why this code doesn’t work, but your method with selfdestruct works?
Feb 14, 2022, 3:41 PM
because the target contract has no payable fallback or receive function, so transfer won't work. Selfdestruct forces the ether to the target, regardless of payable fallback or receive functions
Feb 14, 2022, 3:43 PM
got that, thank you! 🙏
Feb 14, 2022, 3:43 PM
Feb 14, 2022, 4:10 PM
Knew it
@coffeeconverter thanks for exposing these scammers
Feb 14, 2022, 4:12 PM
no prob
i.e. if your swap is large compared to liquidity levels, you have large slippage in your swap tx
both effects are commonly referred to as slippage
one is caused by other txs, one is caused by your own swap tx
Feb 14, 2022, 4:29 PM
This is called price impact
Feb 14, 2022, 4:32 PM
yes, and also called slippage colloquially
some wallets use contracts
odd number is fine, since there would just be a 1 wei remainder
Feb 14, 2022, 6:22 PM
it's enought to revert right?
Feb 14, 2022, 6:22 PM
odd number? No, since, for example: 9/2 = 4
Feb 14, 2022, 6:23 PM
show us the whole contract
Feb 14, 2022, 6:24 PM
yeah, odd balance is OK
i'm betting it's either the modifier, or its being called as non-owner, or one of the wallets isnt an EOA
since 9/2 = 4, for instance
huh? 9/2 = 4. You now have 5 left
it must be that the wallets aren't EOAs, and one isn't payable, or it's running out of gas because transfer only forwards 2300
if the latter is the case, you'll need to use access lists. https://eips.ethereum.org/EIPS/eip-2930
Feb 14, 2022, 6:48 PM