Skip to content

Commit

Permalink
Fix package.json naming + work on tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mooncakehero committed Sep 21, 2020
1 parent 6c0f9af commit 023e6dc
Show file tree
Hide file tree
Showing 6 changed files with 976 additions and 1,715 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "pancake/core",
"name": "pancake-swap-core",
"description": "🎛 Core contracts for the pancake protocol",
"version": "1.0.1",
"homepage": "https://pancakeswap.finance",
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions test/UniswapV2Factory.spec.ts → test/PancakeFactory.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { solidity, MockProvider, createFixtureLoader } from 'ethereum-waffle'
import { getCreate2Address } from './shared/utilities'
import { factoryFixture } from './shared/fixtures'

import UniswapV2Pair from '../build/UniswapV2Pair.json'
import PancakePair from '../build/PancakePair.json'

chai.use(solidity)

Expand All @@ -16,7 +16,7 @@ const TEST_ADDRESSES: [string, string] = [
'0x2000000000000000000000000000000000000000'
]

describe('UniswapV2Factory', () => {
describe('PancakeFactory', () => {
const provider = new MockProvider({
hardfork: 'istanbul',
mnemonic: 'horn horn horn horn horn horn horn horn horn horn horn horn',
Expand All @@ -38,7 +38,7 @@ describe('UniswapV2Factory', () => {
})

async function createPair(tokens: [string, string]) {
const bytecode = `0x${UniswapV2Pair.evm.bytecode.object}`
const bytecode = `0x${PancakePair.evm.bytecode.object}`
const create2Address = getCreate2Address(factory.address, tokens, bytecode)
await expect(factory.createPair(...tokens))
.to.emit(factory, 'PairCreated')
Expand All @@ -51,7 +51,7 @@ describe('UniswapV2Factory', () => {
expect(await factory.allPairs(0)).to.eq(create2Address)
expect(await factory.allPairsLength()).to.eq(1)

const pair = new Contract(create2Address, JSON.stringify(UniswapV2Pair.abi), provider)
const pair = new Contract(create2Address, JSON.stringify(PancakePair.abi), provider)
expect(await pair.factory()).to.eq(factory.address)
expect(await pair.token0()).to.eq(TEST_ADDRESSES[0])
expect(await pair.token1()).to.eq(TEST_ADDRESSES[1])
Expand Down
2 changes: 1 addition & 1 deletion test/UniswapV2Pair.spec.ts → test/PancakePair.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const overrides = {
gasLimit: 9999999
}

describe('UniswapV2Pair', () => {
describe('PancakePair', () => {
const provider = new MockProvider({
hardfork: 'istanbul',
mnemonic: 'horn horn horn horn horn horn horn horn horn horn horn horn',
Expand Down
8 changes: 4 additions & 4 deletions test/shared/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { deployContract } from 'ethereum-waffle'
import { expandTo18Decimals } from './utilities'

import ERC20 from '../../build/ERC20.json'
import UniswapV2Factory from '../../build/UniswapV2Factory.json'
import UniswapV2Pair from '../../build/UniswapV2Pair.json'
import PancakeFactory from '../../build/PancakeFactory.json'
import PancakePair from '../../build/PancakePair.json'

interface FactoryFixture {
factory: Contract
Expand All @@ -17,7 +17,7 @@ const overrides = {
}

export async function factoryFixture(_: Web3Provider, [wallet]: Wallet[]): Promise<FactoryFixture> {
const factory = await deployContract(wallet, UniswapV2Factory, [wallet.address], overrides)
const factory = await deployContract(wallet, PancakeFactory, [wallet.address], overrides)
return { factory }
}

Expand All @@ -35,7 +35,7 @@ export async function pairFixture(provider: Web3Provider, [wallet]: Wallet[]): P

await factory.createPair(tokenA.address, tokenB.address, overrides)
const pairAddress = await factory.getPair(tokenA.address, tokenB.address)
const pair = new Contract(pairAddress, JSON.stringify(UniswapV2Pair.abi), provider).connect(wallet)
const pair = new Contract(pairAddress, JSON.stringify(PancakePair.abi), provider).connect(wallet)

const token0Address = (await pair.token0()).address
const token0 = tokenA.address === token0Address ? tokenA : tokenB
Expand Down
Loading

0 comments on commit 023e6dc

Please sign in to comment.