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

V1 Improved node deposit and node stake-rpl flow #694

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

thomaspanf
Copy link
Member

Included in this PR:

  • New suggested RPL stake options in stake-rpl, because changing node.per.minipool.stake.minimum to 0 broke the old selection
Please choose an amount of RPL to stake:
1: 5% of borrowed ETH (276.648996 RPL) for one minipool?
2: 10% of borrowed ETH (553.297992 RPL) for one minipool?
3: 15% of borrowed ETH (829.946988 RPL) for one minipool?
  • Reintroduced the -y and -a flags to node deposit for users who automate minipool deposits (10/10 foresight)

  • node deposit and create-vacant-minipool uses a y/n confirmation rather than prompting for a selection:

// New
NOTE: You are about to make an 8 ETH deposit.
Would you like to continue? [y/n]
y

// Old
Please choose an amount of ETH to deposit:
1: 8 ETH
1

Copy link
Contributor

@jshufro jshufro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allow percents but make the user pass -a 5% instead of -a 5, otherwise it's a POLA violation when someone passes -a 5 and it stakes 5% instead of 5 RPL

@thomaspanf
Copy link
Member Author

Allow percents but make the user pass -a 5% instead of -a 5, otherwise it's a POLA violation when someone passes -a 5 and it stakes 5% instead of 5 RPL

TIL what a POLA violation is. Nice catch, thank you Patches!

Comment on lines +343 to +345
c.String("amount") != "5%" &&
c.String("amount") != "10%" &&
c.String("amount") != "15%" &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we drop the magic values and just use strings.EndsWith(c.String("amount"), "%") to determine if a percentage was passed? Then parse it and the actual amount.

fivePercentBorrowedRplStake.Div(fivePercentBorrowedRplStake, rplPrice)
fivePercentBorrowedRplStake.Add(fivePercentBorrowedRplStake, big.NewInt(1))
response.FivePercentBorrowedRplStake = fivePercentBorrowedRplStake
response.TenPercentBorrowedRplStake = new(big.Int).Mul(fivePercentBorrowedRplStake, big.NewInt(2))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just return the price and borrowed amount, and make the CLI calculate the percent of borrowed. This is an example of what I mean when I say the API over-fits the cli.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants