Skip to content

Instantly share code, notes, and snippets.

@piorot
Created March 29, 2022 10:35
Show Gist options
  • Save piorot/0ad5189f8ae7b75440b87ace63b71f1a to your computer and use it in GitHub Desktop.
Save piorot/0ad5189f8ae7b75440b87ace63b71f1a to your computer and use it in GitHub Desktop.
Contract creator should have 100 shares of apartament
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "hardhat/console.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract Apartment is ERC20 {
constructor() ERC20("ApartmentContract", "APRTM") {
super._mint(_msgSender(), 100);
console.log("Deploying a Greeter with greeting:");
}
}
import { expect } from "chai";
import { BigNumber } from "ethers";
import { ethers } from "hardhat";
let owner, Alice, Bob, Joe;
describe("Apartment", function () {
it("Contract creator should have 100 shares of apartament",async () => {
const Apartment = await ethers.getContractFactory("Apartment");
const apartment = await Apartment.deploy();
[owner, Alice, Bob, Joe] = await ethers.getSigners();
await apartment.deployed();
let ownerBalance = await apartment.balanceOf(owner.address);
expect(ownerBalance).to.equal(100);
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment