Skip to content

v1.1 Adding helper functions for batch operations#37

Open
hugoroussel wants to merge 22 commits intomainfrom
v1.1
Open

v1.1 Adding helper functions for batch operations#37
hugoroussel wants to merge 22 commits intomainfrom
v1.1

Conversation

@hugoroussel
Copy link
Copy Markdown
Contributor

New Functions Overview

Exchange.sol

Creation of batchCancelOrder

Moved cancelOrder logic into internal function _cancelOrder. Added function batchCancelOrder that should cancel multiple orders at once. Kept original cancelOrder to not break integrations.

Creation of batchSell

Moved sell logic into internal function _sell. Added function batchSell that should execute multiple buy order at once. Kept original sell method to not break integrations.

Emits new event BatchSell

Modification of batchBuy

New game mechanism will require the need to sweep sell cards and burn them to get specific rewards. The creation of a batchBuyAndBurn function was suggested. However for simplicity we add a new bool parameter to the batchBuy method: burnAfterPurchase. If true, the card will be burned in the internal method _buy that 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 : BatchBuyAndBurn or BatchBuy

Minter.sol

Creation of batchBurn

Purpose: 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 batchMintCardsTo

For game rewards it is useful for admins to directly mint cards to a specific address/group of addresses. We modify the mint method 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 method batchMintCardsTo that 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 Mint similar to the one from the mint method

Creation of batchBurnToDraw

Moved burnToDraw logic into internal method _burnToDraw. Added method batchBurnToDraw that should execute multiple burn to draw at once. Kept original burnToDraw to not break integrations.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant