function upgrade(uint value) public {
    UpgradeState state = getUpgradeState();
    
    require(state == UpgradeState.ReadyToUpgrade || state == UpgradeState.Upgrading);

    
    require(value != 0);

    
    upgradeAgent.upgradeFrom(msg.sender, value);
    
    
    burnTokens(msg.sender, value);
    totalUpgraded = totalUpgraded.add(value);

    emit Upgrade(msg.sender, upgradeAgent, value);
  }