Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
May 20, 2021 05:59 am GMT

Smart Contract Pancake Bunny

Pancake Bunny

Smart contract Gas Smart Contract

Gas

Src

( https://peckshield.medium.com/pancakebunny-incident-root-cause-analysis-7099f413cc9b)


if (IPancakePair(asset).token0() == WBNB) {  valueInBNB = amount.mul(reserve0).mul(2).div(IPancakePair(asset).totalSupply());  valueInUSD = valueInBNB.mul(priceOfBNB()).div(1e18);} else if (IPancakePair(asset).token1() == WBNB) {  valueInBNB = amount.mul(reserve1).mul(2).div(IPancakePair(asset).totalSupply());  valueInUSD = valueInBNB.mul(priceOfBNB()).div(1e18);}//  


valueInBNB = amount.mul(reserve0).mul(2).div(IPancakePair(asset).totalSupply());//  `valueInBNB = amount.mul(reserve1).mul(2).div(IPancakePair(asset).totalSupply());

reserve if token1() == WBNB Reserve WBNB amount * reserve * 2 / totalSupply()


uint reserveBNBif (IPancakePair(asset).token0() == WBNB) {  reserveBNB = reserve0} else if (IPancakePair(asset).token1() == WBNB) {  reserveBNB = reserve1}valueInBNB = amount.mul(reserveBNB).mul(2).div(IPancakePair(asset).totalSupply());

BNB Pool " Reserve "

Condition 3 Solidity if Gas Solidity

Gas


Original Link: https://dev.to/chrisza4/smart-contract-pancake-bunny-1g7n

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To