Skip to content

Commit

Permalink
[PLA-1986] Support to parse storage during migration (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardocustodio authored Sep 10, 2024
1 parent a791d63 commit da66074
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/Services/Processor/Substrate/Codec/Decoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ public function tankStorageKey(string $data): array
*/
public function tankStorageData(string $data): array
{
$decoded = $this->codec->process(isRunningLatest() ? 'TankStorageDataV1010' : 'TankStorageData', new ScaleBytes($data));
try {
$decoded = $this->codec->process('TankStorageDataV1010', new ScaleBytes($data));
} catch (\Exception) {
$decoded = $this->codec->process('TankStorageData', new ScaleBytes($data));
}

return [
'owner' => ($owner = Arr::get($decoded, 'owner')) !== null ? HexConverter::prefix($owner) : null,
Expand Down Expand Up @@ -64,7 +68,11 @@ public function fuelTankAccountStorageKey(string $data): array
*/
public function fuelTankAccountStorageData(string $data): array
{
$decoded = $this->codec->process(isRunningLatest() ? 'FuelTankAccountStorageDataV1010' : 'FuelTankAccountStorageData', new ScaleBytes($data));
try {
$decoded = $this->codec->process('FuelTankAccountStorageDataV1010', new ScaleBytes($data));
} catch (\Exception) {
$decoded = $this->codec->process('FuelTankAccountStorageData', new ScaleBytes($data));
}

return [
'tankDeposit' => gmp_strval(Arr::get($decoded, 'tankDeposit')),
Expand Down

0 comments on commit da66074

Please sign in to comment.