Skip to content

Commit 033cca9

Browse files
committed
feat: mint both tokens and register with in both quorums
1 parent c4405c3 commit 033cca9

File tree

2 files changed

+104
-71
lines changed

2 files changed

+104
-71
lines changed

Makefile

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -267,11 +267,11 @@ operator_set_eigen_sdk_go_version_error:
267267
@echo "Error setting Eigen SDK version, missing ENVIRONMENT. Possible values for ENVIRONMENT=<devnet|testnet|mainnet>"
268268
exit 1
269269

270-
operator_full_registration_base: operator_get_eth operator_register_with_eigen_layer operator_whitelist_devnet
271-
operator_full_registration_weth: operator_full_registration_base operator_mint_mock_tokens operator_deposit_into_mock_strategy operator_register_with_aligned_layer_weth
272-
operator_full_registration_ali: operator_full_registration_base operator_mint_mock_tokens operator_deposit_into_mock_strategy operator_register_with_aligned_layer_ali
270+
operator_full_registration_base: operator_get_eth operator_register_with_eigen_layer operator_whitelist_devnet operator_mint_mock_tokens
271+
operator_full_registration_weth: operator_full_registration_base operator_deposit_into_weth_strategy operator_register_with_aligned_layer_weth
272+
operator_full_registration_ali: operator_full_registration_base operator_deposit_into_ali_strategy operator_register_with_aligned_layer_ali
273273

274-
operator_full_registration: operator_full_registration_base operator_mint_mock_tokens operator_deposit_into_mock_strategy operator_register_with_aligned_layer_weth
274+
operator_full_registration: operator_full_registration_base operator_deposit_into_weth_strategy operator_deposit_into_ali_strategy operator_register_with_aligned_layer_weth operator_register_with_aligned_layer_ali
275275

276276
operator_register_and_start: $(GET_SDK_VERSION) operator_full_registration operator_start
277277

@@ -360,39 +360,40 @@ operator_remove_from_whitelist:
360360
@echo "Removing operator $(OPERATOR_ADDRESS)"
361361
@. contracts/scripts/.env && . contracts/scripts/operator_remove_from_whitelist.sh $(OPERATOR_ADDRESS)
362362

363-
operator_deposit_into_mock_strategy:
364-
@echo "Depositing into mock strategy"
365-
$(eval STRATEGY_ADDRESS = $(shell jq -r '.addresses.strategies.ALI' contracts/script/output/devnet/eigenlayer_deployment_output.json))
363+
operator_deposit_into_weth_strategy:
364+
@echo "Depositing into WETH strategy"
365+
$(eval STRATEGY_ADDRESS = $(shell jq -r '.addresses.strategies.WETH' contracts/script/output/devnet/eigenlayer_deployment_output.json))
366366
@go run operator/cmd/main.go deposit-into-strategy \
367367
--config $(CONFIG_FILE) \
368368
--strategy-address $(STRATEGY_ADDRESS) \
369369
--amount 100000000000000000
370370

371-
372-
AMOUNT ?= 1000
373-
374-
operator_deposit_into_strategy:
375-
@echo "Depositing into strategy"
371+
operator_deposit_into_ali_strategy:
372+
@echo "Depositing into ALI strategy"
373+
$(eval STRATEGY_ADDRESS = $(shell jq -r '.addresses.strategies.ALI' contracts/script/output/devnet/eigenlayer_deployment_output.json))
376374
@go run operator/cmd/main.go deposit-into-strategy \
377375
--config $(CONFIG_FILE) \
378376
--strategy-address $(STRATEGY_ADDRESS) \
379-
--amount $(AMOUNT)
377+
--amount 100000000000000000
378+
379+
380+
AMOUNT ?= 1000
380381

381382
operator_register_with_aligned_layer_weth:
382383
@echo "Registering operator with AlignedLayer"
383384
@go run operator/cmd/main.go register \
384385
--config $(CONFIG_FILE) \
385386
--quorum-number 0
386-
387+
387388
operator_register_with_aligned_layer_ali:
388389
@echo "Registering operator with AlignedLayer"
389390
@go run operator/cmd/main.go register \
390391
--config $(CONFIG_FILE) \
391392
--quorum-number 1
392393

393-
operator_deposit_and_register_weth: operator_deposit_into_strategy operator_register_with_aligned_layer_weth
394+
operator_deposit_and_register_weth: operator_deposit_into_weth_strategy operator_register_with_aligned_layer_weth
394395

395-
operator_deposit_and_register_ali: operator_deposit_into_strategy operator_register_with_aligned_layer_ali
396+
operator_deposit_and_register_ali: operator_deposit_into_ali_strategy operator_register_with_aligned_layer_ali
396397

397398

398399
# The verifier ID to enable or disable corresponds to the index of the verifier in the `ProvingSystemID` enum.

scripts/mint_mock_token.sh

Lines changed: 87 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,89 @@
11
#!/bin/bash
22

