Skip to content

Commit

Permalink
Add artifacts folder and organize subfolders and files inside it (#184
Browse files Browse the repository at this point in the history
)

* Add artifacts folder and organize subfolders and files inside

* Fix merge issue
  • Loading branch information
matjazv authored and sergeyshemyakov committed Jun 28, 2024
1 parent 9f20a2c commit 1f545d4
Show file tree
Hide file tree
Showing 49 changed files with 41 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ broadcast/
slither-results.json

# Devnet deployment files
deployment/devnet/
deployment/artifacts/contracts/devnet/
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 6 additions & 6 deletions script/1_deployTokenContracts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ echo "Setting environment variables..."
source .env
echo "Done."

echo "Creating $NETWORK directory inside deployment directory..."
echo "Creating $NETWORK directory inside deployment/artifacts/contracts directory..."
if [ -z "$NETWORK" ]
then
echo "NETWORK variable inside .env file is not set. Please set NETWORK environment variable."
exit 1
else
if [ -d "deployment/$NETWORK" ]
if [ -d "deployment/artifacts/contracts/$NETWORK" ]
then
echo "Directory deployment/$NETWORK already exists."
echo "Removing files inside deployment/$NETWORK directory..."
rm -rf deployment/$NETWORK/*
echo "Directory deployment/artifacts/contracts/$NETWORK already exists."
echo "Removing files inside deployment/artifacts/contracts/$NETWORK directory..."
rm -rf deployment/artifacts/contracts/$NETWORK/*
else
mkdir deployment/$NETWORK
mkdir deployment/artifacts/contracts/$NETWORK
fi
fi
echo "Done."
Expand Down
8 changes: 4 additions & 4 deletions script/2_deployStakingAndGovernance.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ echo "Setting environment variables..."
source .env
echo "Done."

echo "Creating $NETWORK directory inside deployment directory..."
echo "Creating $NETWORK directory inside deployment/artifacts/contracts directory..."
if [ -z "$NETWORK" ]
then
echo "NETWORK variable inside .env file is not set. Please set NETWORK environment variable."
exit 1
else
if [ -d "deployment/$NETWORK" ]
if [ -d "deployment/artifacts/contracts/$NETWORK" ]
then
echo "Directory deployment/$NETWORK already exists."
echo "Directory deployment/artifacts/contracts/$NETWORK already exists."
else
mkdir deployment/$NETWORK
mkdir deployment/artifacts/contracts/$NETWORK
fi
fi
echo "Done."
Expand Down
8 changes: 4 additions & 4 deletions script/3_deployVestingWallets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ echo "Setting environment variables..."
source .env
echo "Done."

echo "Creating $NETWORK directory inside deployment directory..."
echo "Creating $NETWORK directory inside deployment/artifacts/contracts directory..."
if [ -z "$NETWORK" ]
then
echo "NETWORK variable inside .env file is not set. Please set NETWORK environment variable."
exit 1
else
if [ -d "deployment/$NETWORK" ]
if [ -d "deployment/artifacts/contracts/$NETWORK" ]
then
echo "Directory deployment/$NETWORK already exists."
echo "Directory deployment/artifacts/contracts/$NETWORK already exists."
else
mkdir deployment/$NETWORK
mkdir deployment/artifacts/contracts/$NETWORK
fi
fi
echo "Done."
Expand Down
8 changes: 4 additions & 4 deletions script/4_deployClaimContract.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ echo "Setting environment variables..."
source .env
echo "Done."

echo "Creating $NETWORK directory inside deployment directory..."
echo "Creating $NETWORK directory inside deployment/artifacts/contracts directory..."
if [ -z "$NETWORK" ]
then
echo "NETWORK variable inside .env file is not set. Please set NETWORK environment variable."
exit 1
else
if [ -d "deployment/$NETWORK" ]
if [ -d "deployment/artifacts/contracts/$NETWORK" ]
then
echo "Directory deployment/$NETWORK already exists."
echo "Directory deployment/artifacts/contracts/$NETWORK already exists."
else
mkdir deployment/$NETWORK
mkdir deployment/artifacts/contracts/$NETWORK
fi
fi
echo "Done."
Expand Down
8 changes: 4 additions & 4 deletions script/5_deployAirdropContract.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ echo "Setting environment variables..."
source .env
echo "Done."

echo "Creating $NETWORK directory inside deployment directory..."
echo "Creating $NETWORK directory inside deployment/artifacts/contracts directory..."
if [ -z "$NETWORK" ]
then
echo "NETWORK variable inside .env file is not set. Please set NETWORK environment variable."
exit 1
else
if [ -d "deployment/$NETWORK" ]
if [ -d "deployment/artifacts/contracts/$NETWORK" ]
then
echo "Directory deployment/$NETWORK already exists."
echo "Directory deployment/artifacts/contracts/$NETWORK already exists."
else
mkdir deployment/$NETWORK
mkdir deployment/artifacts/contracts/$NETWORK
fi
fi
echo "Done."
Expand Down
Empty file modified script/6_deployUSDTContract.sh
100644 → 100755
Empty file.
21 changes: 14 additions & 7 deletions script/contracts/Utils.sol
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ contract Utils is Script {
function readL1AddressesFile() external view returns (L1AddressesConfig memory) {
string memory network = getNetworkType();
string memory root = vm.projectRoot();
string memory addressPath = string.concat(root, "/deployment/", network, "/l1addresses.json");
string memory addressPath =
string.concat(root, "/deployment/artifacts/contracts/", network, "/l1addresses.json");
string memory addressJson = vm.readFile(addressPath);

L1AddressesConfig memory l1AddressesConfig;
Expand All @@ -141,15 +142,16 @@ contract Utils is Script {
vm.serializeAddress(json, "L1LiskToken", cfg.L1LiskToken);
string memory finalJson =
vm.serializeAddress(json, "L1VestingWalletImplementation", cfg.L1VestingWalletImplementation);
finalJson.write(string.concat("deployment/", network, "/l1addresses.json"));
finalJson.write(string.concat("deployment/artifacts/contracts/", network, "/l1addresses.json"));
}

/// @notice This function reads L2 addresses from JSON file.
/// @return L2AddressesConfig struct containing L2 addresses.
function readL2AddressesFile() external view returns (L2AddressesConfig memory) {
string memory network = getNetworkType();
string memory root = vm.projectRoot();
string memory addressPath = string.concat(root, "/deployment/", network, "/l2addresses.json");
string memory addressPath =
string.concat(root, "/deployment/artifacts/contracts/", network, "/l2addresses.json");
string memory addressJson = vm.readFile(addressPath);

L2AddressesConfig memory l2AddressesConfig;
Expand Down Expand Up @@ -250,7 +252,7 @@ contract Utils is Script {
string memory finalJson =
vm.serializeAddress(json, "L2VotingPowerImplementation", cfg.L2VotingPowerImplementation);

finalJson.write(string.concat("deployment/", network, "/l2addresses.json"));
finalJson.write(string.concat("deployment/artifacts/contracts/", network, "/l2addresses.json"));
}

/// @notice This function writes Vesting Wallets to JSON file.
Expand All @@ -265,7 +267,11 @@ contract Utils is Script {
VestingWallet memory vestingWallet = _vestingWallets[i];
finalJson = vm.serializeAddress(json, vestingWallet.name, vestingWallet.vestingWalletAddress);
}
finalJson.write(string.concat("deployment/", network, string.concat("/vestingWallets_", _layer, ".json")));
finalJson.write(
string.concat(
"deployment/artifacts/contracts/", network, string.concat("/vestingWallets_", _layer, ".json")
)
);
}

/// @notice This function reads MerkleRoot from JSON file.
Expand Down Expand Up @@ -341,8 +347,9 @@ contract Utils is Script {
{
string memory network = getNetworkType();
string memory root = vm.projectRoot();
string memory vestingWalletsPath =
string.concat(root, "/deployment/", network, string.concat("/vestingWallets_", _layer, ".json"));
string memory vestingWalletsPath = string.concat(
root, "/deployment/artifacts/contracts/", network, string.concat("/vestingWallets_", _layer, ".json")
);
string memory vestingWalletsJson = vm.readFile(vestingWalletsPath);
return vm.parseJsonAddress(vestingWalletsJson, string.concat(".['", _vestingWalletName, "']"));
}
Expand Down
8 changes: 4 additions & 4 deletions script/example/demoClaim.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ then
exit
fi

echo "Removing files inside deployment directory if they exists..."
rm -rf deployment/devnet
echo "Removing files inside deployment/artifacts/contracts directory if they exists..."
rm -rf deployment/artifacts/contracts/devnet
echo "Done."

echo "Creating devnet directory inside deployment directory..."
mkdir deployment/devnet
echo "Creating devnet directory inside deployment/artifacts/contracts directory..."
mkdir deployment/artifacts/contracts/devnet
echo "Done."

echo "Deploying Demo L2LiskToken smart contract..."
Expand Down

0 comments on commit 1f545d4

Please sign in to comment.