GardenBlockchain

A historical PancakeSwap testnet deployment notebook

Keep the factory, router, pair bytecode hash, SDK, and frontend on the same deployment record.

The original notebook assembled an older PancakeSwap-style exchange on a testnet. Its main lesson is coordination: factory, router, wrapped native token, SDK constants, and frontend configuration must describe the same deployment.

Record the source revisions

git clone git@github.com:pancakeswap/pancake-swap-core.git
cd pancake-swap-core
git checkout -b factory 3b214306770e86bc3a64e67c2b5bdb566b4e94a7
yarn install
yarn compile
git clone git@github.com:pancakeswap/pancake-swap-periphery.git
cd pancake-swap-periphery
git checkout -b router d769a6d136b74fde82502ec2f9334acc1afc0732
yarn install
yarn add @uniswap/v2-core@"file:../pancake-swap-core"
yarn compile
git clone git@github.com:pancakeswap/pancake-swap-interface-v1.git
cd pancake-swap-interface-v1
git checkout -b v1 0257017f2daaae2f67c24ded70b5829f74a01b3c
yarn install

These commit IDs preserve the old source selection. The install commands are historical records, not a claim that current dependencies reproduce those artifacts.

Prepare contract sources

npm install sol-merger -g
sol-merger pancake-swap-core/contracts/PancakeFactory.sol ./build
sol-merger pancake-swap-core/contracts/PancakePair.sol ./build
sol-merger pancake-swap-periphery/contracts/PancakeRouter01.sol ./build
sol-merger pancake-swap-periphery/contracts/PancakeRouter.sol ./build

The source flattened the factory, pair, and router contracts for use in Remix. A flattening command does not establish compiler compatibility, bytecode identity, or security review. The recorded wrapped-token implementation is retained below.

Read the historical WBNB source
// SPDX-License-Identifier: GNU GENERAL PUBLIC LICENSE V3
pragma solidity =0.8.3;

contract WBNB {
    string public name     = "Wrapped BNB";
    string public symbol   = "WBNB";
    uint8  public decimals = 18;

    event  Approval(address indexed src, address indexed guy, uint wad);
    event  Transfer(address indexed src, address indexed dst, uint wad);
    event  Deposit(address indexed dst, uint wad);
    event  Withdrawal(address indexed src, uint wad);

    mapping (address => uint)                       public  balanceOf;
    mapping (address => mapping (address => uint))  public  allowance;

    receive() external payable {
        deposit();
    }

    function deposit() public payable {
        balanceOf[msg.sender] += msg.value;
        emit Deposit(msg.sender, msg.value);
    }

    function withdraw(uint wad) public {
        require(balanceOf[msg.sender] >= wad);
        balanceOf[msg.sender] -= wad;
        payable(msg.sender).transfer(wad);
        emit Withdrawal(msg.sender, wad);
    }

    function totalSupply() public view returns (uint) {
        return address(this).balance;
    }

    function approve(address guy, uint wad) public returns (bool) {
        allowance[msg.sender][guy] = wad;
        emit Approval(msg.sender, guy, wad);
        return true;
    }

    function transfer(address dst, uint wad) public returns (bool) {
        return transferFrom(msg.sender, dst, wad);
    }

    function transferFrom(address src, address dst, uint wad)
    public
    returns (bool)
    {
        require(balanceOf[src] >= wad);

        if (src != msg.sender && allowance[src][msg.sender] != type(uint).max) {
            require(allowance[src][msg.sender] >= wad);
            allowance[src][msg.sender] -= wad;
        }

        balanceOf[src] -= wad;
        balanceOf[dst] += wad;

        emit Transfer(src, dst, wad);

        return true;
    }
}

Source: WBNB Gist revision.

Keep the deployment record together

The source used chain ID 97. Record the selected chain, wrapped-token address, factory address, router address, and pair creation-code hash together. The SDK’s pair-address calculation must agree with the factory’s actual creation code; copying a hash from a different build can point the UI at the wrong address.

The old notebook then adjusted SDK constants, router/token configuration, and frontend environment values.

cd pancake-swap-interface-v1
cp .env.development .env
yarn start
yarn build

Its historical token/address catalog and demonstration frontend are omitted as live destinations. They are not current deployments or token recommendations. No exchange was deployed, liquidity supplied, transaction signed, or source command executed for this revision.

← Back to the garden