Intercoin / CommunityContract

Smart contract for managing community membership and roles
https://intercoin.org
GNU Affero General Public License v3.0
1 stars 2 forks source link

Implement roles as NFTs #3

Closed EGreg closed 2 years ago

EGreg commented 2 years ago

We want to implement the ERC721 standard so people can see their roles in different communities as NFTs in their wallet.

The tokenId would basically be the roleName + ":" + (++counter[roleName]) and calling ownerOf(tokenId) would return the member of that role.

All calls to transferFrom and safeTransferFrom would revert with error "Cannot Transfer Role", unless the role being transferred can manage that role itself (it was added by manageRole) and tx.origin has that role, in which case the transfer would succeed, i.e. by transferring this NFT people can transfer their role to some other account (we remove them from the role and add the other account to the role).

Add methods name() and symbol() to be the name and symbol of the community. The name and symbol should be passed to constructor, or initialize() method if produced by CommunityFactory contract.

We should also be able to set tokenURI which would be the URL returned from Add a tokenURI(tokenId) method which would return the URL about the role. For example, being a member of a community, you would typically have logo of community, overlaid with badge of being a member, and the community is supposed to be hosting this logo.

artman325 commented 2 years ago

done. when admin grant role to user, user will obtain personal nft token with tokenID = roleIndex >>180+[userwallet] admin(or who can manage this role) can set roleURI (method setRoleURI) that can be used as tokenURI for all tokens belong to role. Also user can set personal tokenURI by calling setExtraURI