revoxhere / duino-coin

ᕲ Duino-Coin is a coin that can be mined with almost everything, including Arduino boards.
https://duinocoin.com
MIT License
1.06k stars 513 forks source link

There is issue on website with the duco calculator #1755

Closed AndrexYT closed 1 month ago

AndrexYT commented 5 months ago

Describe the bug When you select there PC Miner and then type anything, it gives erroe basereward is not definied.

To Reproduce Steps to reproduce the behavior: image

Expected behavior it should write amount that will be mined in day

System (please complete the following information):

Additional context I fixed the code by myself:

// ------ 2021 estimated earnings from various devices ------ //

let multiplier = document.getElementById('multiplier');
let inputHashrate = document.getElementById('input-hashrate');

multiplier.addEventListener('input', updateValueDevices);
inputHashrate.addEventListener('input', updateValueDevices);

function floatmap(x, in_min, in_max, out_min, out_max) {
    return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min
}

let device = document.getElementById('device-type');
let input_devices = document.getElementById('input-devices');

device.addEventListener('input', updateValueDevices);
input_devices.addEventListener('input', updateValueDevices);

let basereward;

function updateValueDevices(e) {
    /* https://github.com/revoxhere/duino-coin#some-of-the-officially-tested-devices-duco-s1 */

    let result = 0;
    let hashrate = inputHashrate.value * parseInt(multiplier.value); //* multiplier.value;

    if (hashrate <= 0 || input_devices.value <= 0 || input_devices.value > 125 || hashrate > 50000) {
        update_element("values", "Error");
        return;
    }

    if (device.value === 'PC') {
        $(".device_selector").fadeOut('fast', function() {
            $(".hashrate_selector").fadeIn('fast');
        });

        //result = (0.000363636 * hashrate) + 1.54545 // 2021
        result = (0.0013 * hashrate) + 2.2 // 2023?
        result = result * input_devices

        // extreme diff tier, TODO (2021)
        if (hashrate > 8000) {
            result = floatmap(result, 14.2, 100, 12.2, 30); 
        }
    } else {
        $(".hashrate_selector").fadeOut('fast', function() {
            $(".device_selector").fadeIn('fast');
        });

        if (device.value === 'AVR') basereward = 8
        if (device.value === 'ESP8266') basereward = 4
        if (device.value === 'ESP32') basereward = 6

        // kolka efficiency drop
        for (i = 0; i < input_devices.value; i++) {
            result += basereward;
            basereward *= 0.94;
        }
    }
    update_element("values", round_to(2, result) + " ᕲ/day");
}

Also can you unban me from discord server? I was making roblox game about duinocoin and revox banned me, username: andrexyoutube

revoxhere commented 1 month ago

Hello, thanks for your contribution. Please submit a pull request instead of the code block.