Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
seasidejuvenile666 authored Nov 6, 2022
1 parent 3cdb89a commit 0448b1f
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions Languages/en/25_Create2_en/create2test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const { expect } = require("chai");
const { ethers } = require("hardhat");

describe("create2 test", function () {
it("Should return the new create2test once it's changed", async function () {
console.log("1.==> deploy pair");
const PairFactory = await ethers.getContractFactory("Pair");
const Pair = await PairFactory.deploy();
await Pair.deployed();
console.log("pair address =>",Pair.address);

console.log();
console.log("2.==> deploy PairFactory2");
const PairFactory2Factory = await ethers.getContractFactory("PairFactory2");
const PairFactory2 = await PairFactory2Factory.deploy();
await PairFactory2.deployed();
console.log("PairFactory2 address =>",PairFactory2.address);

console.log("3.==> calculateAddr for wbnb people");
const WBNBAddress = "0x2c44b726ADF1963cA47Af88B284C06f30380fC78";
const PEOPLEAddress = "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c";

let predictedAddress = await PairFactory2.calculateAddr(WBNBAddress, PEOPLEAddress);
console.log("predictedAddress address =>",predictedAddress);

console.log("4.==> createPair2 for wbnb people");
await PairFactory2.createPair2(WBNBAddress, PEOPLEAddress);
let createPair2Address = await PairFactory2.allPairs(0);
console.log("createPair2Address address =>",createPair2Address);

expect(createPair2Address).to.equal(predictedAddress);

});
});

0 comments on commit 0448b1f

Please sign in to comment.