Skip to content

Commit

Permalink
[PLA-1949] Fix a syntax error in the Model update function. (#303)
Browse files Browse the repository at this point in the history
  • Loading branch information
v16Studios authored Dec 16, 2024
1 parent 1fc2f57 commit 3214c5c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@

use Enjin\Platform\Events\Substrate\MultiTokens\TokenMinted;
use Enjin\Platform\Exceptions\PlatformException;
use Enjin\Platform\Models\Laravel\Token;
use Enjin\Platform\Models\TokenAccount;
use Enjin\Platform\Services\Processor\Substrate\Codec\Polkadart\Events\Event;
use Enjin\Platform\Services\Processor\Substrate\Codec\Polkadart\Events\MultiTokens\Minted as MintedPolkadart;
use Enjin\Platform\Services\Processor\Substrate\Events\SubstrateEvent;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Log;

class Minted extends SubstrateEvent
{
/** @var MintedPolkadart */
protected Event $event;
protected ?Token $tokenMinted = null;
protected ?Model $tokenMinted = null;

/**
* @throws PlatformException
Expand All @@ -34,7 +34,7 @@ public function run(): void
$recipient = $this->firstOrStoreAccount($this->event->recipient);

$this->tokenMinted->update([
'supply', gmp_strval(gmp_add($this->tokenMinted->supply, $this->event->amount)) ?? 0,
'supply' => gmp_strval(gmp_add($this->tokenMinted->supply ?? 0, $this->event->amount ?? 0)) ?? 0,
]);

TokenAccount::where([
Expand Down
4 changes: 2 additions & 2 deletions src/Services/Processor/Substrate/Events/SubstrateEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Enjin\Platform\Models\Laravel\Block;
use Enjin\Platform\Models\Laravel\Collection;
use Enjin\Platform\Models\Laravel\CollectionAccount;
use Enjin\Platform\Models\Laravel\Token;
use Enjin\Platform\Models\Token;
use Enjin\Platform\Models\Laravel\TokenAccount;
use Enjin\Platform\Models\Laravel\Transaction;
use Enjin\Platform\Models\Laravel\Wallet;
Expand Down Expand Up @@ -91,7 +91,7 @@ protected function getCollection(string $collectionChainId): Collection
/**
* @throws PlatformException
*/
protected function getToken(int $collectionId, string $tokenChainId): Token
protected function getToken(int $collectionId, string $tokenChainId): Model
{
if (!$token = Token::where(['collection_id' => $collectionId, 'token_chain_id' => $tokenChainId])->first()) {
throw new PlatformException(__('enjin-platform::traits.query_data_or_fail.unable_to_find_token', ['class' => self::class, 'tokenChainId' => $tokenChainId, 'collectionId' => $collectionId]));
Expand Down

0 comments on commit 3214c5c

Please sign in to comment.