yuichiroaoki / poly-flash

Flashloan on Polygon
https://yuichiroaoki.medium.com/no-flashloan-fee-with-dodo-cc78215d7f93
MIT License
294 stars 174 forks source link

Frontrunning protection #49

Open yuichiroaoki opened 2 years ago

yuichiroaoki commented 2 years ago

Anyone can interact with your contract with this current version, so it is theoretically vulnerable to frontrunning attacks

Ideas

krshyzdn commented 2 years ago

That's why many are changing from ETH and BSC to polygon and etc. First of all anyone trying to take profit needs a personal contract which is at least slightly different to this one which is of course a template. Since deploying it just on new address keeps the same ABI and any frontrunner can listen to its TXs. Other thing that may help is migrating to networks with lesser bots. maybe polygon and the one I'm focusing right now Arbitrum. ARB blocks contain only one TX and is almost immediate.

recidive commented 1 year ago

Hi @krshyzdn ! How is arbitrage opportunities at Arbitrum? Thanks!

rolandweb3 commented 2 months ago

Anyone can interact with your contract with this current version, so it is theoretically vulnerable to frontrunning attacks

Ideas

  • Add something like the ownable modifier from OpenZeppelin to the flashloan function This doesn't solve the issue because some could have its own clone of your contract and if it detects a profitable transaction, create a new one against his own contract instance with a higher fee.

If I run flashloan.ts on polygon it will not execute trrade, instead it's giving the same txn hash, It's not even found on polygon scan, pllease is there any solution? Screenshot (29)