outwave-io / web-app-smart-contracts

The smart contracts behing outwave.io
3 stars 0 forks source link

NFT Ticketing - Remove KeyBurner and update the state of the ERC271 Ticket when obliterated #7

Open MiroRadenovic opened 1 year ago

MiroRadenovic commented 1 year ago

As proposed by Massimiliano (@mp-seventy-two) in the DAO at this topic: https://dao.outwave.io/t/feature-nft-ticketing/53/9, the KeyBurner does not make sense anymore.

We should

  1. remove the KeyBurner and related to OutwavePublicLock:
  2. keep an internal mapping (tokenId: int => maxObliteration:int) for obliteration. The maxObliteration should be used to allow multiple obliterations to support generating more than one QRCODE for each ticket.
  3. the tokenuri shall check the mapping (tokenId: int => maxObliteration:int) to provide a json with obliterated metadata, such as a different image.

Make sure https://github.com/outwave-io/web-app-smart-contracts/tree/feature/unlock-fork is merged into master before starting this implementation

refex commented 1 year ago

Let's track all impacts of this change in the outwave app, this will be helpful to define tasks. For start I can think of:

MiroRadenovic commented 1 year ago

I will move the conversation with Massimiliano (@mp-seventy-two) from the DAO Forum to this issue:

Hi, great to know I was of help with my suggestion. I have read the enanchement proposal, don’t know your system so what I going to say now could be more a problem that a solution, but why do you need the maxObliteration value? The obliteration value is inside the metadata, the qr code is created otside of the contract right? If the situation you want to cover is the use of the same ticket in multiple events is more useful tomaintain the event information togheter with the obliteration so the mapping become (uInt->mapping(uInt->bool) ) translated to your metalang: tokenId:int ->( eventId:int -> obliterated:boolean) In this way the same ticket is valid for more than a single event. Obviously the method to check the obliteration become something like this:

// Let's say the NFT contract use AccessControl bytes32 public constant OBLITERATOR_ROLE = keccak256("OBLITERATOR_ROLE");

modifier onlyObliterator() { require(hasRole(OBLITERATORROLE, msg.sender), "Caller is not authorized to obliterate"); ; }

// tokenId:int -> ( eventId:int -> obliteration_state:bool) mapping(uint256=>mapping(uint256=>bool)) public ObliterationState; function obliterateTicketForEvent(uint256 tokenId, uint256 eventId) public onlyObliterator {

ObliterationState[tokenId][eventId]=true;

}

function isTicketObliteratedForEvent(uint256 tokenId, uint256 eventId))public view returns(bool) { return ObliterationState[tokenId][eventId]; }