Skip to content

Commit

Permalink
Rename permission manager (#280)
Browse files Browse the repository at this point in the history
Co-authored-by: Brandon Chatham <[email protected]>
  • Loading branch information
bdchatham and Brandon Chatham authored Dec 20, 2024
1 parent 026cfdb commit c2daa7a
Show file tree
Hide file tree
Showing 17 changed files with 358 additions and 358 deletions.
46 changes: 23 additions & 23 deletions pkg/internal/common/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,31 +48,31 @@ const (

var ChainMetadataMap = map[int64]types.ChainMetadata{
MainnetChainId: {
BlockExplorerUrl: "https://etherscan.io/tx",
ELDelegationManagerAddress: "0x39053D51B77DC0d36036Fc1fCc8Cb819df8Ef37A",
ELAVSDirectoryAddress: "0x135dda560e946695d6f155dacafc6f1f25c1f5af",
ELRewardsCoordinatorAddress: "0x7750d328b314EfFa365A0402CcfD489B80B0adda",
ELPermissionManagerAddress: "",
WebAppUrl: "https://app.eigenlayer.xyz/operator",
ProofStoreBaseURL: "https://eigenlabs-rewards-mainnet-ethereum.s3.amazonaws.com",
BlockExplorerUrl: "https://etherscan.io/tx",
ELDelegationManagerAddress: "0x39053D51B77DC0d36036Fc1fCc8Cb819df8Ef37A",
ELAVSDirectoryAddress: "0x135dda560e946695d6f155dacafc6f1f25c1f5af",
ELRewardsCoordinatorAddress: "0x7750d328b314EfFa365A0402CcfD489B80B0adda",
ELPermissionControllerAddress: "",
WebAppUrl: "https://app.eigenlayer.xyz/operator",
ProofStoreBaseURL: "https://eigenlabs-rewards-mainnet-ethereum.s3.amazonaws.com",
},
HoleskyChainId: {
BlockExplorerUrl: "https://holesky.etherscan.io/tx",
ELDelegationManagerAddress: "0xA44151489861Fe9e3055d95adC98FbD462B948e7",
ELAVSDirectoryAddress: "0x055733000064333CaDDbC92763c58BF0192fFeBf",
ELRewardsCoordinatorAddress: "0xAcc1fb458a1317E886dB376Fc8141540537E68fE",
ELPermissionManagerAddress: "0x598cb226B591155F767dA17AfE7A2241a68C5C10",
WebAppUrl: "https://holesky.eigenlayer.xyz/operator",
ProofStoreBaseURL: "https://eigenlabs-rewards-testnet-holesky.s3.amazonaws.com",
BlockExplorerUrl: "https://holesky.etherscan.io/tx",
ELDelegationManagerAddress: "0xA44151489861Fe9e3055d95adC98FbD462B948e7",
ELAVSDirectoryAddress: "0x055733000064333CaDDbC92763c58BF0192fFeBf",
ELRewardsCoordinatorAddress: "0xAcc1fb458a1317E886dB376Fc8141540537E68fE",
ELPermissionControllerAddress: "0x598cb226B591155F767dA17AfE7A2241a68C5C10",
WebAppUrl: "https://holesky.eigenlayer.xyz/operator",
ProofStoreBaseURL: "https://eigenlabs-rewards-testnet-holesky.s3.amazonaws.com",
},
AnvilChainId: {
BlockExplorerUrl: "",
ELDelegationManagerAddress: "0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9",
ELAVSDirectoryAddress: "0x0165878A594ca255338adfa4d48449f69242Eb8F",
ELRewardsCoordinatorAddress: "0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6",
ELPermissionManagerAddress: "",
WebAppUrl: "",
ProofStoreBaseURL: "",
BlockExplorerUrl: "",
ELDelegationManagerAddress: "0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9",
ELAVSDirectoryAddress: "0x0165878A594ca255338adfa4d48449f69242Eb8F",
ELRewardsCoordinatorAddress: "0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6",
ELPermissionControllerAddress: "0x3Aa5ebB10DC797CAC828524e59A333d0A371443c",
WebAppUrl: "",
ProofStoreBaseURL: "",
},
}

Expand Down Expand Up @@ -342,13 +342,13 @@ func GetDelegationManagerAddress(chainID *big.Int) (string, error) {
}
}

func GetPermissionManagerAddress(chainID *big.Int) (string, error) {
func GetPermissionControllerAddress(chainID *big.Int) (string, error) {
chainIDInt := chainID.Int64()
chainMetadata, ok := ChainMetadataMap[chainIDInt]
if !ok {
return "", fmt.Errorf("chain ID %d not supported", chainIDInt)
} else {
return chainMetadata.ELDelegationManagerAddress, nil
return chainMetadata.ELPermissionControllerAddress, nil
}
}

Expand Down
14 changes: 7 additions & 7 deletions pkg/types/chain_metadata.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package types

type ChainMetadata struct {
BlockExplorerUrl string
ELDelegationManagerAddress string
ELAVSDirectoryAddress string
ELRewardsCoordinatorAddress string
ELPermissionManagerAddress string
WebAppUrl string
ProofStoreBaseURL string
BlockExplorerUrl string
ELDelegationManagerAddress string
ELAVSDirectoryAddress string
ELRewardsCoordinatorAddress string
ELPermissionControllerAddress string
WebAppUrl string
ProofStoreBaseURL string
}
34 changes: 17 additions & 17 deletions pkg/user/admin/accept.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,34 +163,34 @@ func readAndValidateAcceptAdminConfig(
}

chainID := utils.NetworkNameToChainId(network)
permissionManagerAddress := cliContext.String(PermissionControllerAddressFlag.Name)
PermissionControllerAddress := cliContext.String(PermissionControllerAddressFlag.Name)

if common.IsEmptyString(permissionManagerAddress) {
permissionManagerAddress, err = common.GetPermissionManagerAddress(utils.NetworkNameToChainId(network))
if common.IsEmptyString(PermissionControllerAddress) {
PermissionControllerAddress, err = common.GetPermissionControllerAddress(utils.NetworkNameToChainId(network))
if err != nil {
return nil, err
}
}
logger.Debugf(
"Env: %s, network: %s, chain ID: %s, PermissionManager address: %s",
"Env: %s, network: %s, chain ID: %s, PermissionController address: %s",
environment,
network,
chainID,
permissionManagerAddress,
PermissionControllerAddress,
)

return &acceptAdminConfig{
Network: network,
RPCUrl: ethRpcUrl,
AccountAddress: accountAddress,
CallerAddress: callerAddress,
PermissionManagerAddress: gethcommon.HexToAddress(permissionManagerAddress),
SignerConfig: *signerConfig,
ChainID: chainID,
Environment: environment,
OutputFile: outputFile,
OutputType: outputType,
Broadcast: broadcast,
Network: network,
RPCUrl: ethRpcUrl,
AccountAddress: accountAddress,
CallerAddress: callerAddress,
PermissionControllerAddress: gethcommon.HexToAddress(PermissionControllerAddress),
SignerConfig: *signerConfig,
ChainID: chainID,
Environment: environment,
OutputFile: outputFile,
OutputType: outputType,
Broadcast: broadcast,
}, nil
}

Expand Down Expand Up @@ -225,7 +225,7 @@ func generateAcceptAdminWriter(
&config.SignerConfig,
ethClient,
elcontracts.Config{
PermissionsControllerAddress: config.PermissionManagerAddress,
PermissionsControllerAddress: config.PermissionControllerAddress,
},
prompter,
config.ChainID,
Expand Down
36 changes: 18 additions & 18 deletions pkg/user/admin/add_pending.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,36 +166,36 @@ func readAndValidateAddPendingAdminConfig(
}

chainID := utils.NetworkNameToChainId(network)
permissionManagerAddress := cliContext.String(PermissionControllerAddressFlag.Name)
PermissionControllerAddress := cliContext.String(PermissionControllerAddressFlag.Name)

if common.IsEmptyString(permissionManagerAddress) {
permissionManagerAddress, err = common.GetPermissionManagerAddress(utils.NetworkNameToChainId(network))
if common.IsEmptyString(PermissionControllerAddress) {
PermissionControllerAddress, err = common.GetPermissionControllerAddress(utils.NetworkNameToChainId(network))
if err != nil {
return nil, err
}
}

logger.Debugf(
"Env: %s, network: %s, chain ID: %s, PermissionManager address: %s",
"Env: %s, network: %s, chain ID: %s, PermissionController address: %s",
environment,
network,
chainID,
permissionManagerAddress,
PermissionControllerAddress,
)

return &addPendingAdminConfig{
Network: network,
RPCUrl: ethRpcUrl,
AccountAddress: accountAddress,
AdminAddress: adminAddress,
CallerAddress: callerAddress,
SignerConfig: *signerConfig,
PermissionManagerAddress: gethcommon.HexToAddress(permissionManagerAddress),
ChainID: chainID,
Environment: environment,
OutputFile: outputFile,
OutputType: outputType,
Broadcast: broadcast,
Network: network,
RPCUrl: ethRpcUrl,
AccountAddress: accountAddress,
AdminAddress: adminAddress,
CallerAddress: callerAddress,
SignerConfig: *signerConfig,
PermissionControllerAddress: gethcommon.HexToAddress(PermissionControllerAddress),
ChainID: chainID,
Environment: environment,
OutputFile: outputFile,
OutputType: outputType,
Broadcast: broadcast,
}, nil
}

Expand All @@ -212,7 +212,7 @@ func generateAddPendingAdminWriter(
&config.SignerConfig,
ethClient,
elcontracts.Config{
PermissionsControllerAddress: config.PermissionManagerAddress,
PermissionsControllerAddress: config.PermissionControllerAddress,
},
prompter,
config.ChainID,
Expand Down
26 changes: 13 additions & 13 deletions pkg/user/admin/is_admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,32 +73,32 @@ func readAndValidateIsAdminConfig(cliContext *cli.Context, logger logging.Logger
}

chainID := utils.NetworkNameToChainId(network)
permissionManagerAddress := cliContext.String(PermissionControllerAddressFlag.Name)
PermissionControllerAddress := cliContext.String(PermissionControllerAddressFlag.Name)

var err error
if common.IsEmptyString(permissionManagerAddress) {
permissionManagerAddress, err = common.GetPermissionManagerAddress(utils.NetworkNameToChainId(network))
if common.IsEmptyString(PermissionControllerAddress) {
PermissionControllerAddress, err = common.GetPermissionControllerAddress(utils.NetworkNameToChainId(network))
if err != nil {
return nil, err
}
}

logger.Debugf(
"Env: %s, network: %s, chain ID: %s, PermissionManager address: %s",
"Env: %s, network: %s, chain ID: %s, PermissionController address: %s",
environment,
network,
chainID,
permissionManagerAddress,
PermissionControllerAddress,
)

return &isAdminConfig{
Network: network,
RPCUrl: ethRpcUrl,
AccountAddress: accountAddress,
AdminAddress: adminAddress,
PermissionManagerAddress: gethcommon.HexToAddress(permissionManagerAddress),
ChainID: chainID,
Environment: environment,
Network: network,
RPCUrl: ethRpcUrl,
AccountAddress: accountAddress,
AdminAddress: adminAddress,
PermissionControllerAddress: gethcommon.HexToAddress(PermissionControllerAddress),
ChainID: chainID,
Environment: environment,
}, nil
}

Expand All @@ -117,7 +117,7 @@ func generateIsAdminReader(logger logging.Logger, config *isAdminConfig) (IsAdmi
}
elReader, err := elcontracts.NewReaderFromConfig(
elcontracts.Config{
PermissionsControllerAddress: config.PermissionManagerAddress,
PermissionsControllerAddress: config.PermissionControllerAddress,
},
ethClient,
logger,
Expand Down
26 changes: 13 additions & 13 deletions pkg/user/admin/is_pending.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,32 +81,32 @@ func readAndValidateIsPendingAdminConfig(
}

chainID := utils.NetworkNameToChainId(network)
permissionManagerAddress := cliContext.String(PermissionControllerAddressFlag.Name)
PermissionControllerAddress := cliContext.String(PermissionControllerAddressFlag.Name)

var err error
if common.IsEmptyString(permissionManagerAddress) {
permissionManagerAddress, err = common.GetPermissionManagerAddress(utils.NetworkNameToChainId(network))
if common.IsEmptyString(PermissionControllerAddress) {
PermissionControllerAddress, err = common.GetPermissionControllerAddress(utils.NetworkNameToChainId(network))
if err != nil {
return nil, err
}
}

logger.Debugf(
"Env: %s, network: %s, chain ID: %s, PermissionManager address: %s",
"Env: %s, network: %s, chain ID: %s, PermissionController address: %s",
environment,
network,
chainID,
permissionManagerAddress,
PermissionControllerAddress,
)

return &isPendingAdminConfig{
Network: network,
RPCUrl: ethRpcUrl,
AccountAddress: accountAddress,
PendingAdminAddress: pendingAdminAddress,
PermissionManagerAddress: gethcommon.HexToAddress(permissionManagerAddress),
ChainID: chainID,
Environment: environment,
Network: network,
RPCUrl: ethRpcUrl,
AccountAddress: accountAddress,
PendingAdminAddress: pendingAdminAddress,
PermissionControllerAddress: gethcommon.HexToAddress(PermissionControllerAddress),
ChainID: chainID,
Environment: environment,
}, nil
}

Expand All @@ -125,7 +125,7 @@ func generateIsPendingAdminReader(logger logging.Logger, config *isPendingAdminC
}
elReader, err := elcontracts.NewReaderFromConfig(
elcontracts.Config{
PermissionsControllerAddress: config.PermissionManagerAddress,
PermissionsControllerAddress: config.PermissionControllerAddress,
},
ethClient,
logger,
Expand Down
24 changes: 12 additions & 12 deletions pkg/user/admin/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,31 +83,31 @@ func readAndValidateListAdminsConfig(cliContext *cli.Context, logger logging.Log
}

chainID := utils.NetworkNameToChainId(network)
permissionManagerAddress := cliContext.String(PermissionControllerAddressFlag.Name)
permissionControllerAddress := cliContext.String(PermissionControllerAddressFlag.Name)

var err error
if common.IsEmptyString(permissionManagerAddress) {
permissionManagerAddress, err = common.GetPermissionManagerAddress(utils.NetworkNameToChainId(network))
if common.IsEmptyString(permissionControllerAddress) {
permissionControllerAddress, err = common.GetPermissionControllerAddress(utils.NetworkNameToChainId(network))
if err != nil {
return nil, err
}
}

logger.Debugf(
"Env: %s, network: %s, chain ID: %s, PermissionManager address: %s",
"Env: %s, network: %s, chain ID: %s, PermissionController address: %s",
environment,
network,
chainID,
permissionManagerAddress,
permissionControllerAddress,
)

return &listAdminsConfig{
Network: network,
RPCUrl: ethRpcUrl,
AccountAddress: accountAddress,
PermissionManagerAddress: gethcommon.HexToAddress(permissionManagerAddress),
ChainID: chainID,
Environment: environment,
Network: network,
RPCUrl: ethRpcUrl,
AccountAddress: accountAddress,
PermissionControllerAddress: gethcommon.HexToAddress(permissionControllerAddress),
ChainID: chainID,
Environment: environment,
}, nil
}

Expand All @@ -118,7 +118,7 @@ func generateListAdminsReader(logger logging.Logger, config *listAdminsConfig) (
}
elReader, err := elcontracts.NewReaderFromConfig(
elcontracts.Config{
PermissionsControllerAddress: config.PermissionManagerAddress,
PermissionsControllerAddress: config.PermissionControllerAddress,
},
ethClient,
logger,
Expand Down
Loading

0 comments on commit c2daa7a

Please sign in to comment.