Skip to content

Commit

Permalink
Fix contracts folder path inside deployment directory
Browse files Browse the repository at this point in the history
  • Loading branch information
matjazv committed Jul 1, 2024
1 parent 455a90c commit 3dbc801
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 11 deletions.
3 changes: 2 additions & 1 deletion script/contracts/L1/L1FundVesting.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ contract L1FundVestingScript is Script {
Utils.VestingPlan[] memory plans = utils.readVestingPlansFile(layer);
for (uint256 i; i < plans.length; i++) {
Utils.VestingPlan memory vestingPlan = plans[i];
address vestingWalletAddress = utils.readVestingWalletAddress(vestingPlan.name, layer);
address vestingWalletAddress =
utils.readVestingWalletAddress(vestingPlan.name, utils.getVestingWalletsFilePath(layer));

console2.log(
"Transferring %s Lisk tokens to the vesting wallet %s ... on L1",
Expand Down
2 changes: 1 addition & 1 deletion script/contracts/L1/L1VestingWallet.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ contract L1VestingWalletScript is Script {
}

// Write all Vesting Contract addresses to vestingWallets_L1.json
utils.writeVestingWalletsFile(vestingWallets, layer);
utils.writeVestingWalletsFile(vestingWallets, utils.getVestingWalletsFilePath(layer));

// write L1VestingWallet address to l1addresses.json
l1AddressesConfig.L1VestingWalletImplementation = address(l1VestingWalletImplementation);
Expand Down
3 changes: 2 additions & 1 deletion script/contracts/L2/L2FundVestingAndDAO.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ contract FundVestingAndDAOScript is Script {

for (uint256 i; i < plans.length; i++) {
Utils.VestingPlan memory vestingPlan = plans[i];
address vestingWalletAddress = utils.readVestingWalletAddress(vestingPlan.name, layer);
address vestingWalletAddress =
utils.readVestingWalletAddress(vestingPlan.name, utils.getVestingWalletsFilePath(layer));

console2.log(
"Transferring %s Lisk tokens to the vesting wallet %s ... on L2",
Expand Down
2 changes: 1 addition & 1 deletion script/contracts/L2/L2VestingWallet.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ contract L2VestingWalletScript is Script {
}

// Write all Vesting Contract addresses to vestingWallets_L2.json
utils.writeVestingWalletsFile(vestingWallets, layer);
utils.writeVestingWalletsFile(vestingWallets, utils.getVestingWalletsFilePath(layer));

// write L2VestingWallet address to l2addresses.json
l2AddressesConfig.L2VestingWalletImplementation = address(l2VestingWalletImplementation);
Expand Down
12 changes: 8 additions & 4 deletions script/contracts/Utils.sol
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,15 @@ contract Utils is Script {
/// @notice This function returns the path for L1 addresses JSON file.
/// @return string containing file path to L1 addresses JSON.
function getL1AddressesFilePath() external view returns (string memory) {
return string.concat(vm.projectRoot(), "/deployment/", getNetworkType(), "/l1addresses.json");
return
string.concat(vm.projectRoot(), "/deployment/artifacts/contracts/", getNetworkType(), "/l1addresses.json");
}

/// @notice This function returns the path for L2 addresses JSON file.
/// @return string containing file path to L2 addresses JSON.
function getL2AddressesFilePath() external view returns (string memory) {
return string.concat(vm.projectRoot(), "/deployment/", getNetworkType(), "/l2addresses.json");
return
string.concat(vm.projectRoot(), "/deployment/artifacts/contracts/", getNetworkType(), "/l2addresses.json");
}

/// @notice This function reads L1 addresses from JSON file.
Expand Down Expand Up @@ -295,10 +297,12 @@ contract Utils is Script {
}

/// @notice This function returns the path for the vesting wallets JSON file for the provided network layer.
/// @param _layer Network layer of the runnins script, either be "L1" or "L2".
/// @param _layer Network layer of the running script, either be "L1" or "L2".
/// @return string containing file path to vesting wallets.
function getVestingWalletsFilePath(string memory _layer) external view returns (string memory) {
return string.concat(vm.projectRoot(), "/deployment/", getNetworkType(), "/vestingWallets_", _layer, ".json");
return string.concat(
vm.projectRoot(), "/deployment/artifacts/contracts/", getNetworkType(), "/vestingWallets_", _layer, ".json"
);
}

/// @notice This function writes Vesting Wallets to JSON file.
Expand Down
6 changes: 3 additions & 3 deletions test/utils/Utils.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -136,21 +136,21 @@ contract UtilsTest is Test {
function test_getL1AddressesFilePath() public view {
assertEq(
utils.getL1AddressesFilePath(),
string.concat(vm.projectRoot(), "/deployment/", network, "/l1addresses.json")
string.concat(vm.projectRoot(), "/deployment/artifacts/contracts/", network, "/l1addresses.json")
);
}

function test_getL2AddressesFilePath() public view {
assertEq(
utils.getL2AddressesFilePath(),
string.concat(vm.projectRoot(), "/deployment/", network, "/l2addresses.json")
string.concat(vm.projectRoot(), "/deployment/artifacts/contracts/", network, "/l2addresses.json")
);
}

function test_getVestingWalletsFilePath() public view {
assertEq(
utils.getVestingWalletsFilePath("l1"),
string.concat(vm.projectRoot(), "/deployment/", network, "/vestingWallets_l1.json")
string.concat(vm.projectRoot(), "/deployment/artifacts/contracts/", network, "/vestingWallets_l1.json")
);
}

Expand Down

0 comments on commit 3dbc801

Please sign in to comment.