Skip to content

Commit

Permalink
Addressed PR comments (#9672)
Browse files Browse the repository at this point in the history
Signed-off-by: ilko-iliev-lime <ilko.iliev@limechain.tech>
  • Loading branch information
ilko-iliev-lime committed Nov 7, 2023
1 parent 79cdc9f commit ac8aa65
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ public NftTokenInfoCall(
return revertResult(status, gasCalculator.viewGasRequirement());
}

final var ownerAccount = getOwnerAccount(nft, token);
final var nonNullNft = nft != null ? nft : Nft.DEFAULT;
final var ownerAccount = getOwnerAccount(nonNullNft, token);
if (ownerAccount == null) {
return revertResult(INVALID_ACCOUNT_ID, gasCalculator.viewGasRequirement());
}
Expand All @@ -98,12 +99,11 @@ public NftTokenInfoCall(
.getOutputs()
.encodeElements(
status.protoOrdinal(),
nftTokenInfoTupleFor(token, nft, serialNumber, ledgerId, ownerAccount)),
nftTokenInfoTupleFor(token, nonNullNft, serialNumber, ledgerId, ownerAccount)),
gasRequirement);
}

private Account getOwnerAccount(@NonNull Nft nft, Token token) {
requireNonNull(nft);
private Account getOwnerAccount(Nft nft, Token token) {
final var explicitId = nft.ownerIdOrElse(AccountID.DEFAULT);
if (explicitId.account().kind() == AccountID.AccountOneOfType.UNSET) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import static com.hedera.node.app.service.contract.impl.test.TestHelpers.*;
import static com.hedera.node.app.service.contract.impl.utils.ConversionUtils.headlongAddressOf;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.Mockito.when;

import com.esaulpaugh.headlong.abi.Tuple;
Expand Down

0 comments on commit ac8aa65

Please sign in to comment.