Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a security flag to mark the collection as revealed #11

Merged
merged 1 commit into from
Jan 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .do/deploy.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ spec:
- key: APP_ENV
scope: RUN_AND_BUILD_TIME
value: prod
- key: COLLECTION_IS_REVEALED
scope: RUN_TIME
value: false
- key: COLLECTION_WEBSITE
scope: RUN_TIME
value: https://www.example.com
Expand Down
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration

# General collection settings
COLLECTION_IS_REVEALED=true
COLLECTION_WEBSITE=https://www.example.com/
COLLECTION_MAX_SUPPLY=10000
COLLECTION_ASSETS_EXTENSION=png
Expand Down
1 change: 1 addition & 0 deletions config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration
parameters:
app.cache_expiration: '%env(int:CACHE_EXPIRATION)%'
app.collection_is_revealed: '%env(bool:COLLECTION_IS_REVEALED)%'
app.collection_website: '%env(COLLECTION_WEBSITE)%'
app.collection_max_supply: '%env(int:COLLECTION_MAX_SUPPLY)%'
app.collection_assets_extension: '%env(COLLECTION_ASSETS_EXTENSION)%'
Expand Down
4 changes: 3 additions & 1 deletion src/Contract/AbstractNftController.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ public function __construct(

protected function isValidTokenId(int $tokenId): bool
{
return $tokenId > 0 && $tokenId <= $this->cachedTotalSupplyProvider->getTotalSupply();
$isRevealed = $this->getParameter('app.collection_is_revealed');

return $isRevealed && $tokenId > 0 && $tokenId <= $this->cachedTotalSupplyProvider->getTotalSupply();
}

protected function getDefaultCacheExpiration(): int
Expand Down