Skip to content

Commit

Permalink
Merge pull request #134 from stader-labs/update_copies
Browse files Browse the repository at this point in the history
Update copies
  • Loading branch information
batphonghan authored Oct 26, 2023
2 parents 3f0d282 + bf4f45a commit fd18030
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
3 changes: 2 additions & 1 deletion stader-cli/node/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ func registerNode(c *cli.Context, operatorName string) error {

operatorRewardAddressString := walletStatus.AccountAddress.String()

confirmText := "Would you wish to join the ETHx Socializing pool?\nType 'Y' to Opt-in or 'N' to Opt-out. \nNote: The Opt-In and Opt-Out of socializing pool will have a cool-off period of 56 days.\ni.e you will have to wait for 56 days to Opt-Out of the Socializing pool once you Opt-In and vice versa.\nLearn more about the ETHx Socializing Pool here:\nhttps://staderlabs.gitbook.io/ethereum/node-operator/permissionless-node-operator/ethx-rewards-for-permissionless-node-operators/socializing-pool\n"
confirmText := "Would you wish to join the ETHx Socializing pool?\nType 'Y' to Opt-in or 'N' to Opt-out. \nNote: The Opt-In and Opt-Out of socializing pool will have a cool-off period of 56 days.\ni.e you will have to wait for 56 days to Opt-Out of the Socializing pool once you Opt-In and vice versa.\nLearn more about the ETHx Socializing Pool here:\nhttps://www.staderlabs.com/docs-v1/Ethereum/Node-operator/permissionless-node-operator/ethx-rewards-for-permissionless-node-operators/socializing-pool\n"

socializeEl := cliutils.Confirm(confirmText)

// Check node can be registered
canRegister, err := staderClient.CanRegisterNode(operatorName, common.HexToAddress(operatorRewardAddressString), socializeEl)
if err != nil {
Expand Down
24 changes: 18 additions & 6 deletions stader-cli/node/update-socialize-el.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package node

import (
"fmt"

"github.com/stader-labs/stader-node/shared/services/gas"
"github.com/urfave/cli"

Expand Down Expand Up @@ -50,8 +51,19 @@ func UpdateSocializeEl(c *cli.Context, socializeEl bool) error {
return err
}

if !(c.Bool("yes") || cliutils.Confirm(fmt.Sprintf(
"Are you sure you want to update socializing pool participation?"))) {
var confirmText string

if socializeEl {
confirmText = `
Note: There is a 56-day cool-off period for both Opt-In and Opt-Out of the socializing pool. For example, once you Opt-In, you will have to wait for 56 days to Opt-Out of the Socializing pool, and vice versa.
Are you sure you want to Opt-Into the socializing pool? `
} else {
confirmText = `
Note: There is a 56-day cool-off period for both Opt-In and Opt-Out of the socializing pool. For example, once you Opt-Out, you will have to wait for 56 days to Opt Into the Socializing pool, and vice versa.
Are you sure you want to Opt-Out of the socializing pool?`
}

if !(c.Bool("yes") || cliutils.Confirm(confirmText)) {
fmt.Println("Cancelled.")
return nil
}
Expand All @@ -63,9 +75,9 @@ func UpdateSocializeEl(c *cli.Context, socializeEl bool) error {
}

if socializeEl {
fmt.Printf("Opting in for socializing pool...\n")
fmt.Printf("Opting into the socializing pool...\n")
} else {
fmt.Printf("Opting out for socializing pool...\n")
fmt.Printf("Opting out of the socializing pool...\n")
}
cliutils.PrintTransactionHash(staderClient, response.TxHash)
_, err = staderClient.WaitForTransaction(response.TxHash)
Expand All @@ -74,9 +86,9 @@ func UpdateSocializeEl(c *cli.Context, socializeEl bool) error {
}

if socializeEl {
fmt.Printf("Opted in of socializing pool...\n")
fmt.Printf("Your request to Opt-In to the socializing pool is successful and will take effect after 3 epochs, approximately 20 minutes. \n")
} else {
fmt.Printf("Opted out of socializing pool...\n")
fmt.Printf("Your request to Opt-Out of the socializing pool is successful and will take effect after 3 epochs, approximately 20 minutes. \n")
}

return nil
Expand Down

0 comments on commit fd18030

Please sign in to comment.