Skip to content

Commit

Permalink
All open, yay!
Browse files Browse the repository at this point in the history
  • Loading branch information
Chef-Cheems committed Apr 1, 2022
0 parents commit d8f5509
Show file tree
Hide file tree
Showing 428 changed files with 116,992 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .commitlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": ["@commitlint/config-conventional"],
"rules": {
"subject-case": [2, "always", "sentence-case"],
"type-enum": [
2,
"always",
["build", "ci", "chore", "docs", "feat", "fix", "perf", "refactor", "revert", "test", "security"]
]
}
}
6 changes: 6 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "@pancakeswap/eslint-config-pancake",
"rules": {
"import/no-extraneous-dependencies": 0
}
}
5 changes: 5 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# These owners will be the default owners for everything in
# the repo. Unless a later match takes precedence,
# @global-owner1 and @global-owner2 will be requested for
# review when someone opens a pull request.
* @chefpickle @ChefCupcake @Chef-Cheems
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2

updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
40 changes: 40 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Format

on:
workflow_dispatch:
pull_request:
push:
branches:
- master

jobs:
format:
name: Prettier
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 14.x

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install

- name: Run Prettier
run: yarn format:check
41 changes: 41 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Test

on:
workflow_dispatch:
pull_request:
push:
branches:
- master

jobs:
test:

name: Test
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 14.x

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Run tests
run: yarn test
35 changes: 35 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
node_modules

# testing
coverage

# production
dist

# misc
.DS_Store

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# env
.env

# artifacts/cache/data
artifacts
cache

coverage.json

@openzeppelin
@pancakeswap
bsc-library

Flatten*

.idea
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn commitlint --edit $1
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn format:check
6 changes: 6 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Global
projects/**/coverage/

# Project
projects/bsc-library/
projects/exchange-protocol/
16 changes: 16 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"printWidth": 120,
"overrides": [
{
"files": "*.sol",
"options": {
"printWidth": 120,
"tabWidth": 4,
"useTabs": false,
"singleQuote": false,
"bracketSpacing": false,
"explicitTypes": "always"
}
}
]
}
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Pancake Contracts 🥞

This repo contains all the contracts used in PancakeSwap. It is divided in independent projects where each of them contains its smart contracts, test environment and unique config files.

## Existing projects

| Project name | Description | Solidity version(s) |
| --------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | ------------------------ |
| [BSC Library](./projects/bsc-library) | Legacy implementation of BEP20/IBEP20/SafeBEP20. Not to be used for new contracts. | 0.6.12 |
| [Cake Vault](./projects/cake-vault) | CAKE vault ("AutoPool") contract that allows auto-compounding for CAKE tokens. | 0.6.12 |
| [Exchange Protocol](./projects/exchange-protocol) | Based on Uniswap V2, it combines peripheral and core trading and liquidity protocols. It also adds new features like zaps. | 0.5.16 / 0.6.6 / 0.8.4 |
| [Farms and Pools](./projects/farms-pools) | Based on SushiSwap's MasterChef, it also includes stand-alone pools and pool deployer. | 0.6.12 |
| [Farm Auctions](./projects/farm-auctions) | System for community-based auctions for future CAKE farms. | 0.8.4 |
| [IFO](./projects/ifo) | Initial Farm Offerings. | 0.6.12 |
| [Lottery](./projects/lottery) | V2 Lottery system for CAKE built using Chainlink's VRF. | 0.8.4 |
| [NFT Markets](./projects/nft-markets) | NFT marketplace for ERC721 tokens. | 0.8.4 |
| [Pancake Squad](./projects/pancake-squad) | Pancake Squad NFT collection. | 0.8.4 |
| [Predictions](./projects/predictions) | Prediction protocol contract built using Chainlink's oracle. | 0.6.12 (v1) / 0.8.4 (v2) |
| [Profile, NFT, and Gamification](./projects/profile-nft-gamification) | Pancake Bunnies NFT, NFT factories, and Profile system. | 0.6.12 |
| [SmartChef Factory](./projects/smartchef) | SmartChef (a.k.a. Syrup Pools) Factory | 0.6.12 (v1) / 0.8.4 (v2) |

## Create a new project

1 - Create a new folder inside `projects` <br/>
2 - Run `yarn init`

