v1.1 Adding helper functions for batch operations#37
Open
hugoroussel wants to merge 22 commits intomainfrom
Open
v1.1 Adding helper functions for batch operations#37hugoroussel wants to merge 22 commits intomainfrom
hugoroussel wants to merge 22 commits intomainfrom
Conversation
Add missing check for array lengths in batchMintCardsTo
Token whitelist is not being checked in setMinimumPricePerPaymentToken
Missing buy and burn event emission
Check that collection is whitelisted in setCollectionForMintConfig an…
Check collection whitelist in burn after purchase
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
New Functions Overview
Exchange.sol
Creation of
batchCancelOrderMoved
cancelOrderlogic into internal function_cancelOrder. Added functionbatchCancelOrderthat should cancel multiple orders at once. Kept originalcancelOrderto not break integrations.Creation of
batchSellMoved
selllogic into internal function_sell. Added functionbatchSellthat should execute multiple buy order at once. Kept originalsellmethod to not break integrations.Emits new event
BatchSellModification of
batchBuyNew game mechanism will require the need to sweep sell cards and burn them to get specific rewards. The creation of a
batchBuyAndBurnfunction was suggested. However for simplicity we add a new bool parameter to thebatchBuymethod:burnAfterPurchase. If true, the card will be burned in the internal method_buythat was extended with the same extra parameter.This scheme was implemented to avoid giving an EOA the execution delegate role.
Emits one of two new events :
BatchBuyAndBurnorBatchBuyMinter.sol
Creation of
batchBurnPurpose: Allow token holders to burn their own tokens. Implementation: Simply allow anyone to call the burn function for an array of token. Access: Public function, only callable by token owner or approved address.
Implementation checks that user is burning a whitelisted collection token and that he is the owner of each token. Uses execution delegate to burn the tokens. Emits new event
BatchBurn.Creation of
batchMintCardsToFor game rewards it is useful for admins to directly mint cards to a specific address/group of addresses. We modify the
mintmethod to take a recipient address as parameter and create the new internal method_mintCardsTo. We can then call this method via a public access controlled methodbatchMintCardsTothat can take as parameters an array of recipients.We still keep the concept of config id for easier reward management (versus a direct mintCardsTo method with no config id parameter).
emits the event
Mintsimilar to the one from themintmethodCreation of
batchBurnToDrawMoved
burnToDrawlogic into internal method_burnToDraw. Added methodbatchBurnToDrawthat should execute multiple burn to draw at once. Kept originalburnToDrawto not break integrations.