Azoyalabs / avalanche_hackathon

https://avalanche-hackathon-web.vercel.app
0 stars 1 forks source link

Implement restriction on minting non-existing tokens #7

Closed Wally869 closed 8 months ago

Wally869 commented 8 months ago

Tests have been partially set up in af447d17632e18cd9447cf406baad74214ab8c81

Most likely will need to adjust errors to distinguish between expected error states more easily

Wally869 commented 8 months ago

Added custom errors and reverts for minting non-existing tokens in 42e70a8509561e2ce9be5d0518fd7605fdb61888

Wally869 commented 8 months ago

To note: special case of trying to mint a free article while providing a paying token id (and vice-versa) are handled by checking the balance of the author.

Might be worth to implement ERC1155Supply (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC1155/extensions/ERC1155Supply.sol) or better yet a simple map

Can make use of the findAlternateId function in TokenUtils for implementation

Wally869 commented 8 months ago

Added map in 45f782603f2a57d721bb57022c4014dff0827aad

I'd like to review checks on tokenId, articleId and isPaying within the contract to simplify the flow, but this will do for now

Wally869 commented 8 months ago

Current flow is fine, closing the issue