An Interest In:
Web News this Week
- March 21, 2024
- March 20, 2024
- March 19, 2024
- March 18, 2024
- March 17, 2024
- March 16, 2024
- March 15, 2024
May 20, 2021 05:59 am GMT
Original Link: https://dev.to/chrisza4/smart-contract-pancake-bunny-1g7n
Smart Contract Pancake Bunny
Pancake Bunny
Smart contract Gas Smart Contract
Gas
( 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:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To