Commands inside the root `package.json` starting with `lerna` will run the corresponding command in each subproject.
54 changes: 54 additions & 0 deletions contracts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
export default {
cakeToken: {
97: "0xa35062141fa33bca92ce69fed37d0e8908868aae",
56: "0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82",
},
masterChef: {
97: "0x1d32c2945C8FDCBc7156c553B7cEa4325a17f4f9",
56: "0x73feaa1eE314F8c655E354234017bE2193C9E24E",
},
sousChef: {
97: "0xd3af5fe61dbaf8f73149bfcfa9fb653ff096029a",
56: "0x6ab8463a4185b80905e05a9ff80a2d6b714b9e95",
},
lottery: {
97: "0x99c2EcD51d52c036B00130d882Bc65f20Fdecf9f",
56: "0x3C3f2049cc17C136a604bE23cF7E42745edf3b91",
},
lotteryNFT: {
97: "0x8175c10383511b3a1C68f9dB222dc14A19CC950e",
56: "0x5e74094Cd416f55179DBd0E45b1a8ED030e396A1",
},
multiCall: {
56: "0x1ee38d535d541c55c9dae27b12edf090c608e6fb",
97: "0x67ADCB4dF3931b0C5Da724058ADC2174a9844412",
},
pancakeProfile: {
56: "0xDf4dBf6536201370F95e06A0F8a7a70fE40E388a",
97: "0x4B683C7E13B6d5D7fd1FeA9530F451954c1A7c8A",
},
pancakeBunnies: {
56: "0xDf7952B35f24aCF7fC0487D01c8d5690a60DBa07",
97: "0x60935F36e4631F73f0f407e68642144e07aC7f5E",
},
bunnyFactoryV3: {
56: "0xfa249Caa1D16f75fa159F7DFBAc0cC5EaB48CeFf",
97: "0x707CBF373175fdB601D34eeBF2Cf665d08f01148",
},
bunnyMintingStation: {
56: "0x78c2d17edb8a34fa00dd602994f16964d3fb4bab",
97: "0x95bdc68b0e8977e1c99caa06c6397dec59694387",
},
claimRefund: {
56: "0xE7e53A7e9E3Cf6b840f167eF69519175c497e149",
97: "",
},
pointCenterIFO: {
56: "0x3C6919b132462C1FEc572c6300E83191f4F0012a",
97: "0xd2Ac1B1728Bb1C11ae02AB6e75B76Ae41A2997e3",
},
bunnySpecialV1: {
56: "0xFee8A195570a18461146F401d6033f5ab3380849",
97: "0x7b7b1583De1DeB32Ce6605F6deEbF24A0671c17C",
},
};
8 changes: 8 additions & 0 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"npmClient": "yarn",
"version": "independent",
"useWorkspaces": true,
"packages": [
"projects/**"
]
}
48 changes: 48 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"name": "pancake-contracts",
"version": "1.0.0",
"description": "Pancake contracts",
"private": true,
"workspaces": [
"projects/**"
],
"repository": "https://github.com/pancakeswap/pancake-contracts",
"author": "PancakeSwap",
"license": "MIT",
"scripts": {
"format:check": "prettier --check 'projects/**/*.{js,ts,sol}'",
"format:write": "prettier --write 'projects/**/*.{js,ts,sol}'",
"prepare": "husky install",
"test": "lerna run test"
},
"devDependencies": {
"@commitlint/cli": "^12.1.4",
"@commitlint/config-conventional": "^12.1.4",
"@nomiclabs/hardhat-ethers": "^2.0.2",
"@nomiclabs/hardhat-truffle5": "^2.0.0",
"@nomiclabs/hardhat-web3": "^2.0.0",
"@openzeppelin/test-helpers": "^0.5.11",
"@pancakeswap/eslint-config-pancake": "^1.2.0",
"@pancakeswap/pancake-swap-lib": "0.0.4",
"@types/chai": "^4.2.21",
"@types/mocha": "^8.2.2",
"@types/node": "^14.14.35",
"chai": "^4.2.0",
"dotenv": "^8.2.0",
"eslint": "^7.22.0",
"ethereum-waffle": "^3.2.1",
"ethers": "^5.0.23",
"hardhat": "^2.4.1",
"hardhat-abi-exporter": "2.0.6",
"hardhat-contract-sizer": "^2.0.2",
"hardhat-watcher": "^2.1.1",
"husky": "^7.0.0",
"lerna": "^4.0.0",
"prettier": "^2.3.2",
"prettier-plugin-solidity": "^1.0.0-beta.17",
"solidity-coverage": "^0.7.13",
"ts-node": "^9.1.1",
"typescript": "^4.2.3",
"web3": "^1.3.6"
}
}
9 changes: 9 additions & 0 deletions projects/bsc-library/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# BSC Library

Legacy implementation of BEP20/IBEP20/SafeBEP20.

## Description

This repo contains legacy Solidity implementations for BEP20, IBEP20, and SafeBEP20 as the BSC alternatives to ERC20, IERC20, and SafeERC20.

These contracts **should not be used for new contracts**. Please use [OpenZeppelin contracts and libraries](https://github.com/OpenZeppelin/openzeppelin-contracts) for compatibility with new Solidity versions.
Loading

0 comments on commit d8f5509

Please sign in to comment.