Skip to content

ori-wagmi/DCTRLMEMBERSHIP

Repository files navigation

DCTRL Membership and Fob

This project contains the smart contract and local testing tool for DCTRL Membership.

https://app.dework.xyz/dctrl/nft-membership-40303/view/board-loywtdc1?taskId=225389bb-682e-4954-83e6-461c3adffc10

Userflow state diagrams: https://miro.com/app/board/uXjVN9-cSjo=/?share_link_id=748410878407

Deployments

Sepolia:

Linea testnet:

I recommend getting Linea Testnet from the covalent faucet: https://docs.linea.build/use-mainnet/fund

How to use

  1. Create a copy of .env.example and rename it to .env
  2. Add your private key to .env if you intend to deploy
  3. Install with npm install
  4. Deploy onchain with npx hardhat run .\scripts\deploy\deploy.js

You can create a long-running local hardhat node with npx hardhat node and then point the DCTRL tool to it with npx hardhat run .\scripts\start.js --network hardhat and pointing your dApp to localhost:8545 with chainId 31337

Smart Contracts

Summary

This project contains the following smart contracts:

  • MembershipNFT.sol
  • FobNFT.sol
  • Minter.sol
  • /TokenBound/* (ERC6551)

The DCTRL membership is built ontop of ERC6551: Non-fungible Token Bound Accounts

The idea is that each human being that joins DCTRL gets a "soulbound" MembershipNFT. The MembershipNFT can hold a FobNFT that corresponds to a real physical fob that gives access to the physical space.

All contracts are managed via AccessControl roles.

The multisig is expected to always have superadmin rights.

MembershipNFT

MembershipNFT.sol is an ERC721 that contains two fields:

  • creationDate
  • name
  • role

The NFT is intended to be a 1:1 lifetime onchain representation with each physical human being. The NFT is "soulbound" in the sense that it cannot be traded by default.

The MembershipNFT is expected to be upgraded to a TokenBoundAccount using AccountV3. This way, the MembershipNFT can hold additional NFTs and scale to additional onchain activities.

FobNFT

FobNFT.sol is an ERC721 that represents a physical fob that gives access to the DCTRL space. It is intended that either EOA or a TokenBoundAccount can hold a fob.

The Expiration of the Fob is UNIX time in seconds and can be queried via tokenURI() or idToExpiration().

Minter

Minter.sol is the orcestrator contract that users interact with. It is expected to have the roles to issue and manage membershipNFTs and fobNFTs. Minter is also expected to handle payment.

/TokenBound/*

These are copies of the ERC6551 Registry (https://github.com/erc6551/reference) and AccountV3 (https://github.com/tokenbound/contracts) contracts. This is used for local testing only. It is expected that we use the existing onchain Registry in production per the ERC6551 spec.

Tests

Test suite is in Foundry, install docs here (https://book.getfoundry.sh/getting-started/installation)

Environment variables below the Required for running tests heading must be valid in your .env to run the tests. Tests require forking from latest block on the target chain.

To run tests with 1st level of verbosity: forge install foundry-rs/forge-std // todo, is this necessary? forge test -v

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published