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

Add Base Sepolia USDC, update deploy.sh #29

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
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
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@ To nullify inflation attacks, `CometWrapper` maintains internal accounting of al

### Testnets

| Network | Base Asset | CometWrapper Address |
| -------- | ---------- | ------------------------------------------ |
| Sepolia | USDC | 0xC3836072018B4D590488b851d574556f2EeB895a |
| Network | Base Asset | CometWrapper Address |
| ------------ | ------------- | ------------------------------------------ |
| Sepolia | USDC | 0xC3836072018B4D590488b851d574556f2EeB895a |
| Base Sepolia | USDC | 0x383eCD943E338357c0D81942933acA781C2E74cE |

## Usage

Expand Down
1 change: 1 addition & 0 deletions script/DeployCometWrapper.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { CometWrapper, CometInterface, ICometRewards, CometHelpers, IERC20 } fro
// PROXY_ADMIN_ADDRESS
// TOKEN_NAME
// TOKEN_SYMBOL
// CHAIN_ID

// Optional but suggested ENV vars:
// ETHERSCAN_KEY
Expand Down
73 changes: 48 additions & 25 deletions script/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,35 +20,58 @@ else
etherscan_args=""
fi

if [ -z "$COMET_ADDRESS" ]; then
echo "COMET_ADDRESS is not set"
exit 1
fi

if [ -z "$REWARDS_ADDRESS" ]; then
echo "REWARDS_ADDRESS is not set"
exit 1
fi

if [ -z "$PROXY_ADMIN_ADDRESS" ]; then
echo "PROXY_ADMIN_ADDRESS is not set"
exit 1
fi

if [ -z "$TOKEN_NAME" ]; then
echo "TOKEN_NAME is not set"
exit 1
fi

if [ -z "$TOKEN_SYMBOL" ]; then
echo "TOKEN_SYMBOL is not set"
exit 1
fi
# Check for required environment variables
required_vars=("COMET_ADDRESS" "REWARDS_ADDRESS" "PROXY_ADMIN_ADDRESS" "TOKEN_NAME" "TOKEN_SYMBOL" "CHAIN_ID")
for var in "${required_vars[@]}"; do
if [ -z "${!var}" ]; then
echo "$var is not set"
exit 1
fi
done

# Run the Forge script
forge script \
$rpc_args \
$wallet_args \
$etherscan_args \
--broadcast \
$@ \
script/DeployCometWrapper.s.sol:DeployCometWrapper
script/DeployCometWrapper.s.sol:DeployCometWrapper

# Check if verification is enabled
if [ -n "$ETHERSCAN_KEY" ]; then
# Extract the deployed contract address from the Forge output
deployed_address=$(grep -oP 'Contract Address: \K[0-9a-fA-F]{40}' forge-output.txt)

if [ -n "$deployed_address" ]; then
echo "Waiting for contract verification..."

# Loop until verification is successful or timeout occurs
timeout=300 # 5 minutes timeout
start_time=$(date +%s)

while true; do
verification_status=$(forge verify-contract $deployed_address DeployCometWrapper --chain-id $CHAIN_ID --etherscan-api-key $ETHERSCAN_KEY --watch)

if [[ $verification_status == *"Contract successfully verified"* ]]; then
echo "Contract successfully verified!"
break
fi

current_time=$(date +%s)
elapsed_time=$((current_time - start_time))

if [ $elapsed_time -ge $timeout ]; then
echo "Verification timed out after ${timeout} seconds."
exit 1
fi

sleep 10 # Wait for 10 seconds before checking again
done
else
echo "Failed to extract deployed contract address."
exit 1
fi
else
echo "Verification skipped (ETHERSCAN_KEY not set)."
fi
Loading