From cde617a1b38274db1807e8af5a1d36b6d37941bc Mon Sep 17 00:00:00 2001 From: Simon Evans Date: Thu, 10 Oct 2024 17:13:58 +0100 Subject: [PATCH] Update to force_collapsing_supply --- database/schema/mysql-schema.sql | 2 +- src/Commands/BatchProcess.php | 4 ++-- src/Rules/TokensDoNotExistInBeam.php | 2 +- tests/Feature/Traits/CreateCollectionData.php | 2 +- tests/Unit/EventTest.php | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/database/schema/mysql-schema.sql b/database/schema/mysql-schema.sql index d596293..dbe03e9 100644 --- a/database/schema/mysql-schema.sql +++ b/database/schema/mysql-schema.sql @@ -198,7 +198,7 @@ CREATE TABLE `collections` ( `owner_wallet_id` bigint unsigned NOT NULL, `max_token_count` varchar(255) DEFAULT NULL, `max_token_supply` varchar(255) DEFAULT NULL, - `force_single_mint` tinyint(1) NOT NULL DEFAULT '0', + `force_collapsing_supply` tinyint(1) NOT NULL DEFAULT '0', `royalty_wallet_id` bigint unsigned DEFAULT NULL, `royalty_percentage` double(8,2) DEFAULT NULL, `is_frozen` tinyint(1) NOT NULL DEFAULT '0', diff --git a/src/Commands/BatchProcess.php b/src/Commands/BatchProcess.php index 9efd457..69216cd 100644 --- a/src/Commands/BatchProcess.php +++ b/src/Commands/BatchProcess.php @@ -186,8 +186,8 @@ protected function processBatch(BeamType $type): int 'initialSupply' => $this->tokenCreatedCache[$key] ? null : $claim->quantity, 'amount' => $this->tokenCreatedCache[$key] ? $claim->quantity : null, 'cap' => [ - 'type' => $claim->quantity == 1 || $claim->collection?->force_single_mint ? TokenMintCapType::COLLAPSING_SUPPLY->name : null, - 'amount' => $claim->collection?->force_single_mint ? 1 : null, + 'type' => $claim->quantity == 1 || $claim->collection?->force_collapsing_supply ? TokenMintCapType::COLLAPSING_SUPPLY->name : null, + 'amount' => $claim->collection?->force_collapsing_supply ? 1 : null, ], 'listingForbidden' => false, 'behaviour' => null, diff --git a/src/Rules/TokensDoNotExistInBeam.php b/src/Rules/TokensDoNotExistInBeam.php index 411de0a..641b100 100644 --- a/src/Rules/TokensDoNotExistInBeam.php +++ b/src/Rules/TokensDoNotExistInBeam.php @@ -66,7 +66,7 @@ public static function prepareStatement(?Model $beam, ?string $collectionId = nu (tokens.is_currency is false OR tokens.is_currency is NULL) AND ( collections.max_token_supply = '1' - OR (collections.force_single_mint is true AND tokens.supply = '1') + OR (collections.force_collapsing_supply is true AND tokens.supply = '1') OR (tokens.cap='" . TokenMintCapType::SUPPLY->name . "' AND tokens.cap_supply = '1') OR (tokens.cap='" . TokenMintCapType::COLLAPSING_SUPPLY->name . "' AND tokens.supply = '1') ) diff --git a/tests/Feature/Traits/CreateCollectionData.php b/tests/Feature/Traits/CreateCollectionData.php index fb7f233..7811704 100644 --- a/tests/Feature/Traits/CreateCollectionData.php +++ b/tests/Feature/Traits/CreateCollectionData.php @@ -47,7 +47,7 @@ public function prepareCollectionData(?string $publicKey = null): void 'owner_wallet_id' => $this->wallet->id, 'max_token_count' => fake()->numberBetween(1), 'max_token_supply' => (string) fake()->numberBetween(1), - 'force_single_mint' => fake()->boolean(), + 'force_collapsing_supply' => fake()->boolean(), 'is_frozen' => false, 'token_count' => '0', 'attribute_count' => '0', diff --git a/tests/Unit/EventTest.php b/tests/Unit/EventTest.php index c0e8679..87ee409 100644 --- a/tests/Unit/EventTest.php +++ b/tests/Unit/EventTest.php @@ -90,7 +90,7 @@ public function test_it_can_listens_to_events(): void event($event = new TokenDestroyed($tokenDestroyed)); $this->collection->update([ 'max_token_supply' => 100, - 'force_single_mint' => false, + 'force_collapsing_supply' => false, ]); BeamClaim::where('beam_id', $this->beam->id)->first()->update([ 'collection_id' => $this->collection->id,