Bamboo Smart Contract and Certik Audit Results

Maybe you weren’t sure if we were “gonna make it”, but we’re here! The Certik audit results were finalized by us, reviewed by our team, and are ready to be dispersed within the broader community. This simple article is to allow the broader community to view the audit results and to view the source code of the smart contracts ahead of deployment.

Another article will follow this one in a few days that will detail the steps to take for the migration, what to expect, and wen. That article will answer any questions left outstanding and will actually detail the migration process.

We welcome you to do your own personal audit of the Bamboo smart contract and migration smart contract. Both of those can be found below. Additionally, the links to the results from Certik’s audit can be found here.

Note: We’re still waiting on Certik’s final copy of the audit. The linked audit may be updated once we have that in our hands. It should be no different than what their v2 preliminary report shows that’s attached above.

Below is the smart contract for the Bamboo token.

// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import “@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol”;
import “@openzeppelin/contracts/access/Ownable.sol”;
contract Bamboo is ERC20Burnable, Ownable {string private constant SYMBOL = “BAM”;
string private constant NAME = “Bamboo”;
uint256 private constant INITIAL_SUPPLY = 100000000 * 10**9; // 100 million, precision 9
uint256 private constant INITIAL_FEE = 20;
uint256 private constant PRECISION = 10**9;
uint256 private constant PERCENT = 100;
address private constant NULL_ADDRESS = address(0);
uint256 public feeBuy;
uint256 public feeSell;
address public pool;
address public devWallet;
mapping(address => bool) public excludedFromFees;event Deployed(address sender, string symbol, string name);
event SetExcluded(address sender, address user, bool excluded);
event SetBuyFee(address sender, uint256 fee);
event SetSellFee(address sender, uint256 fee);
event SetDevWallet(address sender, address devWallet);
event SetPool(address sender, address pool);
constructor()
ERC20(SYMBOL, NAME)
{
_mint(_msgSender(), INITIAL_SUPPLY);
setBuyFeePercent(INITIAL_FEE);
setSellFeePercent(INITIAL_FEE);
emit Deployed(_msgSender(), SYMBOL, NAME);
}
function decimals() public view virtual override returns (uint8) {
return 9;
}
function setExcluded(address user, bool excluded) external onlyOwner {
excludedFromFees[user] = excluded;
emit SetExcluded(_msgSender(), user, excluded);
}
function setBuyFeePercent(uint256 feePercent) public onlyOwner {
require(feePercent < feeBuy, “Bamboo::setBuyFeePercent: can only reduce transaction fees”);
feeBuy = feePercent;
emit SetBuyFee(_msgSender(), feePercent);
}
function setSellFeePercent(uint256 feePercent) public onlyOwner {
require(feePercent < feeSell, “Bamboo::setSellFeePercent: can only reduce transaction fees”);
feeSell = feePercent;
emit SetSellFee(_msgSender(), feePercent);
}
function setDevWallet(address _devWallet) external onlyOwner {
devWallet = _devWallet;
emit SetDevWallet(_msgSender(), _devWallet);
}
function setPool(address _pool) external onlyOwner {
pool = _pool;
emit SetPool(_msgSender(), _pool);
}
function _transfer(
address sender,
address recipient,
uint256 amount
) internal override virtual {
address lpPool = pool;
address feeWallet = devWallet;
require(lpPool != NULL_ADDRESS, “Bamboo::_transfer: pool unitialized”);
require(feeWallet != NULL_ADDRESS, “Bamboo::_transfer: devWallet unitialized”);
if(sender == lpPool) {
if(!excludedFromFees[recipient]) {
uint256 devAmount = amount* feeBuy / PERCENT;
amount = amount — devAmount;
if(devAmount > 0) ERC20._transfer(sender, feeWallet, devAmount);
}
} else if (recipient == lpPool) {
if(!excludedFromFees[sender]) {
uint256 devAmount = amount * feeSell / PERCENT;
amount = amount — devAmount;
if(devAmount > 0) ERC20._transfer(sender, feeWallet, devAmount);
}
}
ERC20._transfer(sender, recipient, amount);
}
}

Below is the smart contract that will be used to facilitate the migration from $PinkPanda to $BAM.

// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import “./Bamboo.sol”;
import “@openzeppelin/contracts/access/Ownable.sol”;
contract BambooUpgrader is Ownable {Bamboo bamboo;
uint256 public constant CONVERSION_RATIO = 4510000; // 451 Trillion : 100 Million
address public constant PINKPANDA = 0x631E1e455019c359b939fE214EDC761d36bF6aD6; // BSC token contract address
uint256 public deadlineTime;mapping(address => uint256) public balancePinkPanda;event Deployed(address sender, uint256 deadlineTime, address bambooToken, uint256 bambooBalance);
event Deposited(address sender, uint256 amountPinkPanda);
event Withdrawal(address sender, uint256 amountBamboo);
event RecoverPinkPanda(address sender, uint256 amountPinkPanda);
event RecoverBamboo(address sender, uint256 amountBamboo);
modifier beforeDeadline {
require(block.timestamp < deadlineTime, “BambooUpgrader::beforeDeadline: current time is after deadline”);
_;
}
modifier afterDeadline {
require(block.timestamp >= deadlineTime, “BambooUpgrader:afterDeadline: current time is before deadline”);
_;
}
constructor(uint256 durationDays) {
bamboo = new Bamboo();
bamboo.transferOwnership(msg.sender);
deadlineTime = block.timestamp + durationDays * 1 days;
emit Deployed(msg.sender, deadlineTime, address(bamboo), bamboo.balanceOf(address(this)));
}
/**
@notice Transfer PinkPanda to this contract. User receives full credit for gross amount, regardless of fees subtracted. Tokens are locked.
*/
function depositPinkPanda(uint256 amountPinkPanda) external beforeDeadline {
balancePinkPanda[msg.sender] += amountPinkPanda;
emit Deposited(msg.sender, amountPinkPanda);
IERC20(PINKPANDA).transferFrom(msg.sender, address(this), amountPinkPanda);
}
function withdrawBamboo() external afterDeadline {
uint256 amountBamboo = bambooForPinkPanda(balancePinkPanda[msg.sender]);
delete balancePinkPanda[msg.sender];
emit Withdrawal(msg.sender, amountBamboo);
bamboo.transfer(msg.sender, amountBamboo);
}
/**
@notice Enables recovery of PinkPanda liquidity to convert to Bamboo liquidity
*/
function recoverPinkPanda() external onlyOwner afterDeadline {
uint amountPinkPanda = IERC20(PINKPANDA).balanceOf(address(this));
emit RecoverPinkPanda(msg.sender, amountPinkPanda);
IERC20(PINKPANDA).transfer(msg.sender, amountPinkPanda);
}
/**
@notice After the deadline, balance of Bamboo is otherwise unrecoverable. Needed for new liquidity pool.
*/
function recoverBamboo() external onlyOwner afterDeadline {
uint256 amountBamboo = unclaimedBamboo();
emit RecoverBamboo(msg.sender, amountBamboo);
bamboo.transfer(msg.sender, amountBamboo);
}
function bambooToken() external view returns(address) {
return address(bamboo);
}
function bambooForPinkPanda(uint256 amountPinkPanda) public pure returns(uint256 amountBamboo) {
amountBamboo = amountPinkPanda / CONVERSION_RATIO;
}
function unclaimedBamboo() public view returns(uint256 amountBamboo) {
uint256 claimable = bambooForPinkPanda(IERC20(PINKPANDA).balanceOf(address(this)));
amountBamboo = bamboo.balanceOf(address(this)) — claimable;
}

}

--

--

--

PinkPanda Holdings, Inc. is developing an intuitive and user friendly wallet for curated access to DeFi, NFT’s, and the metaverse on both iOS and Android.

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

Recommended from Medium

Managing Osquery with Kolide Launcher and Fleet

[OOP] : Plato and programming?

October 2021: The State of Machine Translation 2021, Integration with Verint Community, and more!

Programming in Scala Ch. 13

Creating a new flask app!

Parsing HTML pages using XPath

How Coding Aids in the Development of 21st Century Skills

Performant synchronized queue and stack data structures in Java

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
PinkPanda Finance (PinkPanda Holdings, Inc.)

PinkPanda Finance (PinkPanda Holdings, Inc.)

PinkPanda Holdings, Inc. is developing an intuitive and user friendly wallet for curated access to DeFi, NFT’s, and the metaverse on both iOS and Android.

More from Medium

Launching: Xeta Frontend V2

Dead Space Inu Presale

Now Earn Fixed APR of 24% on your staked EZ for 60 days

🔥 Phase 20 Is Now Live! 🔥