Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add smart contract for checking passport status (#72) #73

Closed
wants to merge 4 commits into from
Closed
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
7 changes: 7 additions & 0 deletions contracts/INationCred.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,11 @@ interface INationCred {
* @param passportID The NFT passport ID
*/
function isActive(uint16 passportID) external view returns (bool);

/**
* Returns `true` if a citizen's vote-escrowed `$NATION` balance has dropped below the passport expiry threshold; `false` otherwise.
*
* @param citizen The address of the passport owner
*/
function isPassportExpired(address citizen) external view returns (bool);
}
5 changes: 5 additions & 0 deletions contracts/NationCred.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,9 @@ contract NationCred is INationCred {
}
return false;
}

function isPassportExpired(address citizen) public view returns (bool) {
// TO DO
return true;
}
}
10 changes: 10 additions & 0 deletions test/NationCred.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,14 @@ describe("NationCred", function () {
expect(await nationCred.isActive(419)).to.equal(true);
expect(await nationCred.isActive(420)).to.equal(false);
});

it("isPassportExpired - no passport", async function () {
const [owner] = await ethers.getSigners();

const NationCred = await ethers.getContractFactory("NationCred");
const nationCred = await NationCred.deploy();
await nationCred.deployed();

expect(await nationCred.isPassportExpired(owner.address)).to.equal(true);
});
});