SafeMoon — Is it safe though? A detailed explanation of frictionless yield bug

Demonstration of the bug in the SafeMoon smart contract on BSC mainnet
Figure-1: Logic map of the gasless holder yield feature. The smart contract provides the distribution of holder rewards by following these steps after each on-chain transaction.
Figure-2: Functions used to exclude accounts from receiving SafeMoon gasless holder yields. _tOwned represents the balance of excluded accounts where _rOwned is the balance of accounts that are not excluded. currentRate is the weighting coefficient, k as we mentioned earlier.
Figure-3: During the inclusion of accounts, the rate of “currentRate = _rOwned / _tOwned” is lost due to the missing of 2 lines of code that should update the value of _rOwned.
Some of the projects involving the same bug in their smart contracts. The projects we have included in the list here are those with the highest daily volume and number of holders amongst the other projects that integrated the same RFI structure into their smart contracts. Since the exploitation of this bug causes holders to lose their funds, more users will be affected by this bug for projects with a higher number of holders.
Implementation of exclude and include functions in the PERA smart contract.

Pera Finance is the first DEX Optimizer designed to boost on-chain trading volume via trader incentives.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Five Blockchain intro video’s selected. Debunking!

Do Things That Don’t Decentralize

Get Started with LayerZero — Blockchain Roadmap

CoinEx Smart Chain Hackathon Comes To An End: What To Expect At The End

ZeroSwap — Hot Cross Pool is live!

How Big Players Are Adopting Blockchain Technology

Trias Review:Trustworthy and Reliable Intelligent Autonomous Systems

Partneship Announcement: Hunterverse collaborate with DareNFT & enter DarePlay’s ecosystem

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Pera Finance

Pera Finance

Pera Finance is the first DEX Optimizer designed to boost on-chain trading volume via trader incentives.

More from Medium

ETH-BSC Bridge Live on AnySwap

$THX Launch Update 🚨 5 days left

RECAP: Sunday AMA about Waves.Exchange

Introducing Harpy Finance