NFT-auth-token
NFT-auth-token copied to clipboard
NFT-based-Auth-Token is the smart contract that NFT is used for the AC (Access Control) management
NFT based Auth Token
【Introduction of NFT based Auth Token】
- This is the smart contract that NFT is used for the AC (Access Control) management.
- NFT Auth Token works as a AC (Access Control) Token.
- If an user who has a NFT Auth Token, that user can access contents which is permitted. (Admin has tokenID=1 of NFT Auth Token, User has tokenID that is greater than 2 of NFT Auth Token. Depends on tokenID, accessable contents level are different)
- Login by being verified (checked) whether user has a NFT Auth Token or not.
【Remaining task (Future implementation)】
- Login
- When user register, user upload a their profile picture onto IPFS. After that, user get IPFS hash of the uploaded image. That IPFS hash is used as one of condition of login.
- Also I want to add SSI (Ethr-DID-registry of uPort) verification system for login.
- Add a pool for staking and earning interest for users (who buy a ticket which NFT Auth Token is embed).
- I assume that this situation is like a user buy ticket for subscription contents, fun, etc...
- Utilize mUSD of mStable for depositing into the Pool (earning interst in the Pool / redeeming from Pool, as well)
【Teck Stack】
- Solidity (solc) v0.6.12
- Truffle v5.1.49
- web3.js v1.2.1
- Node.js v11.15.0
【Setup】
- Add
.env
file into the root directory.
-
.env.example
is a reference for creating.env
. https://github.com/masaun/NFT-auth-token/blob/master/.env.example
- Npm install
$ npm install
- Migrate
$ npm run migrate:kovan
【Script】(on Kovan testnet)
- Create a new NFT Auth Token
$ npm run script:NftAuthTokenManager
- Mint a new Auth Token ID for user who is called. After that, system check verification whether user who is called has NFT Auth Token (Token ID) or not.
$ npm run script:NftAuthToken
- (Future implementaion)
$ npm run script:PoolWithNftAuthToken
【Test】
- Testing for all contract (※
Kovan test network
) <= This test is in progress
$ npm run test:kovan
【References】
- [NFT]
- Openzepplin document for ERC721 https://docs.openzeppelin.com/contracts/3.x/erc721
- [mStable]:
- https://docs.mstable.org/
- [Ethr-DID-Registry (from uPort)]
- https://github.com/uport-project/ethr-did-registry