3-
if [[ -z "$RPC_URL" ]]; then
4-
echo "RPC_URL is empty, using default value http://localhost:8545"
5-
RPC_URL="http://localhost:8545"
6-
fi;
7-
8-
# check that OPERATOR_ADDRESS is not empty
9-
if [[ -z "$OPERATOR_ADDRESS" ]]; then
10-
echo "OPERATOR_ADDRESS is empty, using default value 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
11-
OPERATOR_ADDRESS="0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
12-
fi;
13-
14-
# Check that the script received 2 arguments
15-
if [[ "$#" -ne 2 ]]; then
16-
echo "Usage: $0 <config_file> <amount>"
17-
exit 1
18-
fi;
19-
20-
mock_strategy_address=$(cat "contracts/script/output/devnet/eigenlayer_deployment_output.json" | jq -r '.addresses.strategies.WETH')
21-
mock_token_address=$(cast call "$mock_strategy_address" "underlyingToken()" --rpc-url "$RPC_URL")
22-
23-
operator_address=$(cat "$1" | yq -r '.operator.address')
24-
25-
if [[ -z "$mock_token_address" ]]; then
26-
echo "Mock token address is empty, please deploy the contracts first"
27-
exit 1
28-
fi;
29-
30-
31-
# Remove 0x prefix from mock token address
32-
mock_token_address=$(echo "$mock_token_address" | sed 's/^0x//')
33-
34-
stripped=$(echo "$mock_token_address" | sed 's/^0*//')
35-
36-
# Add back a single leading zero if the original string had any leading zeros
37-
if [[ "$mock_token_address" =~ ^0+ ]]; then
38-
mock_token_address="0$stripped"
39-
else
40-
mock_token_address="$stripped"
41-
fi
42-
43-
echo "Minting $2 tokens to $operator_address"
44-
echo "Mock token address: $mock_token_address"
45-
46-
# Ethereum sender address - anvil address 1
47-
private_key="0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
48-
49-
# Mint tokens
50-
# The deployment `contracts/eigenlayer_contracts/eigenlayer-contracts/script/deploy/local/deploy_from_scratch.slashing.s.sol`
51-
# send tokens to `executorMultisig` which is `0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266` (Anvil address 1)
52-
# We need to send tokens from `executorMultisig` to `operator_address`
53-
cast send "$mock_token_address" \
54-
"transfer(address recipient, uint256 amount)(bool)" \
55-
"$operator_address" "$2" \
56-
--private-key $private_key \
57-
--rpc-url $RPC_URL
3+
# Configuration
4+
PRIVATE_KEY="0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
5+
DEFAULT_RPC_URL="http://localhost:8545"
6+
DEPLOYMENT_FILE="contracts/script/output/devnet/eigenlayer_deployment_output.json"
7+
8+
# Function to validate input arguments
9+
validate_args() {
10+
if [[ "$#" -ne 2 ]]; then
11+
echo "Usage: $0 <config_file> <amount>"
12+
exit 1
13+
fi
14+
}
15+
16+
# Function to set RPC_URL
17+
set_rpc_url() {
18+
RPC_URL=${RPC_URL:-$DEFAULT_RPC_URL}
19+
echo "Using RPC_URL: $RPC_URL"
20+
}
21+
22+
# Function to get operator address from config file
23+
get_operator_address() {
24+
local config_file="$1"
25+
OPERATOR_ADDRESS=$(yq -r '.operator.address' "$config_file")
26+
if [[ -z "$OPERATOR_ADDRESS" ]]; then
27+
echo "Error: Could not read operator address from $config_file"
28+
exit 1
29+
fi
30+
}
31+
32+
# Function to normalize address (remove 0x prefix and handle leading zeros)
33+
normalize_address() {
34+
local address=$1
35+
# Remove '0x' prefix, take last 40 characters, then add '0x' back
36+
echo "0x$(echo "$address" | sed 's/^0x//' | tail -c 41)"
37+
}
38+
39+
# Function to get mock token address
40+
get_mock_token_address() {
41+
local strategy_type="$1"
42+
local mock_strategy_address=$(jq -r ".addresses.strategies.$strategy_type" "$DEPLOYMENT_FILE")
43+
local mock_token_address=$(cast call "$mock_strategy_address" "underlyingToken()" --rpc-url "$RPC_URL")
44+
45+
if [[ -z "$mock_token_address" ]]; then
46+
echo "Error: Mock token address is empty for $strategy_type. Please deploy contracts first."
47+
exit 1
48+
fi
49+
50+
normalize_address "$mock_token_address"
51+
}
52+
53+
# Function to mint tokens
54+
mint_tokens() {
55+
local token_address="$1"
56+
local recipient="$2"
57+
local amount="$3"
58+
59+
echo "Minting $amount tokens to $recipient"
60+
echo "Token address: $token_address"
61+
62+
cast send "$token_address" \
63+
"transfer(address recipient, uint256 amount)(bool)" \
64+
"$recipient" "$amount" \
65+
--private-key "$PRIVATE_KEY" \
66+
--rpc-url "$RPC_URL"
67+
}
68+
69+
# Main execution
70+
main() {
71+
validate_args "$@"
72+
set_rpc_url
73+
74+
local config_file="$1"
75+
local amount="$2"
76+
77+
get_operator_address "$config_file"
78+
79+
# Mint WETH tokens
80+
local weth_token_address=$(get_mock_token_address "WETH")
81+
mint_tokens "$weth_token_address" "$OPERATOR_ADDRESS" "$amount"
82+
83+
# Mint ALI tokens
84+
local ali_token_address=$(get_mock_token_address "ALI")
85+
mint_tokens "$ali_token_address" "$OPERATOR_ADDRESS" "$amount"
86+
}
87+
88+
# Execute main function
89+
main "$@"

0 commit comments

Comments
 (0)