Skip to content
This repository has been archived by the owner on Oct 14, 2021. It is now read-only.

success factory #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
MNEMONIC="call glow acoustic vintage front ring trade assist shuffle mimic volume reject"
INFURA_TOKEN="a30ce8978acb4d7da82e6d7e6b71afb7"
ETHERSCAN_KEY="HSR39CEBP479H5TBJTXR693XMATW8T68KE"
BSCSCAN_KEY="JQX4RQZFG69R7UUWEACP5VGSI7ZVREDY8S"
31 changes: 31 additions & 0 deletions migrations/1_initial_migration.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const Migrations = artifacts.require("Migrations");
const PancakeFactory = artifacts.require("PancakeFactory");

module.exports = async (deployer,net,addresses) => {
// await deployer.deploy(Migrations);
// const factory = await deployer.deploy(PancakeFactory, addresses[0]);

// console.log('Factory: ', factory.address);
// console.log('INIT HASH: ', await factory.INIT_CODE_PAIR_HASH());

const factory = await PancakeFactory.deployed();
const lPToken = await factory.getPair('0x381316ed98bcd9E28661F953DECc22f910Fa98fD', '0x5683e8c773E9fD01CAa9bD59b74f7Ed925745774');

console.log('LPToken: ', lPToken);

//Local:
// Green Token: 0xA01DD36ec74A64D1069EE57e154964683a5C25De
// Yellow Token: 0x543f5288F382aCc72D1743747f035Cb44bbBdD5b
};

// bscTestnet 12am 22-4-21
// Factory: 0xD02F09b5131B9593BCBee5427562908f0F806Dda
// INIT HASH: 0xf4c741b552690ebc6d0fbc9b0c881422ff1572ff8e78659b2f242021759f4e86

// Green Token: 0x381316ed98bcd9E28661F953DECc22f910Fa98fD
// Yellow Token: 0x5683e8c773E9fD01CAa9bD59b74f7Ed925745774

// LP Token Green/Yellow Token 0xeC33E6421D7746E186EffFEEB02A9fE853c26d26

// WETH 0x11E3E9f259e0273369542D1a1eE315e0EA065Cd0
// Router01 0xCc58f119a8D0598EeEf19b6E5Bff07c9a0Bc4A17
12 changes: 9 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,15 @@
"prettier": "^1.19.1",
"rimraf": "^3.0.0",
"solc": "0.5.16",
"truffle-plugin-verify": "^0.4.0",
"truffle-plugin-verify": "^0.4.6",
"ts-node": "^8.5.4",
"typescript": "^3.7.3"
},
"scripts": {
"deploy": "truffle migrate --network bscTestnet --reset && truffle run verify PancakeFactory --network bscTestnet",
"comment1": " ",
"comment2": " ",
"comment3": " ",
"lint": "yarn prettier ./test/*.ts --check",
"lint:fix": "yarn prettier ./test/*.ts --write",
"clean": "rimraf ./build/",
Expand All @@ -43,8 +47,10 @@
},
"license": "GPL-3.0-or-later",
"dependencies": {
"truffle-hdwallet-provider": "^1.0.17",
"@truffle/hdwallet-provider": "^1.2.6",
"dotenv": "^8.2.0",
"truffle": "^5.1.41",
"truffle-flattener": "^1.4.4"
"truffle-flattener": "^1.4.4",
"truffle-hdwallet-provider": "^1.0.17"
}
}
29 changes: 17 additions & 12 deletions test/PancakeERC20.spec.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
import chai, { expect } from 'chai'
import { Contract } from 'ethers'
import { MaxUint256 } from 'ethers/constants'
import { bigNumberify, hexlify, keccak256, defaultAbiCoder, toUtf8Bytes } from 'ethers/utils'
import { solidity, MockProvider, deployContract } from 'ethereum-waffle'
import { ecsign } from 'ethereumjs-util'

import { expandTo18Decimals, getApprovalDigest } from './shared/utilities'

import ERC20 from '../build/ERC20.json'

// const chai = require('chai');
const expect = require('chai').expect;
const {Contract} = require('ethers');
const MaxUint256 = require('ethers/constants').MaxUint256;
const bigNumberify = require('ethers/utils').bigNumberify;
const hexlify = require('ethers/utils').hexlify;
const keccak256 = require('ethers/utils').keccak256;
const defaultAbiCoder = require('ethers/utils').defaultAbiCoder;
const toUtf8Bytes = require('ethers/utils').toUtf8Bytes;
const solidity = require('ethereum-waffle').solidity;
const MockProvider = require('ethereum-waffle').MockProvider;
const deployContract = require('ethereum-waffle').deployContract;
const ecsign = require('ethereumjs-util').ecsign;
const expandTo18Decimals = require('./shared/utilities').expandTo18Decimals;
const getApprovalDigest = require('./shared/utilities').getApprovalDigest;
const ERC20 = require('../build/ERC20.json');
chai.use(solidity)

const TOTAL_SUPPLY = expandTo18Decimals(10000)
Expand All @@ -22,7 +27,7 @@ describe('PancakeERC20', () => {
})
const [wallet, other] = provider.getWallets()

let token: Contract
let token = typeof Contract
beforeEach(async () => {
token = await deployContract(wallet, ERC20, [TOTAL_SUPPLY])
})
Expand Down
85 changes: 85 additions & 0 deletions truffle-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
var HDWalletProvider = require('@truffle/hdwallet-provider');
require('dotenv').config();
const MNEMONIC = process.env.MNEMONIC;
const token = process.env.INFURA_TOKEN;
const etherscanKey = process.env.BSCSCAN_KEY;

module.exports = {
networks: {
develop: {
host: '127.0.0.1',
port: 8545,
network_id: '*',
gas: 6721975,
},
development: {
host: '127.0.0.1',
port: 7545,
network_id: '*',
gas: 6721975,
},
bscTestnet: {
provider: () => {
return new HDWalletProvider(
MNEMONIC,
'https://data-seed-prebsc-1-s1.binance.org:8545'
);
},
network_id: '97',
},

bscMainnet: {
provider: () => {
return new HDWalletProvider(
MNEMONIC,
'https://bsc-dataseed.binance.org'
);
},
network_id: '56',
},

mainnet: {
provider: () => {
return new HDWalletProvider(
MNEMONIC,
'https://mainnet.infura.io/v3/' + token
);
},
network_id: '1',
},
ropsten: {
provider: () => {
return new HDWalletProvider(
MNEMONIC,
'https://ropsten.infura.io/v3/' + token
);
},
network_id: '3',
},
kovan: {
provider: () => {
return new HDWalletProvider(
MNEMONIC,
'https://kovan.infura.io/v3/' + token
);
},
network_id: '42',
skipDryRun: true,
},
},
plugins: ['truffle-plugin-verify'],
api_keys: {
etherscan: etherscanKey,
},
compilers: {
solc: {
version: '0.6.12',
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
},
},
};
Loading