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

Unstaked EOS become unavailable when unstaking OTHER EOS #79

Open
dscotese opened this issue Mar 16, 2019 · 1 comment
Open

Unstaked EOS become unavailable when unstaking OTHER EOS #79

dscotese opened this issue Mar 16, 2019 · 1 comment
Assignees
Labels
bug Something isn't working enhancement New feature or request
Milestone

Comments

@dscotese
Copy link

I unstaked 220 EOS a few months ago. Today, I was going to unstake some more and spend some of the 220. I have already signed and broadcast the transaction to unstake what I wanted to unstake, and now EOSimple claims that the 220 I had unstaked a long time ago is still locked up.

I don't think this is by design. I think it's a coding error. Unstaked EOS should remain unstaked and available to be used regardless of what the owner does with staked EOS.

Now I have to wait three days to use the EOS that I unstaked a few months ago. :-(

@dscotese
Copy link
Author

Now that I understand what happened, here is a solution I think would work, in pseudo-code:

//Unstaking = amount of EOS user wants to unstake, if they are unstaking.
//UserPref = user-specified ratio of CPU:NET (ideal is 75:25, default was 50:50)
if( Unstaking ) {
    // If UserPref is 50/50, ignore it.
    if( UserPref = 1 ) UserPref = 3;
    // Aim for UserPref
    TotalStake = CPUStake+NETStake;
    NewTotalStake = TotalStake - Unstaking;
    targCPUStake = (UserPref * NewTotalStake) / (UserPref + 1);
    targNETState = NewTotalStake - targCPUStake;
    UnDelCPU = CPUStake - targCPUStake;
    UnDelNET = NETStake - targNETStake;
    // If we can't hit the target, offer options.
    if( CPUStake < targCPUStake || NETStake < targNETStake ) {
        if(Holdings > TotalStaked) { // Offer the user the option to stake unstaked EOS.
            // The existing code does this after displaying a message, so
            // I'm not going to recalculate everything, but I propose that after
            // it determines the new values, (UnDelNET and UnDelCPU), it offer
            // that option plus the following:
            if( UnDelCPU >= UnStaking ) {
                OnlyUnstake = "you will just unstake "+UnStaking+" EOS which are currently delegated/
                    to CPU usage."
            } elseif( UnDelNET >= UnStaking ) {
                OnlyUnstake = "you will just unstake "+UnStaking+" EOS which are currently delegated/
                    to NET usage."
            } else { // Unstake using the larger one first and the leftover from the other one.
                udLarger = (UnDelNET > UnDelCPU ? UnDelNET : UnDelCPU);
                udSmaller = UnStaking - udLarger;
                lgType = (udLarger==UnDelNET ? "NET" : "CPU");
                smType = (udLarger==UnDelNET ? "CPU" : "NET");
                OnlyUnstake = "you will lower your "+lgType+" delegation by "+udLarger+" EOS and/
                    your "+smType+" delegation by "+udSmaller+" EOS.";
            offerToStake = "When you unstake these coins, you can use coins you've already unstaked/
                to approach the ideal ratio of CPU stake to NET stake (75:25).  This will relock those coins/
                for three days.  If you choose not to do this, "+OnlyUnstake;

@igorls igorls added bug Something isn't working enhancement New feature or request labels Mar 16, 2019
@igorls igorls added this to the 0.7.3 milestone Mar 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants