Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: linting #23

Merged
merged 2 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
},
"scripts": {
"build": "chmod +x shell/*.sh && ./shell/full_install.sh",
"prettier": "prettier --no-error-on-unmatched-pattern --write 'src/**/*.sol' '**/*.html'",
"prettier:list": "prettier --no-error-on-unmatched-pattern --list-different 'src/**/*.sol' '**/*.html'",
"prettier:check": "prettier --no-error-on-unmatched-pattern --check 'src/**/*.sol' '**/*.html'",
"prettier": "prettier --no-error-on-unmatched-pattern --write 'src/**/*.sol' '**/*.html' '**/*.sh'",
"prettier:list": "prettier --no-error-on-unmatched-pattern --list-different 'src/**/*.sol' '**/*.html' '**/*.sh'",
"prettier:check": "prettier --no-error-on-unmatched-pattern --check 'src/**/*.sol' '**/*.html' '**/*.sh'",
"solhint": "solhint --config ./.solhint.json 'src/**/*.sol' --fix",
"solhint:check": "solhint --config ./.solhint.json 'src/**/*.sol'",
"markdownlint": "markdownlint --fix '**/*.md'",
Expand All @@ -34,7 +34,8 @@
},
"devDependencies": {
"markdownlint-cli": "^0.42.0",
"prettier": "^2.5.1",
"prettier": "^3.0.3",
"prettier-plugin-sh": "^0.14.0",
"prettier-plugin-solidity": "^1.0.0-beta.19",
"solhint": "^3.3.7",
"solidity-code-metrics": "^0.0.25"
Expand All @@ -45,7 +46,8 @@
"bracketSpacing": false,
"printWidth": 100,
"plugins": [
"prettier-plugin-solidity"
"prettier-plugin-solidity",
"prettier-plugin-sh"
]
}
}
53 changes: 47 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 23 additions & 23 deletions shell/change_price.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
source .env

# User-provided input ($1) is the dollar price of OHM
echo "Setting OHM price to \$$1 on Testnet.";
echo "";
echo "Setting OHM price to \$$1 on Testnet."
echo ""

# Convert dollar price of OHM into price feed value (using ETH = $1500)
OHM_ETH_PRICE=$(echo "$1*1000000000000000000/1500" | bc);
OHM_ETH_PRICE=$(echo "$1*1000000000000000000/1500" | bc)

# DAI price feed value is fixed using ETH = $1500
DAI_ETH_PRICE=666666666666667
Expand All @@ -16,27 +16,27 @@ DAI_ETH_PRICE=666666666666667
TIMESTAMP=$(date +%s)

# Set price feed values
echo "Updating the OHM price feed...";
cast send --private-key=$POLICY_PRIVATE_KEY --rpc-url=$RPC_URL --from=$POLICY_ADDRESS --chain=$CHAIN $OHM_ETH_FEED "setLatestAnswer(int256)()" $OHM_ETH_PRICE > /dev/null;
cast send --private-key=$POLICY_PRIVATE_KEY --rpc-url=$RPC_URL --from=$POLICY_ADDRESS --chain=$CHAIN $OHM_ETH_FEED "setTimestamp(uint256)()" $TIMESTAMP > /dev/null;
echo "Complete.";
echo "";

echo "Updating the DAI price feed...";
cast send --private-key=$POLICY_PRIVATE_KEY --from=$POLICY_ADDRESS --rpc-url=$RPC_URL --chain=$CHAIN $DAI_ETH_FEED "setLatestAnswer(int256)" $DAI_ETH_PRICE > /dev/null;
cast send --private-key=$POLICY_PRIVATE_KEY --from=$POLICY_ADDRESS --rpc-url=$RPC_URL --chain=$CHAIN $DAI_ETH_FEED "setTimestamp(uint256)" $TIMESTAMP > /dev/null;
echo "Complete.";
echo "";
echo "Updating the OHM price feed..."
cast send --private-key=$POLICY_PRIVATE_KEY --rpc-url=$RPC_URL --from=$POLICY_ADDRESS --chain=$CHAIN $OHM_ETH_FEED "setLatestAnswer(int256)()" $OHM_ETH_PRICE > /dev/null
cast send --private-key=$POLICY_PRIVATE_KEY --rpc-url=$RPC_URL --from=$POLICY_ADDRESS --chain=$CHAIN $OHM_ETH_FEED "setTimestamp(uint256)()" $TIMESTAMP > /dev/null
echo "Complete."
echo ""

echo "Updating the DAI price feed..."
cast send --private-key=$POLICY_PRIVATE_KEY --from=$POLICY_ADDRESS --rpc-url=$RPC_URL --chain=$CHAIN $DAI_ETH_FEED "setLatestAnswer(int256)" $DAI_ETH_PRICE > /dev/null
cast send --private-key=$POLICY_PRIVATE_KEY --from=$POLICY_ADDRESS --rpc-url=$RPC_URL --chain=$CHAIN $DAI_ETH_FEED "setTimestamp(uint256)" $TIMESTAMP > /dev/null
echo "Complete."
echo ""

# Reset heart and call heart.beat()
echo "Resetting the heart...";
cast send --private-key=$POLICY_PRIVATE_KEY --from=$POLICY_ADDRESS --rpc-url=$RPC_URL --chain=$CHAIN $HEART "resetBeat()" > /dev/null;
echo "Complete.";
echo "";
echo "Resetting the heart..."
cast send --private-key=$POLICY_PRIVATE_KEY --from=$POLICY_ADDRESS --rpc-url=$RPC_URL --chain=$CHAIN $HEART "resetBeat()" > /dev/null
echo "Complete."
echo ""

echo "Calling heart.beat()...";
cast send --private-key=$POLICY_PRIVATE_KEY --from=$POLICY_ADDRESS --rpc-url=$RPC_URL --chain=$CHAIN $HEART "beat()" > /dev/null;
echo "Complete.";
echo "";
echo "Calling heart.beat()..."
cast send --private-key=$POLICY_PRIVATE_KEY --from=$POLICY_ADDRESS --rpc-url=$RPC_URL --chain=$CHAIN $HEART "beat()" > /dev/null
echo "Complete."
echo ""

echo "Price update complete and Operator state updated.";
echo "Price update complete and Operator state updated."
8 changes: 4 additions & 4 deletions shell/change_vault_authority.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
source .env

# User-provided input ($1) is an Ethereum address
echo "Setting OlympusAuthority Vault to $1 on Testnet.";
echo "";
echo "Setting OlympusAuthority Vault to $1 on Testnet."
echo ""

cast send --private-key=$GOV_PRIVATE_KEY --rpc-url=$RPC_URL --from=$GOV_ADDRESS --chain=$CHAIN $AUTHORITY_ADDRESS "pushVault(address,bool)()" $1 1;
cast send --private-key=$GOV_PRIVATE_KEY --rpc-url=$RPC_URL --from=$GOV_ADDRESS --chain=$CHAIN $AUTHORITY_ADDRESS "pushVault(address,bool)()" $1 1

echo "Complete.";
echo "Complete."
92 changes: 44 additions & 48 deletions shell/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,47 +18,44 @@ set -e
# Iterate through named arguments
# Source: https://unix.stackexchange.com/a/388038
while [ $# -gt 0 ]; do
if [[ $1 == *"--"* ]]; then
v="${1/--/}"
declare $v="$2"
fi
if [[ $1 == *"--"* ]]; then
v="${1/--/}"
declare $v="$2"
fi

shift
shift
done

# Get the name of the .env file or use the default
ENV_FILE=${env:-".env"}
echo "Sourcing environment variables from $ENV_FILE"

# Load environment file
set -a # Automatically export all variables
set -a # Automatically export all variables
source $ENV_FILE
set +a # Disable automatic export
set +a # Disable automatic export

# Set sane defaults
BROADCAST=${broadcast:-false}
VERIFY=${verify:-false}
RESUME=${resume:-false}

# Check if sequence is set
if [ -z "$sequence" ]
then
echo "No deployment sequence specified. Provide the relative path after the --sequence flag."
exit 1
if [ -z "$sequence" ]; then
echo "No deployment sequence specified. Provide the relative path after the --sequence flag."
exit 1
fi

# Check if the sequence file exists
if [ ! -f "$sequence" ]
then
echo "Deployment sequence ($sequence) not found. Provide the correct relative path after the --sequence flag."
exit 1
if [ ! -f "$sequence" ]; then
echo "Deployment sequence ($sequence) not found. Provide the correct relative path after the --sequence flag."
exit 1
fi

# Check if CHAIN is set
if [ -z "$CHAIN" ]
then
echo "No chain specified. Specify the CHAIN in the $ENV_FILE file."
exit 1
if [ -z "$CHAIN" ]; then
echo "No chain specified. Specify the CHAIN in the $ENV_FILE file."
exit 1
fi

echo "Deployment sequence: $sequence"
Expand All @@ -68,50 +65,49 @@ echo "Using RPC at URL: $RPC_URL"
# Set BROADCAST_FLAG based on BROADCAST
BROADCAST_FLAG=""
if [ "$BROADCAST" = "true" ] || [ "$BROADCAST" = "TRUE" ]; then
BROADCAST_FLAG="--broadcast"
echo "Broadcasting is enabled"
BROADCAST_FLAG="--broadcast"
echo "Broadcasting is enabled"
else
echo "Broadcasting is disabled"
echo "Broadcasting is disabled"
fi

# Set VERIFY_FLAG based on VERIFY
VERIFY_FLAG=""
if [ "$VERIFY" = "true" ] || [ "$VERIFY" = "TRUE" ]; then

# Check if ETHERSCAN_KEY is set
if [ -z "$ETHERSCAN_KEY" ]
then
echo "No Etherscan API key found. Provide the key in $ENV_FILE or disable verification."
exit 1
fi

if [ -n "$VERIFIER_URL" ]; then
echo "Using verifier at URL: $VERIFIER_URL"
VERIFY_FLAG="--verify --etherscan-api-key $ETHERSCAN_KEY --verifier-url $VERIFIER_URL"
else
echo "Using standard verififer"
VERIFY_FLAG="--verify --etherscan-api-key $ETHERSCAN_KEY"
fi

echo "Verification is enabled"
# Check if ETHERSCAN_KEY is set
if [ -z "$ETHERSCAN_KEY" ]; then
echo "No Etherscan API key found. Provide the key in $ENV_FILE or disable verification."
exit 1
fi

if [ -n "$VERIFIER_URL" ]; then
echo "Using verifier at URL: $VERIFIER_URL"
VERIFY_FLAG="--verify --etherscan-api-key $ETHERSCAN_KEY --verifier-url $VERIFIER_URL"
else
echo "Using standard verififer"
VERIFY_FLAG="--verify --etherscan-api-key $ETHERSCAN_KEY"
fi

echo "Verification is enabled"
else
echo "Verification is disabled"
echo "Verification is disabled"
fi

# Set RESUME_FLAG based on RESUME
RESUME_FLAG=""
if [ "$RESUME" = "true" ] || [ "$RESUME" = "TRUE" ]; then
RESUME_FLAG="--resume"
echo "Resuming is enabled"
RESUME_FLAG="--resume"
echo "Resuming is enabled"
else
echo "Resuming is disabled"
echo "Resuming is disabled"
fi

# Deploy using script
forge script ./src/scripts/deploy/DeployV2.sol:OlympusDeploy \
--sig "deploy(string,string)()" $CHAIN $sequence \
--rpc-url $RPC_URL --private-key $PRIVATE_KEY --slow -vvv \
--with-gas-price $GAS_PRICE \
$BROADCAST_FLAG \
$VERIFY_FLAG \
$RESUME_FLAG
--sig "deploy(string,string)()" $CHAIN $sequence \
--rpc-url $RPC_URL --private-key $PRIVATE_KEY --slow -vvv \
--with-gas-price $GAS_PRICE \
$BROADCAST_FLAG \
$VERIFY_FLAG \
$RESUME_FLAG
4 changes: 2 additions & 2 deletions shell/deploy_auth_ohm_token.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
source .env

# Deploy using script
forge script ./src/scripts/DeployAuthAndOhmToken.s.sol:DeployAuthAndOhmToken --sig "deploy(address)()" $GUARDIAN_ADDRESS --rpc-url $RPC_URL --private-key $PRIVATE_KEY --slow -vvvvv \
forge script ./src/scripts/DeployAuthAndOhmToken.s.sol:DeployAuthAndOhmToken --sig "deploy(address)()" $GUARDIAN_ADDRESS --rpc-url $RPC_URL --private-key $PRIVATE_KEY --slow -vvvvv
# --broadcast --verify --etherscan-api-key $ETHERSCAN_KEY #\ # uncomment to broadcast to the network
# --resume # uncomment to resume from a previous deployment
# --resume # uncomment to resume from a previous deployment
Loading
Loading