// Solidity 0.5.17
// function getHashrate(uint256 staticHashrate,uint m) private  pure returns (uint256 hashrate) {
//         if(m==0){
//             hashrate = staticHashrate.mul(18).div(100);
//         }else if(m==1){
//             hashrate = staticHashrate.mul(16).div(100);
//         }else if(m==2){
//             hashrate = staticHashrate.mul(14).div(100);
//         }else if(m==3){
//             hashrate = staticHashrate.mul(12).div(100);
//         }else if(m==4){
//             hashrate = staticHashrate.mul(10).div(100);
//         }else if(4<m&&m<=8){
//             hashrate = staticHashrate.mul(5).div(100);
//         }else if(8<m&&m<=12){
//             hashrate = staticHashrate.mul(2).div(100);
//         }
//     return hashrate;
// }
// function calcDynamicHashrate(uint256 staticHashrate,address user) private  returns (bool) {
//     address[] memory arr = new address[](13);
//     uint  i = 0;
//     while(_referees[user]!=address(0)&&i<13){
//             arr[i]=_referees[user];
//             user = _referees[user];
//             i++;
//     }
//     uint  m = 0;
//     uint256 totalHtate;
//     while(arr[m]!=address(0)&&m<13){
//         if(userOrders(arr[m])>0){
//             uint256 hrate = getHashrate(staticHashrate,m);
//              _dynamic_hashrate[arr[m]]=_dynamic_hashrate[arr[m]].add(hrate);
//             totalHtate = totalHtate.add(hrate);
//             address[] memory mygenerationarr=_mygeneration[arr[m]];
//             for(uint n = 0;n<mygenerationarr.length;n++){
//                 if(_vip[mygenerationarr[n]]==3){
//                     _dynamic_hashrate[mygenerationarr[n]]=_dynamic_hashrate[mygenerationarr[n]].add(hrate.mul(5).div(100));
//                     totalHtate = totalHtate.add(hrate.mul(5).div(100));
//                 }else  if(_vip[mygenerationarr[n]]==4){
//                     _dynamic_hashrate[mygenerationarr[n]]=_dynamic_hashrate[mygenerationarr[n]].add(hrate.mul(6).div(100));
//                     totalHtate = totalHtate.add(hrate.mul(6).div(100));
//                 }else  if(_vip[mygenerationarr[n]]==5){
//                     _dynamic_hashrate[mygenerationarr[n]]=_dynamic_hashrate[mygenerationarr[n]].add(hrate.mul(7).div(100));
//                     totalHtate = totalHtate.add(hrate.mul(7).div(100));
//                 }else  if(_vip[mygenerationarr[n]]==6){
//                     _dynamic_hashrate[mygenerationarr[n]]=_dynamic_hashrate[mygenerationarr[n]].add(hrate.mul(8).div(100));
//                     totalHtate = totalHtate.add(hrate.mul(8).div(100));
//                 }
//             }
//         }
//         m++;
//     }
//     _total_dynamic_hashrate= _total_dynamic_hashrate.add(totalHtate);
//     return true; 
// }
function levelCostU(uint256 value,uint256 vip) public pure returns(uint256 u) {
        require(value<=6&&value>vip, "levelCostU: vip false");
            if(value==1){
                u=100;
            }else if(value==2){
                if(vip==0){
                    u=300;
                }else{
                    u=200;
                }
            }else if(value==3){
                if(vip==0){
                    u=500;
                }else if(vip==1){
                    u=400;
                }else{
                    u=200;
                }
            }else if(value==4){
                if(vip==0){
                    u=700;
                }else if(vip==1){
                    u=600;
                }else if(vip==2){
                    u=400;
                }else{
                    u=200;
                }
            }else if(value==5){
                if(vip==0){
                    u=1000;
                }else if(vip==1){
                    u=900;
                }else if(vip==2){
                    u=700;
                }else if(vip==3){
                    u=500;
                }else{
                    u=300;
                }
            }else{
                if(vip==0){
                    u=1500;
                }else if(vip==1){
                    u=1400;
                }else if(vip==2){
                    u=1200;
                }else if(vip==3){
                    u=1000;
                }else if(vip==4){
                    u=800;
                }else{
                     u=500;
                }
            }
    }