Skip to content

Commit

Permalink
Update Utils.sol
Browse files Browse the repository at this point in the history
  • Loading branch information
Phanco committed Dec 8, 2023
1 parent 3bb7c7c commit 7cc4846
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions script/Utils.sol
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,6 @@ contract Utils is Script {
return abi.decode(addressRaw, (L2AddressesConfig));
}

/// @notice This function reads MerkleTree from JSON file.
/// @return L2ClaimConfig struct containing merkle root.
function readMerkleTreeFile() external view returns (MerkleTree memory) {
string memory root = vm.projectRoot();
string memory addressPath = string.concat(root, "/deployment/merkleTree.json");
string memory addressJson = vm.readFile(addressPath);
bytes memory addressRaw = vm.parseJson(addressJson);
return abi.decode(addressRaw, (MerkleTree));
}

/// @notice This function writes L2 addresses to JSON file.
/// @param cfg L2AddressesConfig struct containing L2 addresses which will be written to JSON file.
function writeL2AddressesFile(L2AddressesConfig memory cfg) external {
Expand All @@ -88,4 +78,15 @@ contract Utils is Script {
string memory finalJson = vm.serializeAddress(json, "L2LiskToken", cfg.L2LiskToken);
finalJson.write(string.concat("deployment/l2addresses.json"));
}


/// @notice This function reads MerkleTree from JSON file.
/// @return L2ClaimConfig struct containing merkle root.
function readMerkleTreeFile() external view returns (MerkleTree memory) {
string memory root = vm.projectRoot();
string memory addressPath = string.concat(root, "/script/merkleTree.json");
string memory addressJson = vm.readFile(addressPath);
bytes memory addressRaw = vm.parseJson(addressJson);
return abi.decode(addressRaw, (MerkleTree));
}
}

0 comments on commit 7cc4846

Please sign in to comment.