Skip to content

Instantly share code, notes, and snippets.

@piorot
Created March 29, 2022 10:44
Show Gist options
  • Save piorot/cf5b7cbb2af85a861cbd56f2f019ffc8 to your computer and use it in GitHub Desktop.
Save piorot/cf5b7cbb2af85a861cbd56f2f019ffc8 to your computer and use it in GitHub Desktop.
contract Apartment is ERC20 {
uint public balance;
constructor() ERC20("ApartmentContract", "APRTM") {
super._mint(_msgSender(), 100);
console.log("Deploying a Greeter with greeting:");
}
receive() external payable {
console.log("receive");
balance += msg.value;
}
}
it("It should be possible to pay the rent and deposit it in ether in the apartment contract", async () => {
const Apartment = await ethers.getContractFactory("Apartment");
const apartment = await Apartment.deploy();
[owner, Alice, Bob] = await ethers.getSigners();
await apartment.deployed();
await Bob.sendTransaction({
to: apartment.address,
value: ethers.utils.parseEther("1")
})
expect(await apartment.balance()).to.equal(ethers.utils.parseEther("1"));
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment