Skip to content

Commit

Permalink
refactor: rename contract name - github (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
aahna-ashina committed Oct 22, 2023
1 parent 300a6c4 commit 5648b2d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion contracts/GitHub.sol → contracts/GitHubUsernames.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity ^0.8.17;

import {IPassportUtils} from "./utils/IPassportUtils.sol";

contract GitHub {
contract GitHubUsernames {
mapping(address => string) public usernames;
IPassportUtils public immutable passportUtils;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ async function main() {
// await hre.run('compile');

// We get the contract to deploy
const GitHub = await ethers.getContractFactory("GitHub");
const GitHubUsernames = await ethers.getContractFactory("GitHubUsernames");
const veTokenAddress = "0xF7deF1D2FBDA6B74beE7452fdf7894Da9201065d";
const github = await GitHub.deploy(veTokenAddress);
const githubUsernames = await GitHubUsernames.deploy(veTokenAddress);

await github.deployed();
await githubUsernames.deployed();

console.log("GitHub deployed to:", github.address);
console.log("GitHubUsernames deployed to:", githubUsernames.address);
}

// We recommend this pattern to be able to use async/await everywhere
Expand Down
22 changes: 11 additions & 11 deletions test/GitHub.ts → test/GitHubUsernames.ts
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
import { expect } from "chai";
import { ethers } from "hardhat";

describe("GitHub", function () {
describe("GitHubUsernames", function () {
it("Deploy contract", async function () {
const GitHub = await ethers.getContractFactory("GitHub");
const GitHubUsernames = await ethers.getContractFactory("GitHubUsernames");
const passportUtilsAddress = ethers.constants.AddressZero;
const gitHub = await GitHub.deploy(passportUtilsAddress);
await gitHub.deployed();
const githubUsernames = await GitHubUsernames.deploy(passportUtilsAddress);
await githubUsernames.deployed();

const [owner] = await ethers.getSigners();
console.log("owner.address:", owner.address);

const username = await gitHub.usernames(owner.address);
const username = await githubUsernames.usernames(owner.address);
console.log("username:", username);
expect(username).to.equal("");
});

it("updateUsername", async function () {
const GitHub = await ethers.getContractFactory("GitHub");
const GitHubUsernames = await ethers.getContractFactory("GitHubUsernames");
const passportUtilsAddress = ethers.constants.AddressZero;
const gitHub = await GitHub.deploy(passportUtilsAddress);
await gitHub.deployed();
const githubUsernames = await GitHubUsernames.deploy(passportUtilsAddress);
await githubUsernames.deployed();

const [owner] = await ethers.getSigners();
console.log("owner.address:", owner.address);

// await gitHub.updateUsername("test");
await expect(gitHub.updateUsername("test")).to.be.reverted;
// await githubUsernames.updateUsername("test");
await expect(githubUsernames.updateUsername("test")).to.be.reverted;

const usernameAfterUpdate = await gitHub.usernames(owner.address);
const usernameAfterUpdate = await githubUsernames.usernames(owner.address);
console.log("usernameAfterUpdate:", usernameAfterUpdate);
// expect(usernameAfterUpdate).to.equal("test");
expect(usernameAfterUpdate).to.equal("");
Expand Down

0 comments on commit 5648b2d

Please sign in to comment.