Skip to content

Commit

Permalink
fix: failing pipelines fix
Browse files Browse the repository at this point in the history
Signed-off-by: Mariusz Jasuwienas <[email protected]>
  • Loading branch information
arianejasuwienas committed Dec 23, 2024
1 parent cd6d1d0 commit d77089f
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions contracts/MirrorNode.sol
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,17 @@ abstract contract MirrorNode {

function getAccountAddress(string memory accountId) public returns (address) {
if (bytes(accountId).length == 0
|| keccak256(bytes(accountId)) == keccak256(bytes("null"))
|| keccak256(bytes(accountId)) == keccak256(bytes("null"))
|| keccak256(abi.encodePacked(accountId)) == keccak256(abi.encodePacked(bytes32(0)))) {
return address(0);
}
string memory json = this.fetchAccount(accountId);
if (vm.keyExistsJson(json, ".evm_address")) {
return vm.parseJsonAddress(json, ".evm_address");

try this.fetchAccount(accountId) returns (string memory json) {
if (vm.keyExistsJson(json, ".evm_address")) {
return vm.parseJsonAddress(json, ".evm_address");
}
} catch {
// Do nothing
}

// ignore the first 4 characters ("0.0.") to get the account number string
Expand All @@ -113,10 +117,13 @@ abstract contract MirrorNode {
if ((uint160(account) >> 32) == 0) {
return uint32(uint160(account));
}
string memory json = this.fetchAccount(vm.toString(account));
if (vm.keyExistsJson(json, ".account")) {
return uint32(vm.parseUint(vm.replace(vm.parseJsonString(json, ".account"), "0.0.", "")));
}

try this.fetchAccount(vm.toString(account)) returns (string memory json) {
if (vm.keyExistsJson(json, ".account")) {
return uint32(vm.parseUint(vm.replace(vm.parseJsonString(json, ".account"), "0.0.", "")));
}
} catch {}

return 0;
}
}

0 comments on commit d77089f

Please sign in to comment.