diff --git a/pkg/user/admin/accept.go b/pkg/user/admin/accept.go index ca4a6ee5..a6d78648 100644 --- a/pkg/user/admin/accept.go +++ b/pkg/user/admin/accept.go @@ -76,6 +76,7 @@ func readAndValidateAcceptAdminConfig( logger logging.Logger, ) (*acceptAdminConfig, error) { accountAddress := gethcommon.HexToAddress(cliContext.String(AccountAddressFlag.Name)) + callerAddress := gethcommon.HexToAddress(cliContext.String(CallerAddress.Name)) ethRpcUrl := cliContext.String(flags.ETHRpcUrlFlag.Name) network := cliContext.String(flags.NetworkFlag.Name) environment := cliContext.String(flags.EnvironmentFlag.Name) @@ -98,6 +99,13 @@ func readAndValidateAcceptAdminConfig( return nil, err } } + if common.IsEmptyString(callerAddress.String()) { + logger.Infof( + "Caller address not provided. Using account address (%s) as caller address", + accountAddress, + ) + callerAddress = accountAddress + } logger.Debugf( "Env: %s, network: %s, chain ID: %s, PermissionManager address: %s", @@ -111,6 +119,7 @@ func readAndValidateAcceptAdminConfig( Network: network, RPCUrl: ethRpcUrl, AccountAddress: accountAddress, + CallerAddress: callerAddress, PermissionManagerAddress: gethcommon.HexToAddress(permissionManagerAddress), SignerConfig: *signerConfig, ChainID: chainID, @@ -144,7 +153,7 @@ func generateAcceptAdminWriter( return nil, eigenSdkUtils.WrapError("failed to create new eth client", err) } return common.GetELWriter( - config.AccountAddress, + config.CallerAddress, &config.SignerConfig, ethClient, elcontracts.Config{ diff --git a/pkg/user/admin/flags.go b/pkg/user/admin/flags.go index d7fb6a15..3a0d3b70 100644 --- a/pkg/user/admin/flags.go +++ b/pkg/user/admin/flags.go @@ -15,6 +15,13 @@ var ( Usage: "user admin ... --admin-address \"0x...\"", EnvVars: []string{"ADMIN_ADDRESS"}, } + CallerAddress = cli.StringFlag{ + Name: "caller-address", + Aliases: []string{"ca"}, + Usage: "This is the address of the caller who is calling the contract function. \n" + + "If it is not provided, the account address will be used as the caller address", + EnvVars: []string{"CALLER_ADDRESS"}, + } PendingAdminAddressFlag = cli.StringFlag{ Name: "pending-admin-address", Aliases: []string{"paa"}, diff --git a/pkg/user/admin/types.go b/pkg/user/admin/types.go index 22cb088f..e52550f2 100644 --- a/pkg/user/admin/types.go +++ b/pkg/user/admin/types.go @@ -49,6 +49,7 @@ type acceptAdminConfig struct { Network string RPCUrl string AccountAddress gethcommon.Address + CallerAddress gethcommon.Address PermissionManagerAddress gethcommon.Address SignerConfig types.SignerConfig ChainID *big.Int