glob["debug"] = 1; glob["btn_action"] = new Array(); glob["nick"] = new Array(); glob["balance"] = new Array(); glob["modal_hartbeat"] = 0; glob["page_hartbeat"] = 0; glob["page_hartbeat_china"] = 0; glob["access_balance"] = new Array(); glob["tarif_addr_list"] = new Array(); glob["tarif_addr_list2"] = new Array(); glob["tarif_addr_list2"]["matic"] = new Array(); glob["tarif_addr_list2"]["bsc"] = new Array(); glob["tarif_addr_list2"]["eth"] = new Array(); glob["until_12_2"] = 1727740800; glob["circle_net"] = "matic"; glob["circle_net"] = "eth"; glob["gov_net"] = "matic"; glob["governance"] = new Array(); glob["factory3_net"] = "eth"; glob["ah_ref_addr"] = glob["default_wallet"]; var chainId = 0; var signer2; var provider; var ethereumClient; var WagmiCore; glob["api-dap"] = "https://api-dap.airdrop-hunter.site/"; const NETWORK_PARAMS = { "0x38": { chainId: "0x38", chainName: "BNB Smart Chain Mainnet", rpcUrls: ['https://bsc.publicnode.com'], nativeCurrency: {name: 'BNB', symbol: 'BNB', decimals: 18}, }, "0x89": { chainId: "0x89", chainName: "Polygon Mainnet", rpcUrls: ['https://polygon-rpc.com'], nativeCurrency: {name: 'MATIC', symbol: 'MATIC', decimals: 18}, }, "0xa4b1": { chainId: "0xa4b1", chainName: "Arbitrum One", rpcUrls: ['https://arbitrum-one.publicnode.com'], nativeCurrency: {name: 'ETH', symbol: 'ETH', decimals: 18}, }, "0xa4ba": { chainId: "0xa4ba", chainName: "Arbitrum Nova", rpcUrls: ['https://arbitrum-nova.publicnode.com'], nativeCurrency: {name: 'ETH', symbol: 'ETH', decimals: 18}, }, "0xa86a": { chainId: "0xa86a", chainName: "Avalanche C-Chain", rpcUrls: ['https://avalanche-c-chain.publicnode.com'], nativeCurrency: {name: 'AVAX', symbol: 'AVAX', decimals: 18}, }, "0xa": { chainId: "0xa", chainName: "OP Mainnet", rpcUrls: ['https://optimism.publicnode.com'], nativeCurrency: {name: 'ETH', symbol: 'ETH', decimals: 18}, }, "0x44d": { chainId: "0x44d", chainName: "Polygon zkEVM", rpcUrls: ['https://zkevm-rpc.com'], nativeCurrency: {name: 'ETH', symbol: 'ETH', decimals: 18}, }, "0x144": { chainId: "0x144", chainName: "zkSync Era Mainnet", rpcUrls: ['https://mainnet.era.zksync.io'], nativeCurrency: {name: 'ETH', symbol: 'ETH', decimals: 18}, }, }; function loader_hide() { var x = document.getElementById("ah_loader"); if(x !== null) { x.remove(); } } setTimeout(loader_hide,3000); glob["retweet_id"] = ""; function is_mobile_device() { const userAgent = navigator.userAgent || navigator.vendor || window.opera; return /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent.toLowerCase()); } function log(txt) { if(glob["debug"] || glob["prod"]) { } } var selectedAccount = ""; var web3modal; async function set_web3modal(v) { web3modal = v; } function init() { console.log("init"); } async function fetchAccountData(prov) { console.log("fetchAccountData"); switch(prov) { case "metamask": break; } } async function refreshAccountData() { console.log("refreshAccountData"); } async function onConnect(onload=false) { var prov_last = localStorage.getItem("web3_prov"); var last = get_cookie("selectedAccount"); log("onConnect"); if(selectedAccount !== "" && selectedAccount !== undefined) { log("BBBBBBBBBBBBBBBB "+selectedAccount); auth_on_off(1); } else { log("Cached address: "+last); if(last != "") { log("PROV: "+prov_last); switch(prov_last) { case "metamask": connectMetaMask(); break; case "okx": connectOkxWallet(); break; case "c98": connectCoin98Wallet(); break; case "trustwallet": connectTrustWallet(); break; case "wallet_connect_v2": if (!onload) { localStorage.removeItem("wc@2:core:0.3//messages"); localStorage.removeItem("wc@2:core:0.3//history"); web3modal.openModal(); } break; default: open_modal_connect(); } } else log("last selectedAccount has value: "+last); auth_on_off(0); } } async function onDisconnect() { console.log("onDisconnect"); selectedAccount = ""; set_cookie("selectedAccount",""); localStorage.setItem("web3_prov",""); auth_on_off(0); glob["onConnected"] = 0; await WagmiCore.disconnect(); set_get100_claimed(); change_styles_for_wrapper(); return false; } async function change_chain(c) { log("change_chain"); var v = 0; var name = ""; var logo_name = ""; switch(c) { case "bsc": v = "0x38"; name = "BSC"; logo_name = "bsc.svg"; break; case "eth": v = "0x1"; name = "Ethereum Mainnet"; logo_name = "eth.svg"; break; case "matic": v = "0x89"; name = "Polygon Mainnet"; logo_name = "polygon.svg"; break; case "fork": v = "0x7A69"; name = "Custom Fork"; logo_name = "eth.svg"; break; case "mumbai": v = "0x13881"; name = "Polygon Mumbai"; logo_name = "polygon.svg"; break; case "goerli": v = "0x5"; name = "Ethereum Goerli"; logo_name = "goerli.svg"; break; case "arbitrum": v = "0xa4b1"; name = "Arbitrum"; logo_name = "arbitrum-logo.svg"; break; case "arbitrum_nova": v = "0xa4ba"; name = "Arbitrum Nova"; logo_name = "arbitrum-nova-logo.png"; break; case "avalanche": v = "0xa86a"; name = "Avalanche"; logo_name = "avax.svg"; break; case "optimism": v = "0xa"; name = "Optimism Mainnet"; logo_name = "optimism.svg"; break; case "polygon_zkevm": v = "0x44d"; name = "Polygon zkEVM"; logo_name = "polygon-zkevm-logo.png"; break; case "zksync": v = "0x144"; name = "zkSync Era Mainnet"; logo_name = "zksync_arrow3.png"; break; } var prov_now = get_web3_prov(); var prov_type1 = prov_type(prov_now); switch(prov_type1) { case "wc": web3modal.openModal({route: 'SelectNetwork'}); break; default: try { await ethereum.request({ method: 'wallet_switchEthereumChain', params: [{ chainId: v }], }); } catch (error) { if (error.code == 4902 || error.code == -32603) { await ethereum.request({ method: 'wallet_addEthereumChain', params: [NETWORK_PARAMS[v]], }); } } } return false; } var web3mas = new Array(); web3mas["matic"] = new Web3("https://rpc.airdrop-hunter.site/polygon"); web3mas["bsc"] = new Web3("https://rpc.airdrop-hunter.site/bsc"); web3mas["eth"] = new Web3("https://rpc.airdrop-hunter.site/eth"); web3mas["fork"] = new Web3("https://rpc.airdrop-hunter.site/fork"); web3mas["mumbai"] = new Web3("https://rpc.airdrop-hunter.site/mumbai"); function explorer_url(name) { var explorer = ''; switch(name) { case "eth": explorer = 'https://etherscan.io/'; break; case "bsc": explorer = 'https://bscscan.com/'; break; case "matic": explorer = 'https://polygonscan.com/'; break; case "mumbai": explorer = 'https://mumbai.polygonscan.com/'; break; default: explorer = 'https://polygonscan.com/tx/'; } return explorer; } glob["screenshot"] = ""; function screenshots() { const screenshotTarget = document.body; var a = html2canvas(screenshotTarget); console.log(a); } function pushScreenshotToServer(dataURL) { $.ajax({ url: glob["api-dap"]+"support/", type: "POST", data: { image: dataURL }, dataType: "html", success: function() { console.log('Screenshot pushed to server.'); } }); } hotkeys('alt+s', function(event, handler) { console.log("ALT + s pressed"); support_click(); }); hotkeys('alt+r', function(event, handler) { console.log("ALT + r pressed"); location.href = "/"; }); function connect_wal() { console.log("connect_wal clicked"); onConnect(); return false; } async function sign_msg() { const exampleMessage = 'Example `personal_sign` message.'; try { const from = selectedAccount; const msg = " "+from; const sign = await ethereum.request({ method: 'personal_sign', params: [msg, from, 'Example password'], }); console.log(sign); console.log("'"+msg+"'"); } catch (err) { console.error(err); } } function auth_on_off(on) { var i; var x = document.getElementsByClassName("auth_off"); l = x.length; if(l>0) for(i=0;i0) for(i=0;i { if (xhr.status !== 200) { return; } eval(func); }; xhr.send(); } function wallet_id_set(wal) { var x = ''; var y = ''; var l = 0; var w = wal_3dot(wal); log("WALLET_id_SET: '"+w+"'"); x = document.getElementsByClassName('wallet-id'); l = x.length; for(i = 0;i 2) { t = wal.substring(0,5); t += '...'; t += wal.substring(38); } return t; } function ajax_get_data(requestURL,func) { const xhr = new XMLHttpRequest(); xhr.open('GET', requestURL); xhr.onload = () => { if (xhr.status !== 200) { return; }; eval(func); }; xhr.send(); } function ajax_post_data(requestURL,params,func) { const xhr = new XMLHttpRequest(); xhr.open('POST', requestURL); xhr.onload = () => { if (xhr.status !== 200) { return; }; eval(func); }; xhr.send(params); } function ajax_post_json(requestURL,params,func) { const xhr = new XMLHttpRequest(); xhr.open('POST', requestURL); xhr.setRequestHeader('Content-Type', 'application/json'); xhr.onload = () => { if (xhr.status !== 200) { return; }; eval(func); }; xhr.send(params); } function getCurrentTimestamp() { return Date.now() } function utime_to_localtime(t) { t *= 1000; dateObject = new Date(t); humanDateFormat = dateObject.toLocaleString(); return humanDateFormat; } setInterval(get_version,10000); function get_version() { getData("/version/","check_version(xhr.response)"); } function check_version(data) { if(data != glob["site_version"]) { console.log("Reload page. Version "+data); window.location.reload(); } } setInterval(get_update_time,60000); function get_update_time() { getData("/update_time/","check_update_time(xhr.response)"); } function check_update_time(data) { if(data != glob["update_time"]) { console.log("Reload page. update_time "+data); window.location.reload(); } } function get_function_name(ownName) { ownName = ownName.substr('function '.length); ownName = ownName.substr(0, ownName.indexOf('(')); return ownName; } function getPopoverSettingsVr(connectedWallet, screenWidth) { const otherSteps = [ { element: "#Scroll_panel", popover: { title: "Airdrop Activity Card", description: "Grab your Airdrop Activity Card to join in on airdrop fun.", side: "top", align: "end" } }, { element: "#Scroll_panel .grid-item__titletxtwrapper", popover: { title: "Project Information", description: "Dive into the project details. Everything you need to know is right here." } }, { element: "#Scroll_panel .profit", popover: { title: "Potential Reward", description: "See the potential reward AI has calculated for you!" } }, { element: "#Scroll_panel #tarifcostpanel", popover: { title: "Wallets", description: "Check out the wallets! Pick from the list and start hunting!" } }, { element: "#Scroll_panel .grid-item__button", popover: { title: "Purchase", description: "Wrap up your purchase and top off your liquidity to keep going." } }, { popover: { description: "
All set! For now, you're good to go.
" } } ]; if (connectedWallet !== undefined) { const settings = [{ element: screenWidth >= 767 ? "#deposit-big" : "#deposit-small", popover: { title: "Make a Deposit", description: "Make your deposit to jump into the action. Please note: Deposits made on the platform are non-refundable.", side: "bottom", align: "center" } }]; settings.push(...otherSteps); return settings; } else { const settings = [{ element: screenWidth >= 575 ? "#connect-wallet-big" : "#connect-wallet-small", popover: { title: "Connect Your Wallet", description: "Connect your MetaMask wallet to get things rolling." } },{ element: "#href_ref", popover: { title: "Get $100 to Your Deposit for Free", description: "Snag a quick $100! Just complete a task, and it's yours to use on the platform.", side: "bottom", align: "center" } }]; settings.push(...otherSteps); return settings; } } function driveInstructionTourVr() { const screenWidth = window.screen.width; const connectedWallet = get_cookie("selectedAccount"); const settings = getPopoverSettingsVr(connectedWallet, screenWidth); const driver = window.driver.js.driver; const driverObj = driver({ showProgress: true, onHighlighted: (element) => { if (element?.id === 'Scroll_panel') { window.scrollTo({top: screenWidth < 567 ? 650 : 500, behavior: 'smooth'}); } }, steps: settings }); driverObj.drive(); } function getPopoverSettings(connected_wallet, screen_width, card_id) { const other_steps = [ { element: `#${card_id}`, popover: { title: "Airdrop Activity Card", description: "Grab your Airdrop Activity Card to join in on airdrop fun.", side: "top", align: "end" } }, { element: `#${card_id} .grid-item__titletxtwrapper`, popover: { title: "Project Information", description: "Dive into the project details. Everything you need to know is right here." } }, { element: `#${card_id} .profit`, popover: { title: "Potential Reward", description: "See the potential reward AI has calculated for you!" } }, { element: `#${card_id} #tarifcostpanel`, popover: { title: "Wallets", description: "Check out the wallets! Pick from the list and start hunting!" } }, { element: `#${card_id} .grid-item__button`, popover: { title: "Purchase", description: "Wrap up your purchase and top off your liquidity to keep going." } }, { popover: { description: "
All set! For now, you're good to go.
Don't forget to peek at the tutorial for more insights
" } } ]; if (connected_wallet !== undefined) { const settings = [{ element: screen_width >= 767 ? "#deposit-big" : "#deposit-small", popover: { title: "Make a Deposit", description: "Make your deposit to jump into the action. Please note: Deposits made on the platform are non-refundable.", side: "bottom", align: "center" } }]; settings.push(...other_steps); return settings; } else { const settings = [{ element: screen_width >= 575 ? "#connect-wallet-big" : "#connect-wallet-small", popover: { title: "Connect Your Wallet", description: "Connect your MetaMask wallet to get things rolling." } },{ element: "#href_ref", popover: { title: "Get $100 to Your Deposit for Free", description: "Snag a quick $100! Just complete a task, and it's yours to use on the platform.", side: "bottom", align: "center" } }]; settings.push(...other_steps); return settings; } } function driveInstructionTour() { const card_id = "Scroll_panel"; const screen_width = window.screen.width; const connected_wallet = get_cookie("selectedAccount"); const settings = getPopoverSettings(connected_wallet, screen_width, card_id); const card = document.querySelector(`#${card_id}`); const card_coordinates = card.getBoundingClientRect(); const card_position = card_coordinates.bottom; const driver = window.driver.js.driver; const driver_obj = driver({ showProgress: true, onHighlighted: (element) => { if (element?.id === card_id) { window.scrollTo({ top: screen_width < 567 ? card_position > 1050 ? card_position - 1050 : card_position - card_position + 1900 : card_position > 1200 ? card_position - 1200 : card_position - card_position + 2050, behavior: "smooth" }); } }, steps: settings }); driver_obj.drive(); } const cookieModal = document.querySelector('.cookie-modal'); function set_cookie(name, value) { document.cookie = `${name}=${value}`; } function getCookie(name) { const cookies = document.cookie.split(';'); for (let cookie of cookies) { const [cookieName, cookieValue] = cookie.trim().split('='); if (cookieName === name) { return cookieValue; } } return; } function showCookieModal() { cookieModal.style.opacity = '1'; cookieModal.style.visibility = 'visible'; } function closeCookieModal() { cookieModal.style.opacity = '0'; cookieModal.style.visibility = 'hidden'; } function agreeCookieModal(event) { set_cookie("cookie_agree", "1"); const params = { "x": event.clientX, "y": event.clientY, "value": 1, }; ajax_post_data(glob['domen'] + 'api/cookies/', JSON.stringify(params), ""); closeCookieModal(); } function declineCookieModal(event) { set_cookie("cookie_agree", "0"); const params = { "x": event.clientX, "y": event.clientY, "value": 0, }; ajax_post_data(glob['domen'] + 'api/cookies/', JSON.stringify(params), ""); closeCookieModal(); } const cookie_agree = getCookie("cookie_agree"); if (!cookie_agree) { setTimeout(() => { showCookieModal(); }, 3000); } function change_active_chain_tabs(net) { var chainName = net; var clickedChain = net; var i; var l; const chains = document.querySelectorAll('.nav-pills .nav-link'); const tabs = document.querySelectorAll('.tabs .tab'); console.log("clickedChain: "+clickedChain); event.preventDefault(); for (i = 0; i < chains.length; i++) { if(chains[i].classList.contains('active')) { chains[i].classList.remove('active'); } } l = tabs.length; for (i = 0; i < l; i++) { if(tabs[i].classList.contains('active')) { tabs[i].classList.remove('active'); } } for (i = 0; i < l; i++) { console.log("Class: "+tabs[i].className); if (tabs[i].classList.contains(net)) { tabs[i].classList.add('active'); console.log("!!!!!! "+net+" "+tabs[i].className); } } x = document.getElementById("nav-link-depo-"+net); x.classList.add('active'); } function copy_address (event) { let target = event.target.closest('.address-copy'); if (!target) return; let textAddress = target.parentElement.querySelector('button').getAttribute('data-address'); navigator.clipboard.writeText(textAddress); target.parentElement.classList.add('copied'); setTimeout(function() { target.parentElement.classList.remove('copied'); }, 2000); return false; }; function toggle_info_get100 () { const infoModal = document.querySelector(".get100__info-modal"); infoModal.classList.toggle("info__open"); } function toggle_notification_panel(event) { const buttons = document.querySelectorAll('.notification__branch'); const wrappers = document.querySelectorAll('.notification__wrapper'); const tabNumber = event.target.classList[0]; for (let i = 0; i < buttons.length; i++) { if(buttons[i].classList.contains('notification__branch-active')) { buttons[i].classList.remove('notification__branch-active'); } } for (let i = 0; i < wrappers.length; i++) { if(wrappers[i].classList.contains('notification__wrapper-active')) { wrappers[i].classList.remove('notification__wrapper-active'); } } for (let i = 0; i < wrappers.length; i++) { if (wrappers[i].classList.contains(tabNumber)) { wrappers[i].classList.add('notification__wrapper-active'); } } show_zero_notifications(tabNumber, wrappers); event.target.classList.add('notification__branch-active'); } function show_zero_notifications(tabNumber, wrappers) { if (tabNumber === 'notification__tab-1') { const descElements = document.querySelectorAll('.notification__desc-all'); const allHiddenElements = Array.from(descElements).every(element => element.style.display === 'none'); const emptyElement = document.querySelector('.notification__empty'); if (allHiddenElements) { emptyElement.style.display = 'flex'; } else { for (let i = 0; i < wrappers.length; i++) { if (wrappers[i].classList.contains(tabNumber)) { wrappers[i].classList.add('notification__wrapper-active'); } } emptyElement.style.display = 'none'; } } if (tabNumber === 'notification__tab-2') { const descElements = document.querySelectorAll('.notification__desc-news'); const allHiddenElements = Array.from(descElements).every(element => element.style.display === 'none'); const emptyElement = document.querySelector('.notification__empty'); if (allHiddenElements) { emptyElement.style.display = 'flex'; } else { for (let i = 0; i < wrappers.length; i++) { if (wrappers[i].classList.contains(tabNumber)) { wrappers[i].classList.add('notification__wrapper-active'); } } emptyElement.style.display = 'none'; } } if (tabNumber === 'notification__tab-3') { const descElements = document.querySelectorAll('.notification__desc-liquidity'); const allHiddenElements = Array.from(descElements).every(element => element.style.display === 'none'); const emptyElement = document.querySelector('.notification__empty'); if (allHiddenElements) { emptyElement.style.display = 'flex'; } else { for (let i = 0; i < wrappers.length; i++) { if (wrappers[i].classList.contains(tabNumber)) { wrappers[i].classList.add('notification__wrapper-active'); } } emptyElement.style.display = 'none'; } } } function brighten_card(link) { const headerHeight = document.querySelector('header').offsetHeight; const item = $(link).children('.item'); $('html, body').animate({ scrollTop: $(link).offset().top - headerHeight - 100 }); item.css({ boxShadow: "0px 0px 0px 2px var(--gradient, #FA0CFF)", }); setTimeout(function(){ item.css({ boxShadow: "none", }); item.removeAttr("style"); }, 2000); } function change_styles_for_wrapper() { const wrapper = document.querySelector('.top-header-wrapper'); const connected = get_cookie('selectedAccount') ? 1 : 0; if (!connected) { wrapper.classList.add('disconnected'); } else { wrapper.classList.remove('disconnected'); } } change_styles_for_wrapper(); function change_styles_for_wrapper2() { const wrapper = document.querySelector('.top-header-wrapper'); wrapper.classList.remove('disconnected'); } let readMore = document.querySelector('#readmore_modal'); let wrapper = document.querySelector('#readmore_modal .news_modal_body'); $('#readmore_modal').on('show.bs.modal', function (event) { let button = event.relatedTarget; let image = button.nextSibling.nextSibling.innerHTML; let title = button.nextSibling.nextSibling.nextSibling.nextSibling.innerHTML; let text = button.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.innerHTML; let warning = button.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.innerHTML; readMore.querySelector('.modal-header__image').setAttribute("src", `/images/${image}`); readMore.querySelector('.news_title').innerHTML = title; readMore.querySelector('.news_text').innerHTML = text; if (warning !== '') { const warningWrapper = document.createElement('p'); warningWrapper.classList.add('popup__desc--warning'); warningWrapper.innerHTML = warning; wrapper.appendChild(warningWrapper); } }); $('#readmore_modal').on('hidden.bs.modal', function () { readMore.querySelector('.modal-header__image').setAttribute("src", ''); readMore.querySelector('.news_title').innerHTML = ''; readMore.querySelector('.news_text').innerHTML = ''; if (document.querySelector('#readmore_modal .popup__desc--warning')) { const warningParent = document.querySelector('#readmore_modal .news_modal_body'); const child = document.querySelector('#readmore_modal .popup__desc--warning'); warningParent.removeChild(child); } }); function change_theme_for_ahbot() { if (document.querySelector("#ahbot__background")) { const ahbot_container = document.querySelector("#ahbot__background"); const ahbot_logo_img = document.querySelector("#ahbot__title__img"); const dark_theme = get_cookie("theme"); if (dark_theme === "dark") { ahbot_container.setAttribute("src", "/images/ahbot_dark_background-img.png"); ahbot_logo_img.setAttribute("src", "/images/ahbot_dark_logo.png"); } else { ahbot_container.setAttribute("src", "/images/ahbot_background-img.png"); ahbot_logo_img.setAttribute("src", "/images/ahbot_logo.png"); } } } function change_theme_for_aicard() { if (document.querySelector("#aicard__background")) { const dark_theme = get_cookie("theme"); const aicard__background = document.querySelector("#aicard__background"); const src = aicard__background.getAttribute("src"); const pathParts = src.split("/"); if (dark_theme === "dark") { pathParts[pathParts.length - 1] = "aicard_background_dark1.png"; } else { pathParts[pathParts.length - 1] = "aicard_background.png"; } const newSrc = pathParts.join("/"); aicard__background.setAttribute("src", newSrc); } } function theme_switcher() { const theme_switcher = document.querySelector(".theme_switcher"); const dark_theme = get_cookie("theme"); if(theme_switcher) { if (dark_theme === "dark") { theme_switcher.checked = true; } else { theme_switcher.checked = false; } } } function change_theme() { var on; var x = document.getElementById('body'); var y = ""; y = x.className; var z = ""; if(y=="dark-theme") {on=0;z = "";} else {on=1;z = "dark-theme";} x.className = z; localStorage.setItem('theme', z); if(on) document.cookie = "theme=dark"; else document.cookie = "theme="; change_theme_for_ahbot(); change_theme_for_aicard(); theme_switcher(); return false; } function set_theme() { var x = document.getElementById('body'); var y = ""; y = localStorage.getItem('theme'); x.className = y; x = document.getElementById('theme'); if(y=="") x.checked = false; else x.checked = true; } change_theme_for_ahbot(); change_theme_for_aicard(); theme_switcher(); function check_grass_accounts(amount) { const boughtAccounts = document.querySelector('#grass__bought__acccounts'); boughtAccounts.innerHTML = amount; if (amount >= 800) { const separator = document.querySelector('#grass__separator'); const totalAcconts = document.querySelector('#grass__limit__accounts'); const soldOut = document.querySelector('#grass__sold-out'); const currentButtonWrapper = document.querySelector('#grass_panel .grid-item__button'); const currentButton = document.querySelector('#grass_panel .btn-primary'); const newButton = document.createElement('a'); newButton.setAttribute('class', 'art-button-2 btn btn-primary'); newButton.innerHTML = 'SOLD OUT'; boughtAccounts.style.display = 'none'; separator.style.display = 'none'; totalAcconts.style.display = 'none'; soldOut.style.display = 'block'; currentButtonWrapper.removeChild(currentButton); currentButtonWrapper.appendChild(newButton) } } function remove_all_elements_from_tab(event) { const replenishTab = document.querySelector('#details-replenish__container'); const oridinaryTab = document.querySelector('#details-ordinary__container'); const elementClass = event.target.classList[0]; if (elementClass !== 'replenish') { replenishTab.style.display = 'none'; oridinaryTab.style.display = 'block'; } if (elementClass === 'replenish') { replenishTab.style.display = 'flex'; oridinaryTab.style.display = 'none'; } } function make_all_checkboxes_be_checked() { const selectAllCheckbox = document.querySelector('#deposit-modal__form__checkbox'); const checkboxes = document.querySelectorAll('.deposit-modal__form__input'); if (selectAllCheckbox.checked) { for (const checkbox of checkboxes) { checkbox.checked = true; } } else { for (const checkbox of checkboxes) { checkbox.checked = false; } } } function check_details_button_active(event) { const buttons = document.querySelectorAll('.deposit-modal__button'); const clickedButton = event.target; for (const button of buttons) { if (button.classList.contains('deposit-modal__button')) { button.classList.remove('deposit-modal__button-active'); } } clickedButton.classList.add('deposit-modal__button-active') } $('#modal_circle').on('hidden.bs.modal', function () { const replenishTab = document.querySelector('#details-replenish__container'); const oridinaryTab = document.querySelector('#details-ordinary__container'); replenishTab.style.display = 'none'; oridinaryTab.style.display = 'block'; }); function submit_support_form(event) { const form = document.getElementById("modal_support_form"); event.preventDefault(); if (form.checkValidity()) { const button = document.getElementById("modal_support_btn"); button.innerHTML = "Sending..."; button.disabled = true; setTimeout(() => { form.submit(); form.reset(); support_submit(); }, 1000); } else { form.reportValidity(); } } function driveDetailsTour() { const driver = window.driver.js.driver; const driverObj = driver({ showProgress: true, steps: [ { element: "#modal-header-wrap-details", popover: { title: "Airdrop Activity Information", description: "Get to know your airdrop: the project's name, wallets, and the details of current plan.", side: "right" } }, { element: "#status-item-points", popover: { title: "Airdrop Journey", description: "A simple guide through the important stages that lead you closer to the airdrop, highlighting each step's role in boosting your odds.", side: "right" } }, { element: ".Generated", popover: { title: "Circle Activity", description: "Check out the list of circles you need to join to qualify for an airdrop. Just click on the title to see what's needed!" } }, { element: "#status-item-wallets", popover: { title: "What's the Current Step?", description: "Detailed info on the actions happening now or what will take place after activation." } }, { element: ".round-progress", popover: { title: "Progress", description: "Your current progress in the circle, showing the stage of activity completion." } }, { element: ".circle_step_list_wrapper", popover: { title: "Circle Steps", description: "The activity steps that AH script needs to complete to be eligible for a potential airdrop." } } ] }); driverObj.drive(); } function btn_click_action(e) { var a = ""; if(glob["btn_action"][e.id] !== null) a = glob["btn_action"][e.id]; log("btn CLICK:"+e.id +' a:'+a); if(a) eval(a); return false; } function get_cookie(name) { var match = document.cookie.match(new RegExp('(^| )' + name + '=([^;]+)')); if (match) return match[2]; } function set_cookie(name,value) { var date = new Date(),expires = 'expires='; date.setTime(date.getTime() + 315360000000); expires += date.toGMTString(); document.cookie = name + '=' + value + '; ' + expires + '; path=/'; } function participateClick() { window.dataLayer = window.dataLayer || []; window.dataLayer.push({ 'event': 'dapp_aicard_participate_click' }); console.log("dapp_aicard_participate_click"); } function connectWalletClick(button) { if (button.textContent === "Connect Wallet") { window.dataLayer = window.dataLayer || []; window.dataLayer.push({ 'event': 'dapp_aicard_connectWallet_click' }); console.log("dapp_aicard_connectWallet_click"); } else { console.log("No action, button text is not 'Connect Wallet'."); } } function aicardBuyAccessClick() { window.dataLayer = window.dataLayer || []; window.dataLayer.push({ 'event': 'dapp_aicard_buyAccess_click' }); console.log("dapp_aicard_buyAccess_click"); } function cexBingxClick() { window.dataLayer = window.dataLayer || []; window.dataLayer.push({ 'event': 'cex_card_button_click', 'card': 'BingX' }); } function cexOkxClick() { window.dataLayer = window.dataLayer || []; window.dataLayer.push({ 'event': 'cex_card_button_click', 'card': 'OKX' }); } function cexMexcClick() { window.dataLayer = window.dataLayer || []; window.dataLayer.push({ 'event': 'cex_card_button_click', 'card': 'MEXC' }); } function tgAppsAHOpenLeagueClick() { window.dataLayer = window.dataLayer || []; window.dataLayer.push({ 'event': 'tgApps_card_button_click', 'card': 'AH Open League' }); } function tgAppsAHMiniAppClick() { window.dataLayer = window.dataLayer || []; window.dataLayer.push({ 'event': 'tgApps_card_button_click', 'card': 'Airdrop Hunter Mini App' }); } function tgAppsNasduckClick() { window.dataLayer = window.dataLayer || []; window.dataLayer.push({ 'event': 'tgApps_card_button_click', 'card': '$NASDUCK Mini App' }); } auth_on_off(selectedAccount ? 1 : 0); setInterval(func_page_ref_china,300); function checkButtonClaim() { const chineseButtonTarget = document.querySelector("#chinese_button"); const chineseClaimed = get_cookie("chineseClaimed"); if (chineseClaimed === undefined) { chineseButtonTarget.setAttribute("data-target", "#modal_chinese"); } else { chineseButtonTarget.setAttribute("data-target", "#modal_chinese_claim"); } } function checkModalClaim() { $('.modal_chinese_button').click(); $("#modal_chinese_success").modal("show"); } var claimNumber = get_cookie('randomChinaNumber'); if (claimNumber) { var claimSubdescElement = document.querySelector(".modal_chinese_success_text"); claimSubdescElement.innerHTML = "You've claimed $" + claimNumber + ".
Celebrate with your bonus."; } function func_page_ref_china() { glob["page_hartbeat_china"]++; if(glob["page_hartbeat_china"]==1) { console.log("Get func_page_ref_china"); } btn_ref_claim_china(); if(glob["page_hartbeat_china"] >= 18) glob["page_hartbeat_china"] = 0; } function btn_ref_claim_china() { var net = "bsc"; var x; var y; var v; switch(net) { case "fork": chain = 31337; nchain = "Fork"; break; case "matic": chain = 137; nchain = "Polygon"; break; case "bsc": chain = 56; nchain = "BSC"; break; case "eth": chain = 1; nchain = "Ethereum"; break; case "mumbai": chain = 80001; nchain = "Mumbai"; break; } var id = "ref_claim_china"; txt = "Claim"; clas = "modal_chinese_claim"; a = ""; var err = ""; if(!err) { if(!selectedAccount || !glob["onConnected"]) { a = "onConnect();"; txt = "Connect Wallet"; err = 1; } } if(!err) { if(chainId != chain) { txt = "Switch to "+nchain; a = "change_chain('"+net+"');"; err = 1; clas = "modal_chinese_claim"; } } if(!err) { err = 1; a = "web3_ref_china_claim('"+net+"');"; } x = document.getElementById(id); if(x === null) log("NULL "+id); if(x !== null) if(x.innerHTML != txt) { x.innerHTML = txt; x.className = clas; glob["btn_action"][id] = a; } } function make_chinese_modal_darker() { setTimeout(() => { if ($('#modal_auth').hasClass('show')) { $('#modal_chinese').css('opacity', '0'); } else { $('#modal_chinese').css('opacity', '1'); } }, 200) } function func_page_ogc_claim() { glob["page_hartbeat"]++; if(glob["page_hartbeat"]==1) { console.log("Get ref2"); } btn_ogc_claim(); if(glob["page_hartbeat"] >= 18) glob["page_hartbeat"] = 0; } function btn_ogc_claim() { var net = "bsc"; var x; var y; var v; switch(net) { case "fork": chain = 31337; nchain = "Fork"; break; case "matic": chain = 137; nchain = "Polygon"; break; case "bsc": chain = 56; nchain = "BSC"; break; case "eth": chain = 1; nchain = "Ethereum"; break; case "mumbai": chain = 80001; nchain = "Mumbai"; break; } var id = "ogc_claim_bonus"; txt = "Claim"; clas = ""; a = ""; var err = ""; if(!err) { if(!selectedAccount || !glob["onConnected"]) { a = "onConnect();"; txt = "Connect Wallet"; err = 1; } } if(!err) { if(chainId != chain) { txt = "Switch to "+nchain; a = "change_chain('"+net+"');"; err = 1; clas = ""; } } if(!err) { err = 1; a = "web3_ogc_claim_bonus('"+net+"');"; } x = document.getElementById(id); if(x === null) log("NULL "+id); if(x !== null) if(x.innerHTML != txt) { x.innerHTML = txt; x.className = clas; glob["btn_action"][id] = a; } } function func_page_solana_claim() { glob["page_hartbeat"]++; if(glob["page_hartbeat"]==1) { } btn_solana_claim(); if(glob["page_hartbeat"] >= 18) glob["page_hartbeat"] = 0; } function btn_solana_claim() { var net = "bsc"; var x; var y; var v; switch(net) { case "fork": chain = 31337; nchain = "Fork"; break; case "matic": chain = 137; nchain = "Polygon"; break; case "bsc": chain = 56; nchain = "BSC"; break; case "eth": chain = 1; nchain = "Ethereum"; break; case "mumbai": chain = 80001; nchain = "Mumbai"; break; } var id = "solana_claim_bonus"; txt = "Claim"; clas = "solana__button"; a = ""; var err = ""; if(!err) { if(!selectedAccount || !glob["onConnected"]) { a = "onConnect();"; txt = "Connect Wallet"; err = 1; } } if(!err) { if(chainId != chain) { txt = "Switch to "+nchain; a = "change_chain('"+net+"');"; err = 1; clas = "solana__button"; } } if(!err) { err = 1; a = "web3_solana_claim_bonus('"+net+"');"; } x = document.getElementById(id); if(x === null) log("NULL "+id); if(x !== null) if(x.innerHTML != txt) { x.innerHTML = txt; x.className = clas; glob["btn_action"][id] = a; } } function inviter_show() { var err; var t; var url; var n = get_cookie("ref_nick"); var a = get_cookie("ref_wal"); url = explorer_url("matic"); url += "address/"+a; err = 0; if(!err && a === undefined) { err = 1; t = "No inviter yet"; } if (!err) { if(n !== undefined) { t = ""+n+""; } else { t = ""+wal_3dot(a)+""; } } var x; var y; var i; var l; y = document.getElementsByClassName("inviter"); l = y.length; for(i=0;i()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/); } function validateEmail(email) { const regex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; return regex.test(email); } function open_modal_connect() { $('#buyTarifModal').modal('hide'); console.log("open_modal_connect"); $('#modal_auth').modal('show'); } function click_agree() { if ($('input.popup_checkbox_input').is(':checked')) { $('.popup_img').css({ 'display': 'block' }); $('.popup_li').css({ 'cursor': 'pointer' }); $('.popup_img_grey').css({ 'display': 'none' }); } else { $('.popup_img').css({ 'display': 'none' }); $('.popup_img_grey').css({ 'display': 'block' }); $('.popup_li').css({ 'cursor': 'not-allowed' }); } } $('.popup_checkbox').click(click_agree); click_agree(); async function connect_v2_wal(k) { var agree = document.getElementById("popup_checkbox_agree"); if (!agree.checked) { return false; } var x; var img; var m = new Array(); var txt; var title; var name; var url; var t; var close_time = 1000; glob["modal_txs_link"] = ""; const userAgent = navigator.userAgent || navigator.vendor || window.opera; switch(k) { case "okx": if (is_mobile_device()) { if (userAgent.toLowerCase().includes('okapp')) { connectOkxWallet(); sendWalletNumberForAnalytics() } else { const encodedUrl = "https://www.okx.com/download?deeplink=" + encodeURIComponent("okx://wallet/dapp/url?dappUrl=" + encodeURIComponent(location.href)); window.location.href = encodedUrl; } } else { img = "
"; m["title"] = "Connect Okx wallet"; if (!window.okxwallet) { txt = img+"
Download in the Chrome Web Store
"; url = "https://chrome.google.com/webstore/detail/okx-wallet/mcohilncbfahbmgdjkbpemcciiolgcge"; glob["modal_txs_link"] = url; m["btn"] = "Install chrome extension["+k+"]"; m["btn_enable"] = 1; } else { connectOkxWallet(); txt = img+"
Confirm connection in OKX wallet
"; m["btn"] = "See you Okx Wallet"; } modal_tx_info_open(txt,m); } $('#modal_auth').modal('hide'); setTimeout(() => { }, 2000); break; case "metamask": if (is_mobile_device()) { if (userAgent.toLowerCase().includes('metamaskmobile')) { connectMetaMask(); sendWalletNumberForAnalytics(); } else { var link = 'https://metamask.app.link/dapp/' + document.URL; window.open(link, '_self'); sendWalletNumberForAnalytics(); } } else { if (!window.ethereum) { img = "
"; m["title"] = "Connect Metamask wallet"; txt = img+"
Download in the Chrome Web Store
"; url = "https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn"; glob["modal_txs_link"] = url; m["btn"] = "Install chrome extension["+k+"]"; m["btn_enable"] = 1; modal_tx_info_open(txt, m); } else { connectMetaMask(); sendWalletNumberForAnalytics(); } } $('#modal_auth').modal('hide'); setTimeout(() => { }, 2000); break; case "coin98": img = "
"; m["title"] = "Connect C98 wallet"; if (!window.coin98) { txt = img+"
Download in the Chrome Web Store
"; url = "https://chrome.google.com/webstore/detail/coin98-wallet/aeachknmefphepccionboohckonoeemg"; glob["modal_txs_link"] = url; m["btn"] = "Install chrome extension["+k+"]"; m["btn_enable"] = 1; } else { connectCoin98Wallet(); sendWalletNumberForAnalytics(); txt = img+"
Confirm connection in C98 wallet
"; m["btn"] = "See you C98 Wallet"; } modal_tx_info_open(txt,m); $('#modal_auth').modal('hide'); setTimeout(() => { }, 2000); break; case "trustwallet": if (is_mobile_device()) { const urlParams = new URLSearchParams(window.location.search); var utm_source = urlParams.get("utm_source"); if (utm_source == "Trust_iOS_Browser") { connectTrustWallet(); sendWalletNumberForAnalytics(); } else { var link = 'trust://open_url?url=' + document.URL; window.open(link, '_self'); } } else { img = "
"; m["title"] = "Connect Trust Wallet"; if (!window.ethereum) { txt = img+"
Download in the Chrome Web Store
"; url = "https://chrome.google.com/webstore/detail/trust-wallet/egjidjbpglichdcondbcbdnbeeppgdph"; glob["modal_txs_link"] = url; m["btn"] = "Install chrome extension["+k+"]"; m["btn_enable"] = 1; } else { connectTrustWallet(); sendWalletNumberForAnalytics(); txt = img+"
Confirm connection in Trust Wallet
"; m["btn"] = "See you Trust Wallet"; } modal_tx_info_open(txt,m); } $('#modal_auth').modal('hide'); break; case "wallet_connect_v2": localStorage.removeItem("wc@2:core:0.3//messages"); localStorage.removeItem("wc@2:core:0.3//history"); web3modal.openModal(); $('#modal_auth').modal('hide'); localStorage.setItem("web3_prov", k); log("We are connected: "+k); setTimeout(() => { }, 2000); break; } } async function connectMetaMask() { if (window.ethereum) { try { const accounts = await window.ethereum.request({ method: 'eth_requestAccounts' }); set_selectedAccount(accounts[0]); localStorage.setItem("web3_prov","metamask"); provider = window.ethereum; log("signer2"); console.log(signer2); log('MetaMask connected'); modal_txs_close_timeout(); } catch (error) { if (error.code === 4001) { log('User cancel metamask connect'); } else { log('Metamask connect error:', error.message); } } } else { console.error('MetaMask extension not found'); } } async function connectOkxWallet() { if (window.okxwallet) { try { await window.okxwallet.enable(); const accounts = await window.ethereum.request({ method: 'eth_requestAccounts' }); set_selectedAccount(accounts[0]); localStorage.setItem("web3_prov","okx"); provider = window.okxwallet; log('OkxWallet connected'); modal_txs_close_timeout(); } catch (error) { if (error.code === 4001) { log('User cancel okx connect'); } else { log('Okx connect error:', error.message); } } } else { console.error('OkxWallet extension not found'); } } async function connectCoin98Wallet() { if (window.coin98) { try { const accounts = await window.ethereum.request({ method: 'eth_requestAccounts' }); set_selectedAccount(accounts[0]); localStorage.setItem("web3_prov","c98"); provider = window.ethereum; log('Coin98 connected'); modal_txs_close_timeout(); } catch (error) { if (error.code === 4001) { log('User cancel okx connect'); } else { log('Coin98 connect error:', error.message); } } } else { console.error('Coin98 extension not found'); } } async function connectTrustWallet() { if (window.ethereum) { try { const accounts = await window.ethereum.request({ method: 'eth_requestAccounts' }); set_selectedAccount(accounts[0]); localStorage.setItem("web3_prov","trustwallet"); provider = window.ethereum; log("signer2"); console.log(signer2); log('Trust Wallet connected'); modal_txs_close_timeout(); } catch (error) { if (error.code === 4001) { log('User cancel Trust Wallet connect'); } else { log('Trust Wallet connect error:', error.message); } } } else { console.error('Trust Wallet extension not found'); } } function show_prov() { var prov_now = get_web3_prov(); log("prov_now: "+prov_now); } async function check_extension_installed() { log("check_extension_installed: "+name); var k; var x; if (window.ethereum) { window.ethereum.on("accountsChanged", (accounts) => { set_selectedAccount(accounts[0]); modal_txs_close_timeout(); }); window.ethereum.on("chainChanged", (this_chainId) => { set_selected_chain_id(this_chainId); }); } else { log("Extension not installed"); } } const abi = eth_abi['ref_list']; const POLYGON_URL = web3mas["matic"]["_requestManager"]["provider"]["host"]; const BSC_URL = web3mas["bsc"]["_requestManager"]["provider"]["host"]; const POLYGON_CONTRACT = glob["contracts"]["ref_list_matic"]; const BSC_CONTRACT = glob["contracts"]["ref_list_bsc"]; const default_wallet = glob["default_wallet"]; function createContractInstance(abi, contractAddress, networkUrl) { const provider = new Web3.providers.HttpProvider(networkUrl); const web = new Web3(provider); return new web.eth.Contract(abi, contractAddress); } async function set_china_claimed(selectedAccount) { document.cookie = 'chineseClaimed' + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"; var c = glob["contracts"]["ref_claim_china_"+"bsc"]; const chinaContract = createContractInstance(eth_abi["ref_claim_china"], c, BSC_URL); let claim = await chinaContract.methods.Claimed(selectedAccount).call({ from: selectedAccount }); if (claim.status) { set_cookie("chineseClaimed", claim.status); if($('#chinese_button')) { $('#chinese_button').hide(); } } } async function set_socialfy_claimed(selectedAccount) { document.cookie = 'socialfyClaimed' + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"; var c = glob["contracts"]["ref_claim_socialfi_"+"bsc"]; const chinaContract = createContractInstance(eth_abi["ref_claim_socialfi"], c, BSC_URL); let claimed = await chinaContract.methods.ClaimedWal(selectedAccount, 1).call({ from: selectedAccount }); if (claimed.claimed) { set_cookie("socialfyClaimed", claimed.claimed); } } async function set_solana_claimed(selectedAccount) { document.cookie = 'solanaClaimed' + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"; var c = glob["contracts"]["ref_claim_socialfi_"+"bsc"]; const chinaContract = createContractInstance(eth_abi["ref_claim_socialfi"], c, BSC_URL); let claimed = await chinaContract.methods.ClaimedWal(selectedAccount, 2).call({ from: selectedAccount }); if (claimed.claimed) { set_cookie("solanaClaimed", claimed.claimed); } } async function set_get100_claimed() { let c = glob["contracts"]["ref_claim20_02_"+'bsc']; if (selectedAccount !== undefined && selectedAccount !== '') { const chinaContract = createContractInstance(eth_abi["ref_claim20_02"], c, BSC_URL); let claimed = await chinaContract.methods.CheckRef(selectedAccount).call({ from: selectedAccount }); if (claimed.status) { $('.claim-bonus-button').css('display', 'none'); set_cookie("get100Claimed", claimed.status); } } else { } } function getWalletFromRef() { const queryString = window.location.search; const regex = /[?&]0x[a-fA-F0-9]{40}(?:(?:&|%3F)[^&%3D]*)?(?:&|$)/; const match = queryString.match(regex); if (match) { return match[0].substring(1); } else { return null; } } async function checkInviter(referralAddress) { const polygonContract = createContractInstance(abi, POLYGON_CONTRACT, POLYGON_URL); const bscContract = createContractInstance(abi, BSC_CONTRACT, BSC_URL); const polygonInviter = await polygonContract.methods.RefSearch(referralAddress).call({ from: referralAddress }); const bscInviter = await bscContract.methods.RefSearch(referralAddress).call({ from: referralAddress }); let inviter = default_wallet; if (!polygonInviter.includes('0000') || !bscInviter.includes('0000')) { if (!polygonInviter.includes('0000')) { document.cookie = 'ref_wal' + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"; inviter = polygonInviter; set_cookie('ref_wal', inviter); } else if (!bscInviter.includes('0000')) { document.cookie = 'ref_wal' + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"; inviter = bscInviter; set_cookie('ref_wal', inviter); } } else { if (window.location.pathname.includes('/ref') && window.location.pathname !== '/referrals') { let walletFromRef = getWalletFromRef(); if (walletFromRef) { inviter = walletFromRef; document.cookie = 'ref_wal' + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"; set_cookie('ref_wal', inviter); } else if (get_cookie('ref_wal') === undefined) { document.cookie = 'ref_wal' + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"; set_cookie('ref_wal', default_wallet); } } } $('#polygon_inviter').text(inviter); $('#bsc_inviter').text(inviter); $('#ref_inviter_url').text(inviter); if (inviter === default_wallet) { $('#ref_inviter_url').text("/ref"); } } async function set_selectedAccount(addr,prov_name="") { var prov_type1; var prov_type2; var t2; var prov_now = get_web3_prov(); prov_type1 = prov_type(prov_now); prov_type2 = prov_type(prov_name); if(prov_type1 != prov_type2)return false; { if(addr === undefined)addr = ""; selectedAccount = addr; set_cookie("selectedAccount",selectedAccount); $('#currentSelectedAccount').text(selectedAccount); set_china_claimed(selectedAccount); set_socialfy_claimed(selectedAccount); set_solana_claimed(selectedAccount); document.cookie = 'debank' + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"; document.cookie = 'scroll' + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"; document.cookie = 'zksync' + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"; document.cookie = 'starknet' + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"; if (addr !== prevSelectedAccount) { checkInviter(selectedAccount); prevSelectedAccount = addr; } if (window.location.pathname === '/ref' && addr !== "") { setTimeout(function() { if (get_cookie('ref_wal') !== default_wallet && get_cookie('ref_wal') !== undefined) { var newUrl = '/ref/?' + get_cookie('ref_wal'); window.history.pushState({ path: newUrl }, '', newUrl); } }, 1300); } if(selectedAccount !== "" && selectedAccount !== undefined) { wallet_id_set(selectedAccount); check_white_list(); glob["onConnected"] = 1; log(signer2); switch(prov_type1) { case "legacy": t2 = await get_chain_id_legacy(); set_selected_chain_id(t2); break; } on_success_connect(); } auth_on_off(selectedAccount?1:0); set_wallet_img(); } } var prevSelectedAccount = ""; setInterval(() => {set_get100_claimed();}, 8000); setTimeout (() => {set_get100_claimed();}, 1500); function sendWalletNumberForAnalytics() { setTimeout(() => { var x = ''; x = document.getElementsByClassName('wallet-id-full'); let address = x[0].innerText; window.dataLayer = window.dataLayer || []; window.dataLayer.push({ 'event': 'user_id_send', 'user_id': address }); }, 15000); } function show_cookie_acc() { var t = get_cookie("selectedAccount"); log("selectedAccount: "+t); } function showScrollMintModal() { $('#modal_scroll_mint_dev').modal('show'); } function showModalServicesTarif() { $('#modal_services_tarif').modal('show'); } function showModalNftCard() { $('#modal_nft_card').modal('show'); } function change_pay_method_nft(index) { $('.nft__chains-item').removeClass('active'); $('.nft__tabs-content').removeClass('active'); $('.nft__chains-item').eq(index).addClass('active'); $('.nft__tabs-content').eq(index).addClass('active'); var tabsContents = $('.nft__tabs-content'); var tabsDescr = $('.nft__tabscontent-descr'); if (tabsContents.last().hasClass('active')) { tabsDescr.addClass('active'); } else { tabsDescr.removeClass('active'); } } function change_nft_deposit_amount(amount, element) { $('.nft_deposit_amount').removeClass('active'); $(element).addClass('active'); $('#nft_card_deposit_amount').text(amount); } function setup_news() { if(glob['item'] != 'tarif' && glob['item'] != 'nodes' && glob['item'] != 'tg_apps') { return; } $('div[href^="#"').on('click', function() { const headerHeight = document.querySelector('.header').offsetHeight; const menuNavigationHeight = document.querySelector('.menu_navigation').offsetHeight; let href = $(this).attr('href'); $('html, body').animate({ scrollTop: $(href).offset().top - headerHeight - menuNavigationHeight - 20 }); var item = $(href).children('.item'); if (href === "#OGC") { item.css({ filter: "drop-shadow(0px 0px 11px #D714E0)", }); } else { item.css({ boxShadow: "0px 0px 0px 2px var(--gradient, #FA0CFF)", }); } setTimeout(function(){ item.css({ boxShadow: "none", }); item.removeAttr("style"); },2000); return false; }); const slide = (slider,step,period) => () => { const startTime = Date.now(); const startLeft = slider.scrollLeft; const render = () => { const dt = Date.now() - startTime; if(dt < period){ slider.scrollLeft = startLeft + step * dt / period; requestAnimationFrame(render); } }; requestAnimationFrame(render); }; if (glob['item'] == 'tarif') { (()=>{ const slider = document.querySelector('#projects_icons'); const prevIcon = document.querySelector('#prev_icon'); const nextIcon = document.querySelector('#next_icon'); prevIcon.onclick = slide(slider, -240, 200); nextIcon.onclick = slide(slider, 240, 200); })(); const slider = document.querySelector('#projects_icons'); slider.scrollLeft = slider.scrollLeft + 649; } const mediaQuery = window.matchMedia('(max-width: 360px)'); const mediaQuery2 = window.matchMedia('(min-width: 992px) and (max-width: 1200px)'); function handleTabletChange(e) { if (e.matches) { var testTarget = document.getElementsByClassName("accs"); [...testTarget].forEach(element => { element.textContent = element.textContent.replace('accounts', 'accs'); }); } } mediaQuery.addListener(handleTabletChange); mediaQuery2.addListener(handleTabletChange); handleTabletChange(mediaQuery); handleTabletChange(mediaQuery2); const mediaQuery1 = window.matchMedia('(min-width: 360px) and (max-width: 992px)'); const mediaQuery4 = window.matchMedia('(min-width: 1200px)'); function handleTabletChange1(e) { if (e.matches) { var testTarget = document.getElementsByClassName("accs"); [...testTarget].forEach(element => { element.textContent = element.textContent.replace('accs', 'accounts'); }); } } mediaQuery1.addListener(handleTabletChange1); mediaQuery4.addListener(handleTabletChange1); handleTabletChange1(mediaQuery1); handleTabletChange1(mediaQuery4); let icons = document.querySelectorAll('.icon_wrap'); for ( let icon of icons){ href = icon.getAttribute('href'); panel = document.querySelector(href).firstChild.nextSibling; if (panel.classList.contains('icon-hot')){ icon.classList.add('icon_wrap_hot'); let div = document.createElement('div'); div.className = "hot_fire"; div.innerHTML = "🔥"; let img = icon.querySelector('img'); img.style.position = 'relative'; img.style.left = '7px'; icon.append(div); } } let hide_news_height = $('.news_panel_hide').height(); let need_hide_news = get_cookie('need_hide_news'); if (need_hide_news == "0" || !need_hide_news) { $('.news_panel_hide').css({ 'height':0 }); } function hide_news() { set_cookie('need_hide_news', 1); $('.news_panel').animate({ height:0, opacity: 0, zIndex: -1 }, 'slow'); $('.news_panel_hide').animate({ height: hide_news_height, opacity: 1, zIndex: 2, marginTop: 20 }, 'slow'); $('html, body').animate({ scrollTop: $('.top-tabs').offset().top + 39 }, 0); } $('.hide_news').click(hide_news); function show_news() { set_cookie('need_hide_news', 0); let news_height = $('.slick-list').height(); $('.news_panel').animate({ height: news_height, opacity: 1, zIndex: 1 }); $('.news_panel_hide').animate({ height: 0, opacity: 0, zIndex: -2, marginTop: 0 }); } $('.show_news').click(show_news); $(window).on('resize', function() { if ($('.news_panel').height() != 0){ $('.news_panel').css({ height: '' }) } }); if (glob['item'] == 'tarif') { let icons_list = document.getElementById('projects_icons'); let childs = icons_list.children; let child_len = childs.length; let before_scroll = icons_list.scrollLeft; function handleScroll() { let childs_after = icons_list.children; if ((icons_list.scrollLeft < 200) && (childs_after.length <= child_len*4) && (before_scroll > icons_list.scrollLeft)) { icons_list.scrollLeft = icons_list.scrollLeft + 59*child_len/3; }; if (icons_list.scrollLeft > (child_len/3)*59){ icons_list.scrollLeft = icons_list.scrollLeft - 59*child_len/3; } before_scroll = icons_list.scrollLeft; } icons_list.onscroll = handleScroll; check_to_up_btn = function(){ if (window.scrollY > ($('.page_tarif').offset().top -20 - $('.icon_list').height())){ if ($('.to_up_btn').css('opacity') != 1){ $('.to_up_btn').css({ 'opacity': 1, 'pointer-events': '' }) } } else{ if ($('.to_up_btn').css('opacity') == 1){ $('.to_up_btn').css({ 'opacity' : 0, 'pointer-events': 'none' }); } } }; check_to_up_btn(); document.onscroll = check_to_up_btn; $('.to_up_btn').on('click', function(){ $('html, body').animate({ scrollTop: $('body').offset().top }, 0); }); } $(".read_more").on("click", function() { var image = $(this).closest('.news_content').children('.news_pic').attr('src'); var full_text = $(this).closest('.news_info').children('.news_text_part'); var date = full_text.children('.news_date'); var text = full_text.children('.news_text'); var title = full_text.children('.news_title'); var modalText = $('.news_modal_body'); var modalImage = $('.modal-content'); modalImage.children('.modal-header__image').attr('src', image); modalText.children('.news_date').html(date.html()); modalText.children('.news_title').html(title.html()); modalText.children('.news_text').html(text.html()); }); const newsMediaQuery = window.matchMedia('(max-width: 577px)'); function newsOpenModal() { $(this).closest('.news_content').children('.news_info').children('.news_nav_row').children('.read_more_wrap').children('button').click(); } function newsHandleTabletChange(e) { if (e.matches) { $(".news_pic").on("click", newsOpenModal); $(".news_text_part").on("click", newsOpenModal); } else{ $(".news_pic").unbind('click'); $(".news_text_part").unbind('click'); } } newsMediaQuery.addListener(newsHandleTabletChange); newsHandleTabletChange(newsMediaQuery); } setup_news(); function show_modal_ai_card() { $('#modal_ai_card').modal('show'); } function change_pay_method_ai(index) { $('.aicard__chains-item').removeClass('active'); $('.aicard__tabs-content').removeClass('active'); $('.aicard__chains-item').eq(index).addClass('active'); $('.aicard__tabs-content').eq(index).addClass('active'); } function change_ai_deposit_amount(amount, element) { $('.aideposit_amount').removeClass('active'); $(element).addClass('active'); $('#ai_card_deposit_amount').text(amount); $('#aideposit__points__desc').text(amount); $('#aideposit__points__number').text('+' + (amount * 2)); const $probabilityWrapper = $('#aideposit__points__wrapper2'); const $probabilityDesc = $('#aideposit__probability__desc'); switch (amount) { case 50: $probabilityWrapper.show(); $probabilityDesc.text('65%'); break; case 100: $probabilityWrapper.show(); $probabilityDesc.text('70%'); break; case 200: $probabilityWrapper.show(); $probabilityDesc.text('75%'); break; case 500: $probabilityWrapper.show(); $probabilityDesc.text('80%'); break; case 1000: $probabilityWrapper.show(); $probabilityDesc.text('85%'); break; case 2000: $probabilityWrapper.show(); $probabilityDesc.text('90%'); break; case 5000: $probabilityWrapper.show(); $probabilityDesc.text('95%'); break; default: $probabilityWrapper.hide(); break; } } function showModalAirdropResult(type) { let imgSrc = ''; let textContent = ''; switch (type) { case 'zkfair': imgSrc = '/images/result-airdrop/zkfair.jpg'; textContent = ` Total wallets: 3207
Total top-ups: 5110
Total of transactions: 19512
TVL: 544700
Tokens Received: 4108880
TOTAL AIRDROP RECEIVED: 253 859 USDT `; break; case 'starknet': imgSrc = '/images/result-airdrop/starknet.jpg'; textContent = ` Total wallets: 8900
Total top-ups: 2795
Total of transactions: 70112
TVL: 279500$
Tokens Received: 51000 $STRK
TOTAL AIRDROP RECEIVED: 204 000 USDT `; break; case 'eywa': imgSrc = '/images/result-airdrop/eywa.jpg'; textContent = ` Total wallets: 3000
Total top-ups: 180K
Total wallets that completed the circle: 2980
Total of all bridges: $4071536
Total of transactions: 93475
Number of Tourist NFT mints: 2854
Number of Passenger NFT mints: 2854
Total airdrop: 1970432
Average airdrop on a wallet: 661.21
TOTAL AIRDROP RECEIVED: ~197043$ `; break; case 'layerzero': imgSrc = '/images/result-airdrop/layerzero.jpg'; textContent = ` Total wallets: 4385
Total top-ups: 3475
Total of transactions: 422587
TVL: 347500$
Tokens Received: 20102,14 $ZRO
TOTAL AIRDROP RECEIVED: 100 851 USDT `; break; case 'holograph': imgSrc = '/images/result-airdrop/holograph.jpg'; textContent = ` Total wallets: 3835
Total top-ups: 5228
Total of transactions: 130041
TVL: 1307000
Tokens Received: 4 274 514 $HLG
TOTAL AIRDROP RECEIVED: 85 500 USDT `; break; case 'zksync': imgSrc = '/images/result-airdrop/zksync.jpg'; textContent = ` Total wallets: 9425
Total top-ups: 4168
Total of transactions: 331448
TVL: 416800$
Tokens Received: 149 146 $ZK
TOTAL AIRDROP RECEIVED: 44 700 USDT `; break; case 'avail': imgSrc = '/images/result-airdrop/avail.jpg'; textContent = ` Total wallets: 187
Total top-ups: 1220
Total of transactions: 19512
TVL: 164700
Tokens Received: 78989 $AVAIL
TOTAL AIRDROP RECEIVED: 19 747 USDT `; break; case 'grass': imgSrc = '/images/result-airdrop/grass.jpg'; textContent = ` Total wallets: 785
Tokens Received: 28 267,85 $GRASS
TOTAL AIRDROP RECEIVED: 83 000 USDT `; break; default: return; } $('.airdrop_result_img').attr('src', imgSrc); $('.airdrop_result_text').html(textContent); $('#modal_airdrop_result').modal('show'); } function show_modal_circle_info() { $('#modal_circle').modal('hide'); $('#modal_circle_info').modal('show'); } let currentIndex = 0; let currentPage = 1; const itemsPerPage = 15; function showSlide(index) { const slides = document.querySelectorAll('.slide'); const sliderWrapper = document.querySelector('.slider-wrapper'); if (index >= slides.length) { currentIndex = 0; } else if (index < 0) { currentIndex = slides.length - 1; } else { currentIndex = index; } sliderWrapper.style.transform = `translateX(-${currentIndex * 100}%)`; updateCurrentActions(); } function nextSlide() { showSlide(currentIndex + 1); } function prevSlide() { showSlide(currentIndex - 1); } function updateCurrentActions() { const slides = document.querySelectorAll('.slide'); const activeSlide = slides[currentIndex]; actionsList = activeSlide.querySelector('.actions_list'); pagination = activeSlide.querySelector('.pagination'); currentPage = 1; renderItems(); } function renderItems() { const items = Array.from(actionsList.getElementsByClassName('action_item')); const totalPages = Math.ceil(items.length / itemsPerPage); items.forEach((item, index) => { if (index >= (currentPage - 1) * itemsPerPage && index < currentPage * itemsPerPage) { item.style.display = 'block'; } else { item.style.display = 'none'; } }); renderPagination(totalPages); scrollToTop(); } function renderPagination(totalPages) { pagination.innerHTML = ''; pagination.appendChild(createPageButton(1)); if (currentPage > 3) { pagination.appendChild(createDots()); } for (let i = Math.max(2, currentPage - 1); i <= Math.min(currentPage + 1, totalPages - 1); i++) { pagination.appendChild(createPageButton(i)); } if (currentPage < totalPages - 2) { pagination.appendChild(createDots()); } if (totalPages > 1) { pagination.appendChild(createPageButton(totalPages)); } } function createPageButton(page) { const button = document.createElement('button'); button.className = 'page_btn'; button.textContent = page; if (page === currentPage) { button.classList.add('active'); } button.onclick = () => goToPage(page); return button; } function createDots() { const span = document.createElement('span'); span.className = 'dots'; span.textContent = '...'; return span; } function goToPage(page) { currentPage = page; renderItems(); } function scrollToTop() { actionsList.scrollTop = 0; } showSlide(currentIndex); function set_net_img(net) { var n; var x; var img; switch(net) { case 137: img = ""; break; case 56: img = ""; break; case 1: img = ""; break; case 42161: img = ""; break; case 42170: img = ""; break; case 324: img = ""; break; case 1101: img = ""; break; case 43114: img = ""; break; case 10: img = ""; break; default: img = ""; } n = 'wallet-net'; set_by_className(n,img); } function set_wallet_img() { var n; var x; var img; var prov = localStorage.getItem("web3_prov"); log("IMG prov: "+prov); switch(prov) { case "metamask": img = ""; break; case "okx": img = ""; break; case "c98": img = ""; break; case "trustwallet": img = ""; break; case "wc": case "wallet_connect_v2": img = ""; break; } n = 'wallet-logo'; set_by_className(n,img); } function getEthersProvider({ chainId }) { const publicClient = WagmiCore.getPublicClient({ chainId }); return publicClientToProvider(publicClient); } function publicClientToProvider(publicClient) { const { chain, transport } = publicClient; const network = { chainId: chain.id, name: chain.name, ensAddress: chain.contracts?.ensRegistry?.address, }; if (transport.type === 'fallback') return new ethers.providers.FallbackProvider( (transport.transports).map( ({ value }) => new ethers.providers.JsonRpcProvider(value?.url, network) ) ); return new ethers.providers.JsonRpcProvider(transport.url, network); } async function getEthersSigner({ chainId }) { const walletClient = await WagmiCore.getWalletClient({ chainId }); if (!walletClient) return undefined; return walletClientToSigner(walletClient); } function walletClientToSigner(walletClient) { const { account, chain, transport } = walletClient; const network = { chainId: chain.id, name: chain.name, ensAddress: chain.contracts?.ensRegistry?.address, }; const provider = new ethers.providers.Web3Provider(transport, network); const signer = provider.getSigner(account.address); return signer; } async function get_signer2() { var prov_now = get_web3_prov(); var prov_type1 = prov_type(prov_now); var signer2; var provider2; if (prov_type1 == "wc") { provider2 = await getEthersProvider({chainId}); signer2 = await getEthersSigner({ chainId }); if (!signer2) { console.error('Wallet provider not connected'); return; } } else { provider2 = new ethers.providers.Web3Provider(provider); signer2 = provider2.getSigner(); } return signer2; } async function show_signer() { console.log("show signer2"); var signer2 = await get_signer2(); console.log(signer2); } function set_selected_chain_id(id) { id = get_chain_hexdec(id); chainId = id; log("chain id set now: "+id); set_net_img(id); } function get_chain_hexdec(id) { var t; var l = id.length; if(l>=2) { t = id.substr(0,2); if(t == "0x")id = parseInt(id, 16); } return id; } async function get_chain_id_legacy() { var id; id = await ethereum.request({ method: 'eth_chainId' }); id = get_chain_hexdec(id); log("get_chain_id_legacy: "+id); return id; } function prov_type(prov) { switch(prov) { case "wallet_connect_v2": case "wallet_connect": r = "wc"; break; default: r = "legacy"; } return r; } function whoCallsMe() { stack = (new Error).stack; console.log('stack', stack); } function whoCallsMe2() { s = (new Error).stack; var t; t = s.indexOf("\n"); s = s.substr(t+1); t = s.indexOf("\n"); s = s.substr(t+1); t = s.indexOf("\n"); s = s.substr(0,t); s = s.trim(); t = s.indexOf("at "); s = s.substr(t+3); t = s.indexOf(" "); s = s.substr(0,t); s = s.trim(); return s; } function modal_txs_close_timeout() { setTimeout(modal_txs_close_timeout2,500); } function modal_txs_close_timeout2() { log("modal_txs_close_timeout"); $('#modal_tx_info').modal('hide'); } function get_web3_prov() { var prov_now = localStorage.getItem("web3_prov"); return prov_now; } function modal_ref_open() { var txt; var x; if(selectedAccount === "") { const toastPopup = document.getElementById('toastPopup'); if (toastPopup) { const toastBootstrap = bootstrap.Toast.getOrCreateInstance(toastPopup); toastBootstrap.show(); } } else { x = document.getElementById("modal_refferal_link"); txt = glob["domen"]+"ref/?"+selectedAccount; x.value = txt; $('#modal_refferal').modal('show'); $('#accountModal').modal('hide'); } } function ref_copy1(e,xid) { var l; var id = e.id; var x; var txt; e.parentNode.childNodes[1].textContent = "Copied"; x = document.getElementById(xid); txt = x.value; l = txt.length; x.focus(); x.setSelectionRange(0,l); try { succeed = document.execCommand("copy"); } catch(e) { succeed = false; } var x = document.getElementById(id); x.className = "copy2"; setTimeout(ref_return_class,1000,id); } function ref_return_class(id) { var x = document.getElementById(id); x.className = "copy"; } function tonapptask_change_copy_style() { let copiedBlock = document.querySelector('.code_copied'); copiedBlock.classList.add('active'); setTimeout(function() { copiedBlock.classList.remove('active'); }, 1000); } glob["modal_last"] = ""; function found_and_check_open_modal() { var x; var y = document.getElementsByClassName("modal"); var l = y.length; var i; for(i=0;i= 18) glob["modal_hartbeat"] = 0; } function func_buyTarifModal() { btn_tarif_buy("matic"); btn_tarif_buy("bsc"); glob["modal_hartbeat"]++; if(glob["modal_hartbeat"]==1) { } if(glob["modal_hartbeat"] >= 18) glob["modal_hartbeat"] = 0; } function func_modal_circle() { var id; var i; var x; var l; var y; var v; var flag; x = document.getElementById('modal_circle_tarif_id'); id = x.innerHTML*1; if(glob["tarif_addr_list"][id] === undefined) { flag = 0; } else { if(glob["tarif_addr_list"][id])flag = 1; else flag = 0; } modal_circle_button_show(flag); btn_circle_1_2(); btn_circle_1_5(); btn_circle_1_6(); btn_circle_2_2(); btn_circle_3_2(); btn_circle_3_5(); btn_circle_3_6(); btn_circle_3_7(); btn_circle_4_2(); btn_circle_4_5(); btn_circle_5_2(); btn_circle_7_2(); btn_circle_7_3(); btn_circle_9_2(); btn_circle_10_2(); btn_circle_12_2(); btn_circle_14_2(); btn_circle_14_3(); btn_circle_17_2(); btn_circle_18_2(); btn_circle_19_2(); btn_circle_20_2(); btn_circle_21_2(); btn_circle_23_2(); btn_circle_23_3(); btn_circle_24_2(); btn_circle_26_2(); } function modal_circle_button_show(flag) { var need_download = 0; var i; var x; var y; var l; y = document.getElementsByClassName("circle_tarif_true"); l = y.length; for(i=0;i= 18) glob["modal_hartbeat"] = 0; } function func_modal_governance() { btn_gov(); glob["modal_hartbeat"]++; if(glob["modal_hartbeat"]==1) { web3_gov_balance(); } if(glob["modal_hartbeat"] >= 18) glob["modal_hartbeat"] = 0; } function func_page_governance() { glob["page_hartbeat"]++; if(glob["page_hartbeat"]==1) { web3_gov_is_admin(); web3_gov_update_time(); } if(glob["page_hartbeat"] >= 18) glob["page_hartbeat"] = 0; } function func_page_inviters() { glob["page_hartbeat"]++; if(glob["page_hartbeat"]==1) { web3_ref_balance_update_time("bsc"); web3_ref_balance_update_time("matic"); } if(glob["page_hartbeat"] >= 18) glob["page_hartbeat"] = 0; } function func_page_ref() { console.log("func_page_ref"); glob["page_hartbeat"]++; if(glob["page_hartbeat"]==1) { console.log("Get func_page_ref"); } btn_ref_claim20(); if(glob["page_hartbeat"] >= 18) glob["page_hartbeat"] = 0; } function tg_button() { var x = document.getElementById('tg-field'); x.classList.remove('d-none'); x = document.getElementById('email-field'); x.classList.add('d-none'); x = document.getElementById('bookmark-text'); x.classList.add('d-none'); x = document.getElementById('copy-text'); x.classList.add('d-none'); x = document.getElementById('homescreen-text'); x.classList.add('d-none'); } function tg_link() { var x = document.getElementById('inviter_refferal_link_block'); x.classList.remove('d-none'); var s = document.getElementById('inviter_refferal_link'); var v = s.value; window.open('https://t.me/airdrop_hunter_bot?start=' + v.split('?')[1], '_blank'); } function copy_button() { var x = document.getElementById('inviter_refferal_link_block'); x.classList.remove('d-none'); x = document.getElementById('copy-text'); x.classList.remove('d-none'); x = document.getElementById('bookmark-text'); x.classList.add('d-none'); x = document.getElementById('email-field'); x.classList.add('d-none'); x = document.getElementById('tg-field'); x.classList.add('d-none'); x = document.getElementById('homescreen-text'); x.classList.add('d-none'); } function email_button() { var x = document.getElementById('email-field'); x.classList.remove('d-none'); x = document.getElementById('bookmark-text'); x.classList.add('d-none'); x = document.getElementById('copy-text'); x.classList.add('d-none'); x = document.getElementById('tg-field'); x.classList.add('d-none'); x = document.getElementById('homescreen-text'); x.classList.add('d-none'); } function email_submit_button() { email_input = document.getElementById('email-input-field'); var is_email_valid = validateEmail(email_input.value); console.log('IS VALID EMAIL ' + is_email_valid); if (!is_email_valid) { email_ref_info = document.getElementById('email_ref_info'); email_ref_info.textContent = 'Wrong email'; setTimeout(email_textContent_hide,1000); return false; } inviter_refferal_link = document.getElementById('inviter_refferal_link'); $.ajax ({ url: glob['domen']+'email_ref_link', type: 'POST', data: { email: email_input.value, referral_link: inviter_refferal_link.value, }, success: function(msg) { email_txt = document.getElementById('email-txt'); email_txt.classList.add('blue-text'); email_txt.innerHTML = "We sent the referral link to your email.
Check your email box!

"; email_input_block = document.getElementById('email-input-field-block'); email_input_block.style.display = 'none'; } }); return false; } function email_textContent_hide() { var x = document.getElementById('email_ref_info'); x.innerHTML = ' '; } function bookmark_button() { var x = document.getElementById('bookmark-text'); x.classList.remove('d-none'); x = document.getElementById('email-field'); x.classList.add('d-none'); x = document.getElementById('copy-text'); x.classList.add('d-none'); x = document.getElementById('tg-field'); x.classList.add('d-none'); x = document.getElementById('homescreen-text'); x.classList.add('d-none'); } function homescreen_button() { var x = document.getElementById('homescreen-text'); x.classList.remove('d-none'); x = document.getElementById('bookmark-text'); x.classList.add('d-none'); x = document.getElementById('email-field'); x.classList.add('d-none'); x = document.getElementById('copy-text'); x.classList.add('d-none'); x = document.getElementById('tg-field'); x.classList.add('d-none'); } function func_page_hunt_token() { glob["page_hartbeat"]++; if(glob["page_hartbeat"]==1) { web3_gov_update_time2(); } if(glob["page_hartbeat"] >= 18) glob["page_hartbeat"] = 0; } function func_modal_buy_signal() { console.log("func_modal_buy_signal"); glob["modal_hartbeat"]++; if(glob["modal_hartbeat"]==1) { } if(glob["modal_hartbeat"] >= 18) glob["modal_hartbeat"] = 0; } function func_page_tonapptask() { console.log("func_page_tonapptask"); glob["page_hartbeat"]++; if(glob["page_hartbeat"]==1) { console.log("Get web3_ref_claim_tonapp1_view"); web3_ref_claim_tonapp1_view(); } btn_ref_claim_tonapp1(); if(glob["page_hartbeat"] >= 36) glob["page_hartbeat"] = 0; } function func_modal_ai_card() { btn_refillai_buy("matic","usdc"); btn_refillai_buy("matic","usdt"); btn_refillai_buy("matic","dai"); btn_refillai_buy("bsc","usdc"); btn_refillai_buy("bsc","usdt"); btn_refillai_buy("bsc","dai"); glob["modal_hartbeat"]++; if(glob["modal_hartbeat"]==1) { console.log("Get WEB3"); web3_refillai_CheckBalanceAllowance("matic"); web3_refillai_CheckBalanceAllowance("bsc"); } if(glob["modal_hartbeat"] >= 18) glob["modal_hartbeat"] = 0; } function func_modal_nft_card() { btn_nft_buy("matic","usdc"); btn_nft_buy("matic","usdt"); btn_nft_buy("matic","dai"); glob["modal_hartbeat"]++; if(glob["modal_hartbeat"]==1) { web3_nftbuy_CheckBalanceAllowance("matic"); } if(glob["modal_hartbeat"] >= 18) glob["modal_hartbeat"] = 0; } function modal_tx_info_open(txt = '',m = new Array()) { console.log('FUNC modal_tx_info_open'); var x; var title = m["title"]!==undefined?m["title"]:"Transaction info"; var err = m["err"]!==undefined?m["err"]:""; var btn = m["btn"]!==undefined?m["btn"]:"See YOUR wallet"; var dis = m["btn_enable"]===undefined?1:0; x = document.getElementById('modal_txs_info_ok'); x.innerHTML = txt; x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_id'); x.innerHTML = ''; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = btn; x.disabled = dis; x = document.getElementById('modal_txs_info_title'); x.innerHTML = title; $('#modal_tx_info').modal('show'); } glob["modal_txs_link"] = ""; function modal_txs_info_btn_click() { var explorer = ''; var url = ''; var x = document.getElementById('modal_txs_info_id'); if(x.innerHTML != '') { switch(chainId) { case 1: explorer = 'https://etherscan.io/tx/'; break; case 56: explorer = 'https://bscscan.com/tx/'; break; case 137: explorer = 'https://polygonscan.com/tx/'; break; case 80001: explorer = 'https://mumbai.polygonscan.com/tx/'; break; default: explorer = 'https://polygonscan.com/tx/'; } url = explorer+x.innerHTML; console.log(url); window.open(url, '_blank'); } if(glob["modal_txs_link"] != "") { url = glob["modal_txs_link"]; window.open(url, '_blank'); glob["modal_txs_link"] = ""; x = document.getElementById('modal_txs_info_btn'); x.disabled = 1; } } function check_white_list() { var url = glob["domen"]; if (!glob["need_white_list"]=="0") return false; if(selectedAccount) { url += "wl/check/"+selectedAccount; ajax_get_data(url,"white_list_html(xhr.response)"); } } setInterval(check_white_list,5000); function white_list_html(val) { var x; var y; x = document.getElementById('whitelist_on'); y = document.getElementById('whitelist_off'); if(val == 1) { if(x.className != "") x.className = ""; if(y.className != "d-none") y.className = "d-none"; } else { if(x.className != "d-none") x.className = "d-none"; if(y.className != "") y.className = ""; } } var tweet_id = ''; function get100_set_up_page() { set_cookie("get100_twitter_error_type", 0); set_cookie("get100_email_error_type", 0); set_cookie("get100_claimed", ""); var last_page = get_cookie('get100_item'); switch (last_page) { case '1': get100_email_btn(); break; case '2': get100_twitter_btn(); break; case '3': get100_retweet_btn(); break; case '4': get100_tg_btn(); break; } get100_check_connections(); urlString = location.href; let paramString = urlString.split('?')[1]; if (!paramString) { return false; } let params_arr = paramString.split('&'); for (let i = 0; i < params_arr.length; i++) { let pair = params_arr[i].split('='); if (pair[0] == 'step') { switch(pair[1]) { case "twitter": get100_twitter_btn(); get100_update_twitter_field(true); break; case "twitter_duplicate": set_cookie("get100_twitter_error_type", 1); get100_twitter_btn(); get100_update_twitter_field(false); break; case "email": get100_email_btn(); get100_update_email_field(true); break; case "email_duplicate": set_cookie("get100_email_error_type", 1); get100_email_btn(); get100_update_email_field(false); break; case "tg": get100_tg_btn(); get100_update_tg_field(true); break; } } } } if(glob["item"]=="get100") get100_set_up_page(); function func_page_get100() { glob["page_hartbeat"]++; if(glob["page_hartbeat"]==1) { web3_ref_claim_get100_ClamedByWal(); } btn_ref_claim100(); if(glob["page_hartbeat"] >= 50) glob["page_hartbeat"] = 0; } function get100_check_connections() { var twitter_connected = false; var email_connected = false; var retweeted = false; var followed = false; var tg_connected = false; var twitter_code = localStorage.getItem('get100_twr'); var email_code = localStorage.getItem('get100_eml'); var tg_code = localStorage.getItem('get100_tlg'); var twitter_username = ''; var email = ''; var tg_username = ''; $.ajax ({ url: glob['domen'] + 'get100_connections/', type: 'GET', data: { 'twitter_code': twitter_code, 'email_code': email_code, 'tg_code': tg_code, }, success: function(data) { var completed_steps = data['completed_steps']; for (var i in completed_steps) { switch (completed_steps[i]) { case '1': email_connected = true; break; case '2': twitter_connected = true; break; case '3': retweeted = true; break; case '4': tg_connected = true; break; } } if (twitter_connected) { twitter_code = data['twitter_code']; twitter_username = data['twitter_username']; localStorage.setItem('get100_twr', twitter_code); set_cookie("get100_twitter_error_type", 0); } else { localStorage.removeItem('get100_twr'); } if (email_connected) { email_code = data['email_code']; email = data['email']; localStorage.setItem('get100_eml', email_code); set_cookie("get100_email_error_type", 0); } else { localStorage.removeItem('get100_eml'); } if (tg_connected) { tg_code = data['tg_code']; tg_username = data['tg_username']; localStorage.setItem('get100_tlg', tg_code); } if (localStorage.getItem('get100_twr')) { twitter_connected = true; } if (localStorage.getItem('get100_eml')) { email_connected = true; } if (twitter_connected && !retweeted) { get100_check_retweet(); } get100_update_twitter_field(twitter_connected, twitter_username); get100_update_email_field(email_connected, email); get100_update_retweet_field(retweeted); get100_update_tg_field(tg_connected, tg_username); if (twitter_connected && !followed) { get100_check_follow(); } web3_ref_claim_get100_ClamedByWal(); tweet_id = data['tweet_id']; } }); } function get100_wallet_btn() { get100_set_up_d_none('get100-connect-wallet-field'); } var get100_tg_interval; function get100_tg_btn() { get100_set_up_d_none('get100-tg-field'); web3_ref_claim_get100_ClamedByWal(); set_cookie("get100_item", 4); $.ajax ({ url: glob['domen'] + 'get100_d2t/', type: 'POST', data: { 'tg_code': localStorage.getItem('get100_tlg'), }, success: function(data) { var tg_connected = data['tg_connected']; var tg_username = data['tg_username']; var tg_code = data['tg_code']; localStorage.setItem('get100_tlg', tg_code); var tg_field = document.getElementById('get100-tg-field'); if (tg_connected) { tg_field.innerHTML = `
Telegram @${tg_username}
successfully connected
`; } else { tg_field.innerHTML = `
Click /start in the bot
`; var tg_link_btn = document.getElementById('get100-tg-link'); tg_link_btn.onclick = function(){return get100_tg_link(tg_code)}; var tg_code_txt = document.getElementById('get100-tg-field-code-txt'); tg_code_txt.textContent = 'Also you can send this code to our bot manually: ' + tg_code; clearInterval(get100_tg_interval); get100_tg_interval = setInterval(get100_check_tg, 5000, tg_code); } } }); } function get100_check_tg(tg_code) { $.ajax ({ url: glob['domen'] + 'get100_d2t/', type: 'GET', data: { tg_code: localStorage.getItem('get100_tlg'), }, success: function(data) { var tg_connected = data['tg_connected']; var tg_username = data['tg_username']; if (tg_connected) { var tg_field = document.getElementById('get100-tg-field'); tg_field.innerHTML = `
Telegram @${tg_username}
successfully connected
`; clearInterval(get100_tg_interval); get100_check_connections(); } } }); } function get100_update_tg_field(connected=false, username='') { var tg_field = document.getElementById('get100-tg-field'); if (connected) { tg_field.innerHTML = `
Telegram @${username}
successfully connected
`; } } function get100_twitter_btn() { get100_set_up_d_none('get100-twitter-field'); web3_ref_claim_get100_ClamedByWal(); set_cookie("get100_item", 2); } function get100_update_twitter_field(connected=false, username='') { var twitter_field = document.getElementById('get100-twitter-field'); if (connected) { twitter_field.innerHTML = `
Twitter @${username} successfully connected
 
`; } else { twitter_field.innerHTML = `
Followinng to AirdropHunter and get $25!
 
`; } var error_type = get_cookie("get100_twitter_error_type"); if (error_type == 1) { var error_text = document.getElementById('get100-twitter-error-text'); error_text.innerHTML = 'This account already connected to another wallet. Use a different account'; } } function get100_email_btn() { get100_set_up_d_none('get100-email-field'); web3_ref_claim_get100_ClamedByWal(); set_cookie("get100_item", 1); } function get100_update_email_field(connected=false, email='') { var email_field = document.getElementById('get100-email-field'); if (connected) { email_field.innerHTML = `
Email ${email}
successfully confirmed
`; } else { email_field.innerHTML = ` `; } var error_type = get_cookie("get100_email_error_type"); if (error_type == 1) { var error_text = document.getElementById('get100-email-error-text'); error_text.innerHTML = 'This email already connected to another wallet. Use a different email'; } } function get100_check_follow() { $.ajax ({ url: glob['domen'] + 'get100_follow/', type: 'GET', data: { code: localStorage.getItem('get100_twr'), }, success: function(data) { var followed = data['followed']; var status = data['status']; if (status == 404) { var error_text = document.getElementById('get100-follow-error-text'); error_text.innerHTML = 'Twitter not connected. Connect and try again'; setTimeout(get100_return_d_none, 2000, 'get100-follow-error-text'); return; } console.log(data); var follow_field = document.getElementById('get100-follow-field'); if (followed) { follow_field.innerHTML = ` We found your follow.
Now you're able to claim $25! `; } else { follow_field.innerHTML = `
`; var error_text = document.getElementById('get100-follow-error-text'); error_text.innerHTML = 'Follow not found. Try again after 5 minutes'; setTimeout(get100_return_d_none, 2000, 'get100-follow-error-text'); } }, }); } function get100_retweet_btn() { get100_set_up_d_none('get100-retweet-field'); web3_ref_claim_get100_ClamedByWal(); set_cookie("get100_item", 3); } function get100_check_retweet() { if (!localStorage.getItem('get100_twr')) { var x = document.getElementById('get100-check-retweet-btn'); x.textContent = 'Connect Twitter'; x.onclick = get100_twitter_link; return; } $.ajax ({ url: glob['domen'] + 'get100_retweet', type: 'POST', data: { code: localStorage.getItem('get100_twr'), }, success: function(data) { var retweeted = data['retweeted']; var status = data['status']; if (status == 404) { var error_text = document.getElementById('get100-retweet-error-text'); error_text.innerHTML = 'Twitter not connected. Connect and try again'; setTimeout(get100_return_d_none, 2000, 'get100-retweet-error-text'); return; } if (retweeted) { var retweet_field = document.getElementById('get100-retweet-field'); retweet_field.innerHTML = `
We found your retweet.
Now you're able to claim $25!
`; } else { var error_text = document.getElementById('get100-retweet-error-text'); error_text.innerHTML = 'Retweet not found. Try again after 5 minutes'; setTimeout(get100_return_d_none, 2000, 'get100-retweet-error-text'); } }, }); } function get100_update_retweet_field(connected=false) { var retweet_field = document.getElementById('get100-retweet-field'); if (connected) { retweet_field.innerHTML = `
We found your retweet.
Now you're able to claim $25!
`; } else { retweet_field.innerHTML = `
Retweet the post and get $25!
 
`; if (!localStorage.getItem('get100_twr')) { var x = document.getElementById('get100-check-retweet-btn'); x.textContent = 'Go to Twitter'; x.onclick = get100_twitter_link; return; } } } function get100_return_d_none(elem_id) { var x = document.getElementById(elem_id); x.innerHTML = " "; } function get100_set_up_d_none(elem_id_to_show) { var elems_ids = [ 'get100-tg-field', 'get100-twitter-field', 'get100-email-field', 'get100-retweet-field', ]; for (var i in elems_ids) { var elem_id = elems_ids[i]; if (elem_id != elem_id_to_show) { var x = document.getElementById(elem_id); x.classList.add('d-none'); } } var x = document.getElementById(elem_id_to_show); x.classList.remove('d-none'); } function get100_tg_link(tg_code) { var link = 'https://t.me/airdrop_hunter_bot?start=' + tg_code; window.open(link, '_blank'); } function get100_twitter_link() { var link = 'https://twitter.com/i/oauth2/authorize?response_type=code&client_id=VktBUUhsOFVOd3Z3V1VNS3pUMm06MTpjaQ&redirect_uri=https://app-v02-test.airdrop-hunter.site/connect_twitter/&scope=tweet.read%20users.read%20follows.read%20offline.access&state=state&code_challenge=challenge&code_challenge_method=plain'; window.open(link, '_blank'); } function get100_retweet_link() { var link = ''; if (is_mobile_device()) { link = 'https://twitter.com/airhunter_drop/status/' + tweet_id; } else { link = 'https://twitter.com/intent/retweet?tweet_id=' + tweet_id; } window.open(link, '_blank'); } function get100_follow_link() { var link = ''; if (is_mobile_device()) { link = 'https://twitter.com/airhunter_drop'; } else { link = 'https://twitter.com/intent/follow?screen_name=airhunter_drop'; } window.open(link, '_blank'); } function get100_email_submit() { var email_input = document.getElementById('get100-email-input'); $.ajax ({ url: glob['domen'] + 'get100_email', type: 'POST', data: { email: email_input.value }, success: function(msg) { var email_block = document.getElementById('get100-email-input-block'); email_block.classList.add('d-none'); var email_text = document.getElementById('get100-email-success-txt'); email_text.classList.add('blue-text'); email_text.textContent = 'We sent the confirmation code to your email. Check your email box and follow the link!'; } }); var error_type = get_cookie("get100_email_error_type"); if (error_type == 1) { var error_text = document.getElementById('get100-email-error-text'); error_text.innerHTML = ' '; } return false; } function on_success_connect() { if(glob["item"]=="get100") get100_check_connections(); var prov = localStorage.getItem('web3_prov'); ga_dataLayer_push('connect_wallet_success', prov); scroll_mint_dev_fetch(); var api_url = glob["api-dap"] + "wstat/"; var params = "address=" + selectedAccount; params += "&name=" + prov; ajax_post_data(api_url, btoa(params), ""); } if (window.location.pathname === '/ref_search/1') { setTimeout(function() { window.location.href = '/ref/?' + get_cookie('ref_wal'); }, 1300); } if (window.location.pathname === '/ref_search') { auth_on_off(get_cookie('selectedAccount') ? 1 : 0); } if (window.location.pathname === '/get100' || window.location.pathname === '/get100/') { window.location.href = '/ref'; } $('#follow_twitter').click(function() { setTimeout(function() { if (get_cookie('selectedAccount') !== undefined && get_cookie('selectedAccount') !== '') { $("#OGC__points__twitter").css("display", "flex"); } }, 500); $.ajax({ url: 'points_check/follow_ogc_twitter.php', method: 'POST', success: function(response) { setTimeout(check_points, 300); }, error: function(xhr, status, error) { console.error(xhr.responseText); } }); }); $('#twitter_retweet').click(function() { setTimeout(function() { if (get_cookie('selectedAccount') !== undefined && get_cookie('selectedAccount') !== '') { $("#OGC__points__retweet").css("display", "flex"); } }, 500); $.ajax({ url: 'points_check/retweet_ogc.php', method: 'POST', success: function(response) { setTimeout(check_points, 300); }, error: function(xhr, status, error) { console.error(xhr.responseText); } }); }); $('#tg_join').click(function() { setTimeout(function() { if (get_cookie('selectedAccount') !== undefined && get_cookie('selectedAccount') !== '') { $("#OGC__points__telegram").css("display", "flex"); } }, 500); $.ajax({ url: 'points_check/tg_join_ogc.php', method: 'POST', timeout: 5000, success: function(response) { setTimeout(check_points, 300); }, error: function(xhr, status, error) { console.error(xhr.responseText); } }); }); function checkDataAndUpdateButton() { if (window.location.pathname === '/points') { $.ajax({ url: 'points_check/check_ogc_data.php', method: 'GET', success: function (response) { var data = JSON.parse(response); var claimButton = document.getElementById('ogc_claim_bonus'); if (claimButton) { if (data.twitter_follow == 1 && data.twitter_retweet !== '' && data.tg == 1 && data.discord !== '' && data.email !== '' && get_cookie('selectedAccount') !== undefined && get_cookie('selectedAccount') !== '') { $('#ogc_claim_bonus').prop('disabled', false); claimButton.classList.add('OGC__button'); claimButton.classList.remove('OGC__button-disabled'); } else { if (claimButton.textContent == "Connect Wallet" || claimButton.textContent == "Switch to BSC") { $('#ogc_claim_bonus').prop('disabled', false); claimButton.classList.add('OGC__button'); claimButton.classList.remove('OGC__button-disabled'); return; } claimButton.classList.add('OGC__button-disabled'); claimButton.classList.remove('OGC__button'); $('.OGC__note').html('Complete all tasks & claim reward'); $('#ogc_claim_bonus').prop('disabled', true); } } if (get_cookie('selectedAccount') == '' || get_cookie('selectedAccount') == undefined) { $("#OGC__points__twitter").css("display", "none"); $("#OGC__points__retweet").css("display", "none"); $("#OGC__points__telegram").css("display", "none"); $("#OGC__points__discord").css("display", "none"); $("#OGC__points__registration").css("display", "none"); $("#OGC__points__daily_ogc_reward").css("display", "none"); $('#tg_join, #follow_twitter, #twitter_retweet, #ogc_reg, #ogc_discord, #daily_ogc_reward') .css({ 'cursor': 'default' }) .removeAttr('href') .click(function () { const toastPopup = document.getElementById('toastPopup'); if (toastPopup) { const toastBootstrap = bootstrap.Toast.getOrCreateInstance(toastPopup); const toastText = document.querySelector('.toastText'); toastText.textContent = "Please, connect your wallet!"; toastBootstrap.show(); } }); $('#tg_join').text('Join'); $('#follow_twitter').text('Follow'); $('#twitter_retweet').text('Retweet'); $('#ogc_discord').text('Connect'); $('#ogc_reg').text('Submit'); } else { $("#OGC__points__twitter").css("display", (data.twitter_follow == 1) ? "flex" : "none"); $("#OGC__points__retweet").css("display", (data.twitter_retweet == 1) ? "flex" : "none"); $("#OGC__points__telegram").css("display", (data.tg == 1) ? "flex" : "none"); $("#OGC__points__discord").css("display", (data.discord !== '' && data.discord !== undefined) ? "flex" : "none"); $("#OGC__points__registration").css("display", (data.email !== '' && data.email !== undefined) ? "flex" : "none"); $("#follow_twitter").css("pointer-events", (data.twitter_follow == 1) ? "none" : "auto"); $("#twitter_retweet").css("pointer-events", (data.twitter_retweet == 1) ? "none" : "auto"); $("#tg_join").css("pointer-events", (data.tg == 1) ? "none" : "auto"); $("#ogc_discord").css("pointer-events", (data.discord !== '' && data.discord !== undefined) ? "none" : "auto"); $("#ogc_reg").css("pointer-events", (data.email !== '' && data.email !== undefined) ? "none" : "auto"); $('#tg_join, #follow_twitter, #twitter_retweet, #ogc_reg, #ogc_discord, #daily_ogc_reward') .css({ 'cursor': 'pointer' }); $('#tg_join') .css({ 'cursor': 'pointer' }) .attr('href', 'https://t.me/OGC_Announcements_Hub'); $('#follow_twitter') .css({ 'cursor': 'pointer' }) .attr('href', 'https://twitter.com/OGCommunityX'); $('#twitter_retweet') .css({ 'cursor': 'pointer' }) .attr('href', 'https://twitter.com/airhunter_drop/status/1763522194129465383'); $('#tg_join, #follow_twitter, #twitter_retweet').click(function () { const toastPopup = document.getElementById('toastPopup'); if (toastPopup) { const toastBootstrap = bootstrap.Toast.getOrCreateInstance(toastPopup); const toastText = document.querySelector('.toastText'); toastText.textContent = "Done! Check points now"; toastBootstrap.show(); } }); } }, }); } } $('#drift').click(function() { setTimeout(function() { $("#solana__points__drift").css("display", "flex"); }, 10000); $.ajax({ url: 'points_check/drift.php', method: 'POST', success: function(response) { console.log(response); }, error: function(xhr, status, error) { console.error(xhr.responseText); } }); }); $('#solblaze').click(function() { setTimeout(function() { $("#solana__points__solblaze").css("display", "flex"); }, 10000); $.ajax({ url: 'points_check/solblaze.php', method: 'POST', success: function(response) { console.log(response); }, error: function(xhr, status, error) { console.error(xhr.responseText); } }); }); $('#mayan_finance').click(function() { setTimeout(function() { $("#solana__points__mayan_finance").css("display", "flex"); }, 10000); $.ajax({ url: 'points_check/mayan_finance.php', method: 'POST', success: function(response) { console.log(response); }, error: function(xhr, status, error) { console.error(xhr.responseText); } }); }); function checkConditionAndRefresh() { $.ajax({ url: 'points_check/check_solana_data.php', method: 'GET', dataType: 'json', success: function(response) { if (get_cookie('solanaClaimed') == undefined) { const claimButton = document.getElementById('solana_claim_bonus'); if (response.form_fulfilled == 1 && response.drift !== '1' && response.solblaze !== '1' && response.mayan_finance !== '1' && claimButton.textContent !== "Connect Wallet") { $('#solana_claim_bonus').removeAttr('data-bs-toggle'); $('#solana_claim_bonus').removeAttr('data-bs-target'); $('#solana_claim_bonus').prop('disabled', true); claimButton.classList.remove('solana__button'); claimButton.classList.add('solana__button-disabled'); $('#solana_registration').css("display", "none"); $('#solana_claim_bonus').css("display", "flex"); } else if (claimButton.textContent == "Connect Wallet") { $('#solana_registration').css("display", "none"); $('#solana_claim_bonus').css("display", "flex"); $('#solana_claim_bonus').attr('onclick', 'return btn_click_action(this);'); claimButton.classList.add('solana__button'); claimButton.classList.remove('solana__button-disabled'); } else if (claimButton.textContent == "Claim" && response.form_fulfilled !== '1') { $('#solana_registration').css("display", "flex"); $('#solana_claim_bonus').css("display", "none"); $('#solana_claim_bonus').removeAttr('onclick'); $('#solana_registration').attr('data-bs-toggle', 'modal'); $('#solana_registration').attr('data-bs-target', '#modal_solana'); $('#solana_claim_bonus').prop('disabled', false); claimButton.classList.add('solana__button'); claimButton.classList.remove('solana__button-disabled'); } } if (get_cookie('solanaClaimed') == undefined && response.drift == 1 && response.solblaze == 1 && response.mayan_finance == 1 && response.form_fulfilled == 1) { $("#solana__points__drift").css("display", "flex"); $("#solana__points__solblaze").css("display", "flex"); $("#solana__points__mayan_finance").css("display", "flex"); setTimeout(function() { $('#solana_registration').css("display", "none"); $('#solana_claim_bonus').css("display", "flex"); $('#solana_claim_bonus').removeAttr('data-bs-toggle'); $('#solana_claim_bonus').removeAttr('data-bs-target'); $('#solana_claim_bonus').attr('onclick', 'return btn_click_action(this);'); $('#solana_claim_bonus').prop('disabled', false); claimButton.classList.add('solana__button'); claimButton.classList.remove('solana__button-disabled'); }, 10000); } if (get_cookie('selectedAccount') == '' || get_cookie('selectedAccount') == undefined) { $("#solana__points__mayan_finance").css("display", "none"); $("#solana__points__drift").css("display", "none"); $("#solana__points__solblaze").css("display", "none"); } if (get_cookie('solanaClaimed') !== undefined && get_cookie('solanaClaimed') === "") { $('#notification__desc_solana-all').css('display', 'none'); $('#notification__desc_solana-socialfi-news').css('display', 'none'); } }, error: function(xhr) { console.error(xhr.responseText); } }); } if (get_cookie('solanaClaimed') !== undefined && get_cookie('solanaClaimed') === "") { $('#notification__desc_solana-all').css('display', 'none'); $('#notification__desc_solana-socialfi-news').css('display', 'none'); } async function web3_notification_cards(net) { const contract = new web3mas[net].eth.Contract(eth_abi["buy_tarif"], glob["contracts"]["buy_tarif_"+net]); const descElements = document.querySelectorAll('.notification__desc'); const allHiddenElements = Array.from(descElements).every(element => element.style.display === 'none'); if (allHiddenElements) { const arrivalElement = document.querySelector('.notification__arrival'); const emptyElement = document.querySelector('.notification__empty'); arrivalElement.style.display = 'none'; emptyElement.style.display = 'flex'; } if(!selectedAccount)return false; contract.methods.TarifAddrList(selectedAccount).call(function (err, res) { if (err) { console.log("An error occurred"); console.log(err); return; } for (let i = 58; i <= 62; i++) { if (res[1][i - 1]) { $('#notification__desc_debank-all').css('display', 'none'); $('#notification__desc_debank-news').css('display', 'none'); set_cookie('debank', false); } } for (let i = 15; i <= 20; i++) { if (res[1][i - 1]) { $('#notification__desc_scroll-all').css('display', 'none'); $('#notification__desc_scroll-news').css('display', 'none'); set_cookie('scroll', false); } } for (let i = 122; i <= 127; i++) { if (res[1][i - 1]) { $('#notification__desc_solana-all').css('display', 'none'); $('#notification__desc_solana-news').css('display', 'none'); } } for (let i = 0; i <= 5; i++) { if (res[1][i]) { $('#notification__desc_zksync-all').css('display', 'none'); $('#notification__desc_zksync-news').css('display', 'none'); set_cookie('zksync', false); } } for (let i = 30; i <= 35; i++) { if (res[1][i - 1]) { $('#notification__desc_starknet-all').css('display', 'none'); $('#notification__desc_starknet-news').css('display', 'none'); set_cookie('starknet', false); } } if (get_cookie('solanaClaimed') !== undefined && get_cookie('solanaClaimed') === "") { $('#notification__desc_solana-all').css('display', 'none'); $('#notification__desc_solana-socialfi-news').css('display', 'none'); } }) } async function btn_nick_register() { var x = ""; var y = ""; var a = ""; var r = 0; var id = "nick_buy"; txt = "No action"; var err = ""; if(!err) { if(!selectedAccount || !glob["onConnected"]) { a = "onConnect();"; txt = "Connect Wallet"; err = 1; } } if(!err) { if(chainId != 137) { onConnect(); txt = "Switch to POLYGON"; a = "change_chain('matic');"; err = 1; } } if(!err) { y = document.getElementById('iref_nick'); if(y.value == "") { err = 1; txt = "Insert Nick"; a = "iref_nick_focus();"; } } if(!err) { txt = "Register"; a = "web3_ref_register();"; } x = document.getElementById(id); if(x === null) log("NULL "+id); if(x !== null) if(x.innerHTML != txt) { x.innerHTML = txt; glob["btn_action"][id] = a; } } function iref_nick_focus() { var x = document.getElementById('iref_nick'); x.focus(); } function btn_buy_white_list() { var t; var x; x = document.getElementById('buyModal_name'); t = 'Buy access to white list'; x.innerHTML = t; x = document.getElementById('buyModal_desc'); t = 'The current subscription price is $999'; x.innerHTML = t; tabs_change_active(1); $('#buyModal').modal('show'); } function tabs_change_active(i) { let tabs = document.querySelectorAll('.nav-pills .nav-link'); let tabText = document.querySelectorAll('.tabs .tab'); tabs[i].classList.add('active'); tabText[i].classList.add('active'); for (let m=0; m utime) { clas = "btn btn-success btn-sm"; add_text = " for renewal"; } else { clas = "btn btn-primary btn-sm"; } var err = ""; if(!err) { if(!selectedAccount || !glob["onConnected"]) { a = "onConnect();"; txt = "Connect Wallet"; err = 1; } } if(!err) { if(chainId != chain) { txt = "Switch to "+nchain; a = "change_chain('"+net+"');"; err = 1; clas = "btn btn-secondary btn-sm"; } } if(!err) { x = document.getElementById("modal_circle_balance"); v = x.innerHTML*1; x = document.getElementById("modal_circle_cost"); y = x.innerHTML*1; amount = y * interval; if(v < amount) { err = 1; txt = "Not enough USDT "+amount+" (balance: "+Math.floor(v)+")"; } } if(!err) { x = document.getElementById("modal_circle_inited"); v = x.innerHTML; if(v == "false") { err = 1; txt = "INIT"; a = "web3_circle_init_v41('24_2')"; } } if(!err) { x = document.getElementById("modal_circle_approve"); v = x.innerHTML; if(v == "false") { err = 1; txt = "Approve" + add_text;; a = "web3_distribute_approve_41('"+net+"',6);"; } } if(!err) { x = document.getElementById("modal_circle_distributed"); v = x.innerHTML; if(v == "false" || v == "0") { err = 1; txt = "Distribute"; a = "web3_circle_distribute_v41_matic(2);"; } else { err = 1; txt = "Renew"; a = "web3_circle_distribute_v41_matic(2);"; } } x = document.getElementById(id); if(x === null) log("NULL "+id); if(x !== null) if(x.innerHTML != txt) { x.innerHTML = txt; x.className = clas; glob["btn_action"][id] = a; } } function btn_circle_26_2() { var id2 = "26_2"; var id = "btn_circle_"+id2; var net = ""; var net = "matic"; var x; var y; var v; switch(net) { case "fork": chain = 31337; nchain = "Fork"; break; case "matic": chain = 137; nchain = "Polygon"; break; case "bsc": chain = 56; nchain = "BSC"; break; case "eth": chain = 1; nchain = "Ethereum"; break; case "mumbai": chain = 80001; nchain = "Mumbai"; break; } txt = "No action"; clas = "btn btn-primary btn-sm"; a = ""; var err = ""; if(!err) { x = document.getElementById("modal_circle_distributed"); v = x.innerHTML; x = document.getElementById("modal_circle_inited"); y = x.innerHTML; if(v == "true" && y == "true") { err = 1; a = ""; txt = "Everything is fine. Expect a circle"; clas = "btn btn-success btn-sm"; } } if(!err) { if(!selectedAccount || !glob["onConnected"]) { a = "onConnect();"; txt = "Connect Wallet"; err = 1; } } if(!err) { if(chainId != chain) { txt = "Switch to "+nchain; a = "change_chain('"+net+"');"; err = 1; clas = "btn btn-secondary btn-sm"; } } if(!err) { x = document.getElementById("modal_circle_balance"); v = x.innerHTML*1; x = document.getElementById("modal_circle_cost"); y = x.innerHTML*1; if(v < y) { err = 1; txt = "Not enough USDT (need "+y+")"; } } if(!err) { x = document.getElementById("modal_circle_inited"); v = x.innerHTML; if(v == "false") { err = 1; txt = "INIT"; a = "web3_circle_init_v02('"+id2+"');"; } } if(!err) { x = document.getElementById("modal_circle_approve"); v = x.innerHTML; x = document.getElementById("modal_circle_cost"); y = x.innerHTML*1; if(v == "false") { add_text = " "+y+" USDT"; err = 1; txt = "Approve" + add_text;; a = "web3_distribute_approve_matic();"; } } if(!err) { x = document.getElementById("modal_circle_distributed"); v = x.innerHTML; x = document.getElementById("modal_circle_cost"); y = x.innerHTML*1; if(v == "false") { add_text = " "+y+" USDT"; err = 1; txt = "Distribute" + add_text;; a = "web3_circle_distribute_v02_matic(2);"; } } x = document.getElementById(id); if(x === null) log("NULL "+id); if(x !== null) if(x.innerHTML != txt) { x.innerHTML = txt; x.className = clas; glob["btn_action"][id] = a; } } function btn_circle_9_2() { var net = "bsc"; var x; var y; var v; switch(net) { case "fork": chain = 31337; nchain = "Fork"; break; case "matic": chain = 137; nchain = "Polygon"; break; case "bsc": chain = 56; nchain = "BSC"; break; case "eth": chain = 1; nchain = "Ethereum"; break; case "mumbai": chain = 80001; nchain = "Mumbai"; break; } var id = "btn_circle_9_2"; txt = "No action"; clas = "btn btn-primary btn-sm"; a = ""; var err = ""; if(!err) { x = document.getElementById("modal_circle_distributed"); v = x.innerHTML; x = document.getElementById("modal_circle_inited"); y = x.innerHTML; if(v == "true" && y == "true") { err = 1; a = ""; txt = "Everything is fine. Expect a circle"; clas = "btn btn-success btn-sm"; } } if(!err) { if(!selectedAccount || !glob["onConnected"]) { a = "onConnect();"; txt = "Connect Wallet"; err = 1; } } if(!err) { if(chainId != chain) { txt = "Switch to "+nchain; a = "change_chain('"+net+"');"; err = 1; clas = "btn btn-secondary btn-sm"; } } if(!err) { x = document.getElementById("modal_circle_balance"); v = x.innerHTML*1; x = document.getElementById("modal_circle_cost"); y = x.innerHTML*1; if(v < y) { err = 1; txt = "Not enough USDT"; } } if(!err) { x = document.getElementById("modal_circle_inited"); v = x.innerHTML; if(v == "false") { err = 1; txt = "INIT"; a = "web3_circle_init_v02('9_2')"; } } if(!err) { x = document.getElementById("modal_circle_approve"); v = x.innerHTML; if(v == "false") { err = 1; txt = "Approve"; a = "web3_distribute_approve();"; } } if(!err) { x = document.getElementById("modal_circle_distributed"); v = x.innerHTML; if(v == "false") { err = 1; txt = "Distribute"; a = "web3_circle_distribute_v02(2);"; } } x = document.getElementById(id); if(x === null) log("NULL "+id); if(x !== null) if(x.innerHTML != txt) { x.innerHTML = txt; x.className = clas; glob["btn_action"][id] = a; } } function btn_modal_circle_add_gas() { $('#modal_circle_add_gas').modal('show'); } function btn_ref_claim20() { var net = "bsc"; var x; var y; var v; var cost = 100; switch(net) { case "fork": chain = 31337; nchain = "Fork"; break; case "matic": chain = 137; nchain = "Polygon"; break; case "bsc": chain = 56; nchain = "BSC"; break; case "eth": chain = 1; nchain = "Ethereum"; break; case "mumbai": chain = 80001; nchain = "Mumbai"; break; } var id = "ref_claim20"; txt = "No action"; clas = "art-button-3 btn btn-primary btn-sm ref_claim20"; a = ""; var err = ""; if(!err) { if(!selectedAccount || !glob["onConnected"]) { a = "onConnect();"; txt = "Connect Wallet"; err = 1; } } if(!err) { if(chainId != chain) { txt = "Switch to "+nchain; a = "change_chain('"+net+"');"; err = 1; clas = "art-button-3 btn btn-secondary btn-sm ref_claim20"; } } if(!err) { err = 1; txt = "Claim \$"+cost; a = "web3_ref_claim20_2('"+net+"','"+cost+"');"; } x = document.getElementById(id); if(x === null) log("NULL "+id); if(x !== null) if(x.innerHTML != txt) { x.innerHTML = txt; x.className = clas; glob["btn_action"][id] = a; } } function btn_ref_claim100() { var net = "bsc"; var x; var y; var v; var item; var cost = 25; var addons = ""; switch(net) { case "fork": chain = 31337; nchain = "Fork"; break; case "matic": chain = 137; nchain = "Polygon"; break; case "bsc": chain = 56; nchain = "BSC"; break; case "eth": chain = 1; nchain = "Ethereum"; break; case "mumbai": chain = 80001; nchain = "Mumbai"; break; } var id = "btn_claim_get100"; x = document.getElementById(id); txt = "No action"; clas = "art-button-3 btn btn-primary btn-sm claim-btn"; a = ""; var err = ""; v = get_cookie("get100_item"); if(!err) { if(v == 1 || v == 2 || v == 3 || v == 4) { item = v; switch(item+"") { case "1": addons = "email confirm"; break; case "2": addons = "twitter follow"; break; case "3": addons = "twitter retweet"; break; case "4": addons = "telegram confirm"; break; } } else { err = 1; txt = "Please, select one of the options"; } } if (!err) { var claimed_steps = get_cookie("get100_claimed"); if (claimed_steps) { claimed_steps = claimed_steps.split(','); if (claimed_steps.includes(v)) { txt = "Claimed"; clas = "art-button-3 btn btn-primary btn-sm claim-btn green-btn"; err = 1; } } } if(!err) { if(!selectedAccount || !glob["onConnected"]) { a = "onConnect();"; txt = "Connect Wallet"; err = 1; } } if(!err) { if(chainId != chain) { txt = "Switch to "+nchain; a = "change_chain('"+net+"');"; err = 1; clas = "art-button-3 btn btn-primary btn-sm claim-btn"; } } if(!err) { err = 1; txt = "Claim \$"+cost+" - "+addons; a = "web3_ref_claim_get100_GetSign("+item+");"; } if(x !== null) if(x.innerHTML != txt) { x.innerHTML = txt; x.className = clas; glob["btn_action"][id] = a; } } function btn_ref_claim_tonapp1() { var net = "bsc"; var x; var y; var v; var cost = 100; switch(net) { case "fork": chain = 31337; nchain = "Fork"; break; case "matic": chain = 137; nchain = "Polygon"; break; case "bsc": chain = 56; nchain = "BSC"; break; case "eth": chain = 1; nchain = "Ethereum"; break; case "mumbai": chain = 80001; nchain = "Mumbai"; break; } var id = "ref_claim_tonapp1"; txt = "No action"; clas = "art-button-3 btn btn-primary btn-sm ref_claim20"; a = ""; var err = ""; if(!err) { if(!selectedAccount || !glob["onConnected"]) { a = "onConnect();"; txt = "Connect Wallet"; err = 1; } } if(!err) { if(chainId != chain) { txt = "Switch to "+nchain; a = "change_chain('"+net+"');"; err = 1; clas = "art-button-3 btn btn-secondary btn-sm ref_claim20"; } } if(!err && glob["dapp_tonapp1_status"] && !glob["dapp_tonapp1_code"]) { err = 1; txt = "Waiting confirmation (~1min)"; tonapp1_send_status_set(4,"Confirmed"); } if(!err && glob["dapp_tonapp1_status"] && glob["dapp_tonapp1_code"]) { err = 1; txt = "Claim Points"; a = "tonapp1_return();"; let tonAppCodeContainer = document.querySelector(".tonapptask_code_container"); if(tonAppCodeContainer) { tonAppCodeContainer.style.display = "block"; } let tonAppCode = document.getElementById("code_copy"); if(tonAppCode) { tonAppCode.value = glob["dapp_tonapp1_code"]; } } if(!err) { err = 1; txt = "Claim \$"+cost+" on DEPO"; a = "web3_ref_claim_tonapp1('"+net+"','"+cost+"');"; } x = document.getElementById(id); if(x === null) log("NULL "+id); if(x !== null) if(x.innerHTML != txt) { x.innerHTML = txt; x.className = clas; glob["btn_action"][id] = a; } } function getCompletedTasks() { const tasks = localStorage.getItem('completedTasks2'); return tasks ? JSON.parse(tasks) : []; } function saveTaskAsCompleted(taskId) { let completedTasks = getCompletedTasks(); if (!completedTasks.includes(taskId)) { completedTasks.push(taskId); localStorage.setItem('completedTasks2', JSON.stringify(completedTasks)); } } function displayCompletedTasks() { const completedTasks = getCompletedTasks(); completedTasks.forEach(taskId => { const taskElement = document.querySelector(`#${taskId} .tg_app__points__tariffs__circle-painted-approved`); if (taskElement) { taskElement.classList.remove('d-none'); } }); } function clickOnTask(taskId) { setTimeout(() => { const taskElement = document.querySelector(`#${taskId} .tg_app__points__tariffs__circle-painted-approved`); if (taskElement) { taskElement.classList.remove('d-none'); saveTaskAsCompleted(taskId); } }, 3000); } displayCompletedTasks(); async function btn_refill_buy(net,coin) { var cost; var chain; var nchain; var x = ""; var y = ""; var a = ""; var r = 0; var id = net+"_refill_"+coin; txt = "No action"; var err = ""; x = document.getElementById('modal_refill_amount'); cost = x.innerHTML*1; switch(net) { case "fork": chain = 31337; nchain = "Fork"; break; case "matic": chain = 137; nchain = "Polygon"; break; case "bsc": chain = 56; nchain = "BSC"; break; case "eth": chain = 1; nchain = "Ethereum"; break; case "arbitrum": chain = 42161; nchain = "Arbitrum"; break; case "arbitrum-nova": chain = 42170; nchain = "Arbitrum Nova"; break; case "avalanche": chain = 43114; nchain = "Avalanche"; break; case "optimism": chain = 10; nchain = "Optimism"; break; case "polygon_zkevm": chain = 1101; nchain = "Polygon zkEVM"; break; case "zksync": chain = 324; nchain = "zkSync"; break; case "mumbai": chain = 80001; nchain = "Mumbai"; break; case "goerli": chain = 5; nchain = "Goerli"; break; } if(!err) { if(!selectedAccount || !glob["onConnected"]) { a = "onConnect();"; txt = "Connect Wallet"; err = 1; } } if(!err) { if(chainId != chain) { txt = "Switch to "+nchain; a = "change_chain('"+net+"');"; err = 1; } } if(!err) { if(glob["balance"][net+"_b_"+coin]*1 < cost) { err = 1; txt = "Not enough"; } } if(!err) { if(glob["balance"][net+"_a_"+coin]*1 < cost) { err = 1; txt = "Approve"; a = "web3_refill2_approve("+cost+",'"+coin+"','"+net+"','"+glob["balance"][net+"_d_"+coin]+"')"; } } if(!err) { txt = "Pay"; a = "web3_refill2_pay('"+net+"','"+coin+"','"+cost+"');"; } x = document.getElementById(id); if(x === null) log("NULL "+id); if(x !== undefined) if(x.innerHTML != txt) x.innerHTML = txt; if(glob["btn_action"][id] != a) glob["btn_action"][id] = a; } async function btn_refill_buy_ddao1(net,coin) { var cost; var k; var chain; var nchain; var x = ""; var y = ""; var a = ""; var r = 0; var t; var id = net+"_refill_"+coin; x = document.getElementById(id); if(x === undefined || x === null)return false; txt = "No action"; var err = ""; switch(net) { case "fork": chain = 31337; nchain = "Fork"; break; case "matic": chain = 137; nchain = "Polygon"; break; case "bsc": chain = 56; nchain = "BSC"; break; case "eth": chain = 1; nchain = "Ethereum"; break; case "arbitrum": chain = 42161; nchain = "Arbitrum"; break; case "arbitrum-nova": chain = 42170; nchain = "Arbitrum Nova"; break; case "avalanche": chain = 43114; nchain = "Avalanche"; break; case "optimism": chain = 10; nchain = "Optimism"; break; case "polygon_zkevm": chain = 1101; nchain = "Polygon zkEVM"; break; case "zksync": chain = 324; nchain = "zkSync"; break; case "mumbai": chain = 80001; nchain = "Mumbai"; break; case "goerli": chain = 5; nchain = "Goerli"; break; } if(!err) { if(!selectedAccount || glob["onConnected"]===undefined) { a = "onConnect();"; txt = "Connect Wallet"; err = 1; } } if(!err) { if(chainId != chain) { txt = "Switch to "+nchain; a = "change_chain('"+net+"');"; err = 1; } } k = coin+"_ddao"; cost = glob["balance"][net+"_c_"+k]; if(cost === undefined)err = "no cost"; cost = Math.ceil(cost); if(!err) { t = glob["balance"][net+"_b_"+k]*1; if(t < cost) { err = 1; txt = "Not enough "+t+"/"+cost; } } if(!err) { if(glob["balance"][net+"_a_"+k]*1 < cost) { err = 1; txt = "Approve DDAO"; a = "web3_refill5_approve("+cost+",'"+coin+"','"+net+"','"+glob["balance"][net+"_d_"+k]+"')"; } } if(!err) { txt = "Pay "+Math.ceil(cost)+" DDAO"; a = "web3_refill5_pay('"+net+"','"+coin+"','"+cost+"');"; } x = document.getElementById(id); if(x === null) log("NULL "+id); if(x !== undefined) if(x.innerHTML != txt) x.innerHTML = txt; if(glob["btn_action"][id] != a) glob["btn_action"][id] = a; } async function btn_refill_buy_ddao2(net,coin,coin2="usdt") { var cost; var k; var k2; var chain; var nchain; var x = ""; var y = ""; var a = ""; var r = 0; var t; var id = net+"_refill_"+coin; x = document.getElementById(id); if(x === undefined || x === null)return false; txt = "No action"; var err = ""; switch(net) { case "fork": chain = 31337; nchain = "Fork"; break; case "matic": chain = 137; nchain = "Polygon"; break; case "bsc": chain = 56; nchain = "BSC"; break; case "eth": chain = 1; nchain = "Ethereum"; break; case "arbitrum": chain = 42161; nchain = "Arbitrum"; break; case "arbitrum-nova": chain = 42170; nchain = "Arbitrum Nova"; break; case "avalanche": chain = 43114; nchain = "Avalanche"; break; case "optimism": chain = 10; nchain = "Optimism"; break; case "polygon_zkevm": chain = 1101; nchain = "Polygon zkEVM"; break; case "zksync": chain = 324; nchain = "zkSync"; break; case "mumbai": chain = 80001; nchain = "Mumbai"; break; case "goerli": chain = 5; nchain = "Goerli"; break; } if(!err) { if(!selectedAccount || glob["onConnected"]===undefined) { a = "onConnect();"; txt = "Connect Wallet"; err = 1; } } if(!err) { if(chainId != chain) { txt = "Switch to "+nchain; a = "change_chain('"+net+"');"; err = 1; } } k = coin+"_ddao"; k2 = coin+"_usdt"; x = document.getElementById('modal_refill_amount'); cost = x.innerHTML; if(cost === undefined)err = "no cost"; cost = Math.ceil(cost); if(!err) { t = glob["balance"][net+"_b_"+k2]*1; if(t < cost) { err = 1; txt = "Not enough "+t+"/"+cost; } } if(!err) { if(glob["balance"][net+"_a_"+k2]*1 < cost) { err = 1; txt = "Approve USDT"; a = "web3_refill6_approve("+cost+",'"+coin2+"','"+net+"','"+glob["balance"][net+"_d_"+k2]+"')"; } } if(!err) { txt = "Pay "+cost+" USDT"; a = "web3_refill6_pay('"+net+"','"+coin2+"','"+cost+"');"; } x = document.getElementById(id); if(x === null) log("NULL "+id); if(x !== undefined) if(x.innerHTML != txt) x.innerHTML = txt; if(glob["btn_action"][id] != a) glob["btn_action"][id] = a; } async function btn_refillai_buy(net,coin) { var cost; var chain; var nchain; var x = ""; var y = ""; var a = ""; var r = 0; var id = net+"_refillai_"+coin; txt = "No action"; var err = ""; x = document.getElementById('ai_card_deposit_amount'); cost = x.innerHTML*1; switch(net) { case "fork": chain = 31337; nchain = "Fork"; break; case "matic": chain = 137; nchain = "Polygon"; break; case "bsc": chain = 56; nchain = "BSC"; break; case "eth": chain = 1; nchain = "Ethereum"; break; case "arbitrum": chain = 42161; nchain = "Arbitrum"; break; case "arbitrum-nova": chain = 42170; nchain = "Arbitrum Nova"; break; case "avalanche": chain = 43114; nchain = "Avalanche"; break; case "optimism": chain = 10; nchain = "Optimism"; break; case "polygon_zkevm": chain = 1101; nchain = "Polygon zkEVM"; break; case "zksync": chain = 324; nchain = "zkSync"; break; case "mumbai": chain = 80001; nchain = "Mumbai"; break; case "goerli": chain = 5; nchain = "Goerli"; break; } if(!err) { if(!selectedAccount || !glob["onConnected"]) { a = "onConnect();"; txt = "Connect Wallet"; err = 1; } } if(!err) { if(glob["refillai_status"]) { err = 1; txt = "Already purchased"; } } if(!err) { if(chainId != chain) { txt = "Switch to "+nchain; a = "change_chain('"+net+"');"; err = 1; } } if(!err) { if(glob["balance"][net+"_b_"+coin]*1 < cost || !glob["balance"][net+"_b_"+coin]*1) { err = 1; txt = "Not enough"; } } if(!err) { if(glob["balance"][net+"_a_"+coin]*1 < cost) { err = 1; txt = "Approve"; a = "web3_refillai_approve("+cost+",'"+coin+"','"+net+"','"+glob["balance"][net+"_d_"+coin]+"')"; } } if(!err) { txt = "Pay"; a = "web3_refillai_pay('"+net+"','"+coin+"','"+cost+"');"; } x = document.getElementById(id); if(x === null) log("NULL "+id); if(x !== undefined) if(x.innerHTML != txt) x.innerHTML = txt; if(glob["btn_action"][id] != a) glob["btn_action"][id] = a; } glob["page_hartbeat_aiclaim1"] = 0;; function search_btn_aicard1_claim() { var x = document.getElementById('btn_aicard1_claim'); if(x !== null) { glob["page_hartbeat_aiclaim1"]++; if(glob["page_hartbeat_aiclaim1"]==1) { web3_claimai1_info(); } btn_claimai1(); if(glob["page_hartbeat_aiclaim1"] >= 5) glob["page_hartbeat_aiclaim1"] = 0; } } setInterval(search_btn_aicard1_claim,1000); async function btn_claimai1() { var cost; var chain; var net = "matic"; var nchain; var x = ""; var y = ""; var a = ""; var r = 0; var id = 'btn_aicard1_claim'; txt = "No action"; var err = ""; switch(net) { case "fork": chain = 31337; nchain = "Fork"; break; case "matic": chain = 137; nchain = "Polygon"; break; case "bsc": chain = 56; nchain = "BSC"; break; case "eth": chain = 1; nchain = "Ethereum"; break; case "arbitrum": chain = 42161; nchain = "Arbitrum"; break; case "arbitrum-nova": chain = 42170; nchain = "Arbitrum Nova"; break; case "avalanche": chain = 43114; nchain = "Avalanche"; break; case "optimism": chain = 10; nchain = "Optimism"; break; case "polygon_zkevm": chain = 1101; nchain = "Polygon zkEVM"; break; case "zksync": chain = 324; nchain = "zkSync"; break; case "mumbai": chain = 80001; nchain = "Mumbai"; break; case "goerli": chain = 5; nchain = "Goerli"; break; } if(!err) { if(!selectedAccount || !glob["onConnected"]) { a = "onConnect();"; txt = "Connect Wallet"; err = 1; } } if(!err) { if(glob["claimai1"].status == 1) { err = 1; txt = "Already claimed "+glob["claimai1"].amount+" USDT"; } } if(!err) { if(chainId != chain) { txt = "Switch to "+nchain; a = "change_chain('"+net+"');"; err = 1; } } if(!err) { if(glob["claimai1"].status == 2) { err = 1; txt = "Claim "+glob["claimai1"].amount+" USDT"; a = "web3_claimai1_claim();"; } } x = document.getElementById(id); if(x === null) log("NULL "+id); if(x !== undefined) if(x.innerHTML != txt) x.innerHTML = txt; if(glob["btn_action"][id] != a) glob["btn_action"][id] = a; } glob["page_hartbeat_aiclaim2"] = 0; function search_btn_aicard2_claim() { var x = document.getElementById('btn_aicard2_claim'); if(x !== null) { glob["page_hartbeat_aiclaim2"]++; if(glob["page_hartbeat_aiclaim2"]==1) { web3_claimai2_info(); } btn_claimai2(); if(glob["page_hartbeat_aiclaim2"] >= 5) glob["page_hartbeat_aiclaim2"] = 0; } } setInterval(search_btn_aicard2_claim,1000); async function btn_claimai2() { var cost; var chain; var net = "matic"; var nchain; var x = ""; var y = ""; var a = ""; var r = 0; var id = 'btn_aicard2_claim'; txt = "No action"; var err = ""; switch(net) { case "fork": chain = 31337; nchain = "Fork"; break; case "matic": chain = 137; nchain = "Polygon"; break; case "bsc": chain = 56; nchain = "BSC"; break; case "eth": chain = 1; nchain = "Ethereum"; break; case "arbitrum": chain = 42161; nchain = "Arbitrum"; break; case "arbitrum-nova": chain = 42170; nchain = "Arbitrum Nova"; break; case "avalanche": chain = 43114; nchain = "Avalanche"; break; case "optimism": chain = 10; nchain = "Optimism"; break; case "polygon_zkevm": chain = 1101; nchain = "Polygon zkEVM"; break; case "zksync": chain = 324; nchain = "zkSync"; break; case "mumbai": chain = 80001; nchain = "Mumbai"; break; case "goerli": chain = 5; nchain = "Goerli"; break; } if(!err) { if(!selectedAccount || !glob["onConnected"]) { a = "onConnect();"; txt = "Connect Wallet"; err = 1; } } if(!err) { if(glob["claimai2"].status == 1) { err = 1; txt = "Already claimed "+glob["claimai2"].amount+" USDT"; } } if(!err) { if(chainId != chain) { txt = "Switch to "+nchain; a = "change_chain('"+net+"');"; err = 1; } } if(!err) { if(glob["claimai2"].status == 2) { err = 1; txt = "Claim "+glob["claimai2"].amount+" USDT"; a = "web3_claimai2_claim();"; } } x = document.getElementById(id); if(x === null) log("NULL "+id); if(x !== undefined) if(x.innerHTML != txt) x.innerHTML = txt; if(glob["btn_action"][id] != a) glob["btn_action"][id] = a; } async function btn_nft_buy(net,coin) { var cost; var chain; var nchain; var x = ""; var y = ""; var a = ""; var r = 0; var id = net+"_buynft_"+coin; txt = "No action"; var err = ""; x = document.getElementById('nft_card_deposit_amount'); cost = x.innerHTML*1; switch(net) { case "fork": chain = 31337; nchain = "Fork"; break; case "matic": chain = 137; nchain = "Polygon"; break; case "bsc": chain = 56; nchain = "BSC"; break; case "eth": chain = 1; nchain = "Ethereum"; break; case "arbitrum": chain = 42161; nchain = "Arbitrum"; break; case "arbitrum-nova": chain = 42170; nchain = "Arbitrum Nova"; break; case "avalanche": chain = 43114; nchain = "Avalanche"; break; case "optimism": chain = 10; nchain = "Optimism"; break; case "polygon_zkevm": chain = 1101; nchain = "Polygon zkEVM"; break; case "zksync": chain = 324; nchain = "zkSync"; break; case "mumbai": chain = 80001; nchain = "Mumbai"; break; case "goerli": chain = 5; nchain = "Goerli"; break; } if(!err) { if(!selectedAccount || !glob["onConnected"]) { a = "onConnect();"; txt = "Connect Wallet"; err = 1; } } if(!err) { if(chainId != chain) { txt = "Switch to "+nchain; a = "change_chain('"+net+"');"; err = 1; } } if(!err) { if(glob["balance"][net+"_nft_quantity"]>0) { err = 1; txt = "Already has a NFT key"; } } if(!err) { if(glob["balance"][net+"_b_"+coin]*1 < cost) { err = 1; txt = "Not enough"; } } if(!err) { if(glob["balance"][net+"_a_"+coin]*1 < cost) { err = 1; txt = "Approve"; a = "web3_nftbuy_approve("+cost+",'"+coin+"','"+net+"','"+glob["balance"][net+"_d_"+coin]+"')"; } } if(!err) { txt = "Pay"; a = "web3_nftbuy_pay('"+net+"','"+coin+"','"+cost+"');"; } x = document.getElementById(id); if(x === null) log("NULL "+id); if(x !== undefined) if(x.innerHTML != txt) x.innerHTML = txt; if(glob["btn_action"][id] != a) glob["btn_action"][id] = a; } function btn_governance_add() { $('#modal_governance').modal('show'); } function btn_gov() { var net; var tkn; var pos2; var pos; var i; var x; var y; var l; var v; y = document.getElementsByClassName("btn-gov"); l = y.length; for(i=0;i=0;i--) { t = res[2][i]; pos = t.indexOf("|"); tkn = t.substr(0,pos); t = t.substr(pos+1); pos = t.indexOf("|"); decimal = t.substr(0,pos); t = t.substr(pos+1); pos = t.indexOf("|"); symbol = t.substr(0,pos); t = t.substr(pos+1); pos = t.indexOf("|"); snap = t.substr(0,pos); t = t.substr(pos+1); pos = t.indexOf("|"); holders = t.substr(0,pos); t = t.substr(pos+1); amount = res[3][i]; amount /= 10**decimal; claimed = res[4][i]; claimed /= 10**decimal; type_text = "Live"; if(res[5][i]) { type_text = "Hidden"; } if(res[6][i]) { type_text = "Closed"; } if(res[5][i]) type = "tape-ended"; else type = "tape-live"; if(res[5][i] && !glob["governance"]["admin"])continue; symbol = symbol.replace("DEV",""); symbol = symbol.replace("WETH","ETH"); o += "
"+decimal+"
";; o += "
"; o += "
"; o += "
"; o += "
"; o += "
"; o += " "; o += " "; o += symbol; o += "
"; o += "
"; o += "
"; o += "
"; o += "
"; o += "
"; o += "
"; o += "Your amount"; o += "
"; o += "
"; o += "-"; o += "
"; o += "
"; o += "
"; o += "
"; o += "
"; o += "
"; o += "Already Claimed"; o += "
"; o += "
"; o += "-"; o += "
"; o += "
"; o += "
"; o += "
"; o += ""; o += "
"; o += ""; o += "
"; o += ""+type_text+""; o += "
"; o += ""; o += "
"; o += "
"; o += "
"; o += "
"; o += "
"; o += "
"; o += "
Total amount:
"; o += "
"; o += amount; o += "
"; o += "
"; o += "
"; o += "
Total claimed:
"; o += "
"; o += claimed; o += "
"; o += "
"; o += ""; o += "
"; o += "
"; o += ""; o += "
"; o += "
"; o += "
"; o += "
Holders:
"; o += "
"; o += holders; o += "
"; o += "
"; o += "
"; o += "
Date:
"; o += "
"; o += utime_to_localtime(res[1][i]); o += "
"; o += "
"; o += ""; o += "
"; o += "
"; o += ""; o += "
"; o += "
"; if(!res[6][i]) { o += ""; } if(glob["governance"]["admin"]) { if(!res[6][i]) { o += " "; } if(res[5][i]) { o += " "; } else { o += " "; } } o += "
"; o += "
"; o += "
"; o += "
"; o += "
"; o += "
"; } return o; } function gov_rew_list_tbl2(l,res) { var type_text; var type; var o = ''; var i; var t; var pos; var pos2 = 0; var tkn; var symbol; var decimal; var snap; var holders; var amount; var claimed; for(i=l-1;i>=33;i--) { t = res[2][i]; pos = t.indexOf("|"); tkn = t.substr(0,pos); t = t.substr(pos+1); pos = t.indexOf("|"); decimal = t.substr(0,pos); t = t.substr(pos+1); pos = t.indexOf("|"); symbol = t.substr(0,pos); t = t.substr(pos+1); pos = t.indexOf("|"); snap = t.substr(0,pos); t = t.substr(pos+1); pos = t.indexOf("|"); holders = t.substr(0,pos); t = t.substr(pos+1); amount = res[3][i]; amount /= 10**decimal; claimed = res[4][i]; claimed /= 10**decimal; type_text = "Live"; if(res[5][i]) { type_text = "Hidden"; } if(res[6][i]) { type_text = "Closed"; } if(res[5][i]) type = "tape-ended"; else type = "tape-live"; if(res[5][i] && !glob["governance"]["admin"])continue; symbol = symbol.replace("DEV",""); symbol = symbol.replace("WETH","ETH"); o += "
"+decimal+"
";; o += "
"; o += "
"; o += "
"; o += "
"; o += "
"; o += " "; o += " "; o += symbol; o += "
"; o += "
"; o += "
"; o += "
"; o += "
"; o += "
"; o += "
"; o += "Your amount"; o += "
"; o += "
"; o += "-"; o += "
"; o += "
"; o += "
"; o += "
"; o += "
"; o += "
"; o += "Already Claimed"; o += "
"; o += "
"; o += "-"; o += "
"; o += "
"; o += "
"; o += "
"; o += ""; o += "
"; o += ""; o += "
"; o += ""+type_text+""; o += "
"; o += ""; o += "
"; o += "
"; o += "
"; o += "
"; o += "
"; o += "
"; o += "
"; o += "
"; o += amount; o += "
"; o += "
"; o += "
Hunt balance:
"; o += "
"; o += '0'; o += "
"; o += "
"; o += "
"; o += "
Total claimed:
"; o += "
"; o += claimed; o += "
"; o += "
"; o += ""; o += "
"; o += "
"; o += ""; o += "
"; o += "
"; o += "
"; o += "
Holders:
"; o += "
"; o += holders; o += "
"; o += "
"; o += "
"; o += "
Date:
"; o += "
"; o += utime_to_localtime(res[1][i]); o += "
"; o += "
"; o += ""; o += "
"; o += "
"; o += ""; o += "
"; o += "
"; if(!res[6][i]) { o += ""; } if(glob["governance"]["admin"]) { if(!res[6][i]) { o += " "; } if(res[5][i]) { o += " "; } else { o += " "; } } o += "
"; o += "
"; o += "
"; o += "
"; o += "
"; o += "
"; } return o; } function btn_modal_circle_detail() { $('#modal_circle_detail').modal('show'); } function check_points() { var url = "/" + "points_system"; console.log("check_points: "+url); ajax_get_data(url,"check_and_update_points(xhr.response);"); } function check_and_update_points(data) { var params = JSON.parse(data); if (params.points !== undefined) { points_amount = params.points; } else { points_amount = 0; } var points_button = document.getElementById('points_amount'); points_button.innerText = points_amount; } function click_daily_reward() { var url = "/" + "daily_reward"; console.log("click_daily_reward: "+url); notes = document.querySelector('.ogc_notes'); const errorElement = notes.querySelector('.points_message'); if (errorElement) { errorElement.remove(); } $.ajax({ url: url, method: 'POST', success: function(response) { params = JSON.parse(response); console.log(params); if (selectedAccount !== undefined && selectedAccount !== '') { if (params == "Claim once per 24 hours") { const toastPopup = document.getElementById('toastPopup'); if (toastPopup) { const toastBootstrap = bootstrap.Toast.getOrCreateInstance(toastPopup); const toastText = document.querySelector('.toastText'); toastText.textContent = params; toastBootstrap.show(); } } else if (params == "Rewarded first time!") { setTimeout(check_points, 300); anim.goToAndPlay(0); } else { const toastPopup = document.getElementById('toastPopup'); setTimeout(check_points, 300); if (toastPopup) { const toastBootstrap = bootstrap.Toast.getOrCreateInstance(toastPopup); const toastText = document.querySelector('.toastText'); toastText.textContent = "Done! Check points now"; toastBootstrap.show(); } } } else { const toastPopup = document.getElementById('toastPopup'); if (toastPopup) { const toastBootstrap = bootstrap.Toast.getOrCreateInstance(toastPopup); const toastText = document.querySelector('.toastText'); toastText.textContent = "Please, connect your wallet!"; toastBootstrap.show(); } } }, error: function(xhr) { console.error(xhr.responseText); } }); } function ajax_update_points() { var url = "/" + "points_amount"; console.log("ajax_update_points: "+url); ajax_get_data(url, "update_points(xhr.response);"); } function update_points(data) { var params = JSON.parse(data); if (params == true && window.location.pathname === '/points') { $("#OGC__points__daily_ogc_reward").css("display", "flex"); } } function points_system() { console.log("points_system"); if (selectedAccount !== undefined && selectedAccount !== '') { console.log("Start"); ajax_update_points(); check_points(); } } function add_deposit_points() { var url = "/" + "points_from_deposit"; console.log("add_deposit_points: "+url); $.ajax({ url: url, method: 'POST', success: function(response) { params = JSON.parse(response); }, error: function(xhr) { console.error(xhr.responseText); } }); } function add_100_points() { var url = "/" + "points_from_task_100"; console.log("add_100_points: "+url); $.ajax({ url: url, method: 'POST', success: function(response) { params = JSON.parse(response); }, error: function(xhr) { console.error(xhr.responseText); } }); } var modalPointsEl = document.getElementById('modal_points'); modalPointsEl.addEventListener('show.bs.modal', function (event) { points_system(); }); glob["times_load_ref_balance"] = 0; function load_ref_balance() { if(selectedAccount != "") { if(glob["times_load_ref_balance"] == 1) { web3_ref_balance("matic"); web3_ref_balance("bsc"); web3_ref_balance("eth"); web3_whitelists_balance("matic"); web3_whitelists_balance("bsc"); web3_tarif_addr_list("matic"); web3_tarif_addr_list("bsc"); web3_notification_cards("matic"); web3_notification_cards("bsc"); } glob["times_load_ref_balance"]++; if(glob["times_load_ref_balance"] > 100) glob["times_load_ref_balance"] = 0; } } setInterval(load_ref_balance,100); function access_balance_summary() { var t; var v = 0; if(glob["access_balance"]["matic"] !== undefined) v += glob["access_balance"]["matic"]; if(glob["access_balance"]["bsc"] !== undefined) v += glob["access_balance"]["bsc"]; if(glob["access_balance"]["eth"] !== undefined) v += glob["access_balance"]["eth"]; n = "access_balance"; t = get_cookie(n); if(t != v) { set_by_className(n,v); set_cookie(n,v); } } function access_balance_from_cookie() { var n = "access_balance"; var v; v = get_cookie(n); if(v !== undefined) set_by_className(n,v); } access_balance_from_cookie(); function set_by_className(c,v) { var i; var l; var x; var y; x = document.getElementsByClassName(c); l = x.length; for(i=0;i { dataURL = canvas.toDataURL(); x = document.getElementById('modal_support_img'); x.value = dataURL; }); const walletInput = document.querySelector("#modal_support_wallet"); const contactsInput = document.querySelector("#modal_support_contacts"); const descriptionInput = document.querySelector("#modal_support_message"); walletInput.setAttribute("required", ""); contactsInput.setAttribute("required", ""); descriptionInput.setAttribute("required", ""); } async function support_success_click(e) { e.preventDefault(); const walletInputValue = document.querySelector("#modal_support_wallet").value; const contactsInputValue = document.querySelector("#modal_support_contacts").value; const descriptionInputValue = document.querySelector("#modal_support_message").value; try { const response = await fetch("https://api-dap.airdrop-hunter.site/support/", { method: "post", mode: 'cors', headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' }, body: JSON.stringify({ wallet: walletInputValue, contact: contactsInputValue, msg: descriptionInputValue }) }); if (response.ok) { $('#modal_support').modal('hide'); $('#modal_support_success').modal('show'); } else { throw new Error('Failed to send support request'); } } catch (error) { console.error('Error:', error); $('#modal_support').modal('hide'); $('#modal_support_error').modal('show'); } } function support_submit() { $('#modal_support').modal('hide'); $('#modal_support_success').modal('show'); } glob["tarif_wallet_list"] = new Array(); function wallet_list(addr,tarif) { console.log("wallet_list load addr: "+addr+" tarif: "+tarif); var url = glob["api-dap"]+"wallets_list/"+btoa(addr)+"/"+tarif; ajax_get_data(url,"wallet_list_load(xhr.response);"); } function wallet_list_load(data) { params = JSON.parse(data); if(params.status == 1) { glob["tarif_wallet_list"] = params.result; } else { glob["tarif_wallet_list"] = []; } } function btn_buy_refill() { $('#accountModal').modal('hide'); $('#buy_refill_modal').modal('show'); } function btn_buy_refill2() { const bonusModul = document.querySelector("#bonus-modal-en"); bonusModul.style.opacity = 0; bonusModul.style.visibility = "hidden"; $('#buy_refill_modal').modal('show'); } function refill_amount_change(e) { var x; var id = e.id; var id2 = id.replace("refill_amount_",""); const depositPointsDesc = document.querySelector('#deposit_amount'); console.log("Clicked: "+id2); glob["modal_hartbeat"] = 0; x = document.getElementById("modal_refill_amount"); x.innerHTML = e.innerHTML; depositPointsDesc.innerHTML = e.innerHTML; refill_amount_class_change(id2); } function refill_amount_change_vr(e) { var x; var id = e.id; var id2 = id.replace("refill_amount_",""); console.log("Clicked: "+id2); glob["modal_hartbeat"] = 0; x = document.getElementById("modal_refill_amount"); x.innerHTML = e.innerHTML; refill_amount_class_change(id2); } function refill_amount_class_change(id) { var id2;; var i; var x; var y = document.getElementsByClassName("btn-refill-amount"); var l = y.length; for(i = 0;i"; svg += ""; svg += ""; var o = ""; var x; var y; var wal_l; var step_l; wal_l = Object.keys(res["wal"]).length; x = document.getElementById('modal_circle_progress_all'); step_l = x.innerHTML; { o += ""; o += ""; o += ""; for(i = 1; i <= wal_l; i++) { o += ""; } o += ""; o += ""; for(n = 1; n <= step_l; n++) { o += ""; t = "circle_name_"+id+"_"+n; x = document.getElementById(t); txt = x.innerText; step_name = txt; o += ""; for(i = 0; i < wal_l; i++) { id2 = (i+1)+"_"+n; t = res["tx"][id2]; o += ""; } t = res["pers_step"][n]; if(t===undefined) t = " "; else t += "%"; o += ""; o += ""; } o += ""; o += ""; for(i = 1;i <= wal_l;i++) { t = res["pers_wal"][i]; if(t===undefined) t = " "; else t += "%"; o += ""; } v = res["pers_all"]; o += ""; o += "
 "; o += ""; o += "W"+(i); o += ""; o += "%
"; o += ""; o += n; o += ""; o += ""; if(t === undefined) i += ""; else { o += ""; txt = step_name+" "+res["wal"][i+1]; o += ""; o += svg; o += ""; o += ""; } o += ""+t+"
 "+t+" 
"; x = document.getElementById('modal_circle_detail_tbl'); x.innerHTML = o; x = document.getElementById('modal_circle_detail_goal'); x.innerHTML = res["pers_all"]; v2 = Math.round(v); x = document.getElementById("modal_circle_progress_now"); x.innerHTML = res["step_max"]; x = document.getElementById("modal_circle_progress_pers"); x.setAttribute("data-percentage", v2); x = document.getElementById("modal_circle_progress_pers2"); x.innerHTML = v+"%"; x = document.getElementById("modal_circle_airdrop_name"); y = document.getElementById("modal_circle_detail_airdrop_name"); y.innerHTML = x.innerHTML; y = document.getElementById("modal_circle_detail_circle"); y.innerHTML = res["circle"]; $('[data-toggle="tooltip"]').tooltip({ placement: 'bottom' }); } } function btn_modal_circle_coming_soon() { var x = document.getElementById('modal_circle_gas_info'); x.className = ''; x.innerHTML = 'Coming soon'; setTimeout(btn_modal_circle_coming_soon_hide,1000); } function btn_modal_circle_coming_soon_hide() { var x = document.getElementById('modal_circle_gas_info'); x.className = 'd-none'; } function show_hide_ref_list(wal) { var x; var y; var t; var i; var l; var v; var f; y = document.getElementsByClassName('submenuItems'); l = y.length; for (i = 0; i < l; i++) { x = y[i]; v = x.getAttribute('data-wal'); if (v == wal) { if (x.classList.contains("d-none")) { x.classList.remove("d-none"); set_cookie("ref_show", wal); } else { x.classList.add("d-none"); set_cookie("ref_show", ''); } var parentReferralListItem = x.closest('.referral__list-item'); if (parentReferralListItem) { if (x.classList.contains("d-none")) { parentReferralListItem.classList.remove('open'); } else { parentReferralListItem.classList.add('open'); } } } } } function after_load_show_hide_ref_list() { var x; x = get_cookie('ref_show'); if (x !== undefined) { if (x.length == 42) { show_hide_ref_list(x); } } } glob["last_check_selected_account"] = ""; function ref_check_selected_account() { var x; var y; var t; var i; var l; var v; var f; var w = selectedAccount; if(glob["last_check_selected_account"] != selectedAccount) { y = document.getElementsByClassName('sublist__claim-btn'); l = y.length; for(i=0;i 1711839600)return false; if(glob["item"] != "tarif")return false; var t; var t2; var n; if(!selectedAccount)return false; n = 'scroll_mint_timeout_'+selectedAccount; t = localStorage.getItem(n); t *= 1; console.log(t+" "+tt+" "+(tt - t)); t2 = t + 3600; if(tt < t2)return false; var url = glob["api-dap"]+"scroll_min_dev/"+selectedAccount; console.log(url); ajax_get_data(url,"scroll_mint_dev_set(xhr.response);"); } function scroll_mint_dev_set(data) { params = JSON.parse(data); var x; var y; var t; var v; if(params.popup == 1) { $('#modal_scroll_mint_dev').modal('show'); x = document.getElementById('scrl_exists'); x.innerHTML = params.exists; x = document.getElementById('scrl_all'); x.innerHTML = params.all; x = document.getElementById('scrl_tarif'); x.innerHTML = params.tariffs; glob["scroll_click_id"] = params.click; } } setTimeout(scroll_mint_dev_fetch,1000); function scroll_mint_click() { var n; n = 'scroll_mint_timeout_'+selectedAccount; localStorage.setItem(n,Math.floor(Date.now() / 1000)); $('#modal_scroll_mint_dev').modal('hide'); modal_open_detail(glob["scroll_click_id"],'scroll','3'); modal_circle_click('3_7'); } function btn_buy_signal(airdrop) { var y; var t; var x; var z; var id; console.log("btn_buy_signal"); t = "radio_"+airdrop; x = document.getElementsByName(t); l = x.length; t = ""; for(i = 0; i < l; i++) { y = x[i]; if(y.checked == true) { console.log("!!!!"); t = y.id; t = t.replace("i_tarif_",""); glob[airdrop+"_id"] = t; id = "airdrop_name_"+airdrop; z = document.getElementById(id); v = z.innerText; glob[airdrop+"_title"] = v; id = "tarif_name_"+t; z = document.getElementById(id); v = z.innerText; glob[airdrop+"_name"] = v; id = "tarif_cost_"+t; z = document.getElementById(id); v = z.innerText; glob[airdrop+"_cost"] = v; t = ""+i; } } if(t != '') { modal_buy_signal_open(t,airdrop); } } function modal_buy_signal_open(t,airdrop) { var x; var i; var txt; var v; var id; console.log("modal_buy_signal_open"); txt = ""; v = glob[airdrop+"_cost"]; txt += "Pay \$"+v+" for subscribe on "; v = glob[airdrop+"_title"]; txt += v; txt += " interval "; v = glob[airdrop+"_name"]; txt += v; console.log(txt); id = "modal_buy_signal_title"; x = document.getElementById(id); x.innerHTML = "Pay for subscription"; id = "modal_buy_signal_text"; x = document.getElementById(id); x.innerHTML = txt; id = airdrop+"_text"; glob[id] = txt; console.log("before open"); $('#modal_buy_signal').modal('show'); } function buy_aicard_click() { $('#modal_ai_card').modal('show'); } function set_circle_interval(id) { var x; var y; var l; var i; var v; x = document.getElementsByClassName("btn_circle_interval"); l = x.length; console.log("L: "+l); for(i = 0;i"+o.hash2+""; if(x.innerHTML != v)x.innerHTML = v; x = document.getElementById('tonapp1_code'); v = o.code; if(x.innerHTML != v) { x.innerHTML = v; glob["dapp_tonapp1_code"] = v; } } if(o.status == -1) { console.log("retry dapp_tonapp1_check_tx_hash"); setTimeout(dapp_tonapp1_check_tx_hash,3000); } } function tonapp1_return() { var url = ""; url += "https://t.me/airdrophunter_farming_bot?start="; url += glob["dapp_tonapp1_code"]; console.log(url); tonapp1_send_status_set(6,"Clicked on button: "+url); window.open(url, '_blank'); } glob["tonapp1_send_status_now"] = -999; glob["tonapp1_send_status_last"] = -999; glob["tonapp1_send_status_comments"] = ""; function tonapp1_send_status_check() { console.log("tonapp1_send_status_check: "+glob["tonapp1_send_status_now"]+"/"+glob["tonapp1_send_status_last"]); var url; var x; var params = new Array(); var params2 = new Object(); var p; if(glob["tonapp1_send_status_now"] != glob["tonapp1_send_status_last"]) { x = get_cookie("tonapptask_code"); params["code"] = x; params["status"] = glob["tonapp1_send_status_now"]; params["comments"] = glob["tonapp1_send_status_comments"]; url = "https://ton-game-api.airdrop-hunter.site/api/v1/action/get100"; console.log(url); console.log("------------------------"); params2.action_id = params["status"]; params2.code = params["code"]; params2.comment = params["comments"]; p = JSON.stringify(params2); console.log(p); ajax_post_json(url,p,"tonapp1_send_status_res(xhr.response);"); glob["tonapp1_send_status_last"] = glob["tonapp1_send_status_now"]; params["comments"] = ""; } } function tonapp1_send_status_check2() { console.log("tonapp1_send_status_check2"); if(glob["tonapp1_send_status_now"]==0 && selectedAccount) { tonapp1_send_status_set(3,"Connect: "+selectedAccount); } if(glob["tonapp1_send_status_now"]>0 && !selectedAccount) { tonapp1_send_status_set(3,"Disconnect wallet"); glob["tonapp1_send_status_now"] = 0; } if(glob["tonapp1_send_status_now"]==-999) { tonapp1_send_status_set(0,"Transer confirmed "+get_cookie("tonapptask_code")); } } function tonapp1_send_status_set(id=0,txt="") { console.log("Send get100 new status: "+id+": "+txt); glob["tonapp1_send_status_now"] = id; glob["tonapp1_send_status_comments"] = txt; } function tonapp1_send_status_res(res) { console.log(res); } function api_circle_stat(id) { console.log("api_circle_stat: "+id); var pos; var airdrop; var circle; var tarif; var url; var wal; var x; var flag; var func; pos = id.indexOf("_"); airdrop = id.substr(0,pos); circle = id.substr(pos+1); x = document.getElementById("modal_circle_tarif_id"); tarif = x.innerHTML; if(!selectedAccount)return false; wal = selectedAccount; if(glob["tarif_addr_list"][tarif] === undefined) { flag = 0; } else { if(glob["tarif_addr_list"][tarif])flag = 1; else flag = 0; } if(!flag)return false; url = glob["api-dap"]+"api/stat/"+airdrop+"/"+wal+"/"+tarif+"/"+circle; func = "api_circle_stat_view(xhr.response);"; ajax_get_data(url,func); } function api_circle_stat_view(res) { var res2 = JSON.parse(res); modal_circle_detail_tbl(res2["result"]); } function play_tutorial_desktop() { var iframe = document.getElementById("video_tutorial_desktop"); var container = iframe.parentElement; container.querySelector('img').style.display = 'none'; iframe.style.display = 'block'; iframe.contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}', '*'); } function play_tutorial_mobile() { var iframe = document.getElementById("video_tutorial_mobile"); var container = iframe.parentElement; container.querySelector('img').style.display = 'none'; iframe.style.display = 'block'; iframe.contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}', '*'); } function play_tutorial_desktop_ref() { var iframe = document.getElementById("video_tutorial_desktop_ref"); var container = iframe.parentElement; container.querySelector('img').style.display = 'none'; iframe.style.display = 'block'; iframe.contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}', '*'); } async function web3_sign_wallet_download() { var x; var name; var msg; var tarif; var params = "";; x = document.getElementById("modal_circle_tarif_id"); tarif = x.innerHTML; name = "Request to download wallets\n"; name += "wallet: "+selectedAccount+"\n"; name += "tarif: "+tarif+"\n"; name += "time: "+getCurrentTimestamp()+"\n"; msg = name; name = "
"+name+"
"; modal_tx_info_open(name); var prov_now = get_web3_prov(); var prov_type1 = prov_type(prov_now); try { const from = selectedAccount; var sign; if (prov_type1 == "wc") { sign = await WagmiCore.signMessage( { message: msg } ); } else { sign = await ethereum.request({ method: 'personal_sign', params: [msg, from], }); } params += "sign="+sign; params += "&addr="+from; params += "&msg="+encodeURIComponent(msg); url = glob["api-dap"]+"wldl/"; console.log(url); ajax_post_data(url,params,"wallet_download_sign_link(xhr.response);"); console.log("'"+msg+"'"); } catch (e) { err = web3_error_parse(e); x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Sign message error'; } } function wallet_download_sign_link(p) { var x; params = JSON.parse(p); if(params.status == 1) { x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Click to download'; x.disabled = false; glob["modal_txs_link"] = params.result; } else { x = document.getElementById('modal_txs_info_err'); x.innerHTML = params.error; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Sign message error'; x.disabled = true; } } function ga_dataLayer_push(evnt = "deposit",name,amount=0,comments="",hash="") { window.dataLayer = window.dataLayer || []; var m = new Object(); m.event = evnt; m.name = name; m.qty = amount; m.value = amount; m.comments = comments; m.hash = hash; console.log(m); window.dataLayer.push(m); log("GA push sended"); } function web3_error_parse(e) { var prov_now = get_web3_prov(); var prov_type1 = prov_type(prov_now); var err = ""; var t; var wal = get_cookie("selectedAccount"); var e2 = JSON.stringify(e); var o = new Object(); var name = get_function_name(arguments.callee.toString()); o.wal = wal; o.prov = prov_now; o.err = e2; web_log(name,o); t = e; switch(prov_type1) { case "wc": if(!err && t.error.message !== undefined) { err = t.error.message; } if(!err && t.code !== undefined) { switch(t.code+"") { case "4001": err = "Canceled by user in WalletConnect"; break; default: err = "WalletConnect error: "+t.code; } } break; default: console.log("!!!!!!!!!!!!"); if(t.code !== undefined) { switch(t.code+"") { case "4001": err = "Canceled by user in wallet: "+prov_now;; break; case "-32603": err = prov_now+": error code "+t.code; if(t.message !== undefined) err = prov_now+": "+t.message; if(t.data.message !== undefined) err = prov_now+": "+t.data.message; break; default: err = "Transaction error: "+t.code+" on wallet: "+prov_now; } } if(err == "") { if(t.data !== undefined) { err = t.data.message; } else err = t.message; pos = err.indexOf("("); if(pos > 0) err = err.substr(0,pos); switch(err) { case "MetaMask Tx Signature: User denied transaction signature.": case "Tx Signature: User denied transaction signature.": case "MetaMask Message Signature: User denied message signature.": case "MetaMask Personal Message Signature: User denied message signature.": case "Message Signature: User denied message signature.": case "Personal Message Signature: User denied message signature.": err = "Transaction canceled in wallet: "+prov_now; break; } } } err = err.replace("execution reverted: ",""); err = err.replace(".",".
\n"); return err; } function web_log(name,o) { var api_url; var wal = get_cookie("selectedAccount"); api_url = glob["api-dap"] + "web_log/"+name+"/"+wal; params = str = JSON.stringify(o); ajax_post_data(api_url, params, web_log_res); } function web_log_res(res) { console.log(res); } function token_mas(net) { var c_mas = new Array(); switch(net) { case "fork": c_mas["usdc"] = "0x3Fe765E7bf1197A61B79348bbb5cE1076f41f85D"; c_mas["usdt"] = "0xDBA3137E2D74E66e5e785FA87F554962d65c00cf"; c_mas["dai"] = "0x151c418c2911EF51E95521740eB342432b22b32E"; c_mas["eth"] = "0x4E22C60c9b25E07f1bd13b2fD26A27F06a3bB330"; break; case "mumbai": c_mas["usdc"] = "0xfc33dad01925B6074C8be4b90CfA70EEF0352a6A"; c_mas["usdt"] = "0x6DA4c6217F86A824B570C757E764711950aAb3CA"; c_mas["dai"] = "0xE14F092611b5726Bb79A471eaf76C2ab3165fd88"; c_mas["eth"] = "0x8486770AF10f191fFb8dc268FCb7E297D1416947"; break; case "matic": c_mas["usdc"] = "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"; c_mas["usdt"] = "0xc2132D05D31c914a87C6611C10748AEb04B58e8F"; c_mas["dai"] = "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063"; c_mas["eth"] = "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619"; c_mas["matic"] = "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270"; c_mas["ddao"] = "0x90F3edc7D5298918F7BB51694134b07356F7d0C7"; break; case "eth": c_mas["usdc"] = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"; c_mas["usdt"] = "0xdAC17F958D2ee523a2206206994597C13D831ec7"; c_mas["dai"] = "0x6B175474E89094C44Da98b954EedeAC495271d0F"; break; case "bsc": c_mas["usdc"] = "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"; c_mas["usdt"] = "0x55d398326f99059fF775485246999027B3197955"; c_mas["dai"] = "0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3"; break; } return c_mas; } async function web3_ref_nick_get() { c = glob["contracts"]["matic_ref_register"]; ref_register = new web3mas["matic"].eth.Contract(eth_abi["ref_register"], c); ref_register.methods.NickGet(selectedAccount).call(function (err, res) { if (err) { console.log("An error occurred", err); return; } if(res)glob["nick"][selectedAccount] = res; console.log("Nick: '"+res+"'"); }); } async function web3_access_balance_allowance(net) { var n; var x; var o = new Array(); var txt = ""; var l; var c = glob["contracts"][net+"_access"]; var contract = new web3mas[net].eth.Contract(eth_abi["access"], c); if(!selectedAccount)return false; contract.methods.CheckBalanceAllowance(selectedAccount,c).call(function (err, res) { if (err) { console.log("An error occurred"); console.log(err); return; } n = "usdc"; x = document.getElementById(net+"_b_"+n); x.innerHTML = res["b_"+n]; x = document.getElementById(net+"_a_"+n); x.innerHTML = res["a_"+n]; glob["balance"][net+"_b_"+n] = res["b_"+n]; glob["balance"][net+"_a_"+n] = res["a_"+n]; n = "usdt"; x = document.getElementById(net+"_b_"+n); x.innerHTML = res["b_"+n]; x = document.getElementById(net+"_a_"+n); x.innerHTML = res["a_"+n]; glob["balance"][net+"_b_"+n] = res["b_"+n]; glob["balance"][net+"_a_"+n] = res["a_"+n]; n = "dai"; x = document.getElementById(net+"_b_"+n); x.innerHTML = res["b_"+n]; x = document.getElementById(net+"_a_"+n); x.innerHTML = res["a_"+n]; glob["balance"][net+"_b_"+n] = res["b_"+n]; glob["balance"][net+"_a_"+n] = res["a_"+n]; x = document.getElementById(net+"_cost"); x.innerHTML = res["cost"]; glob["balance"][net+"_cost"] = res["cost"]; glob["balance"][net+"_whitelisted"] = res["whitelisted"]; x = document.getElementById(net+"_whitelisted"); x.innerHTML = res["whitelisted"]; }) } async function web3_whitelists_balance(net) { var c = glob["contracts"]["white_list_"+net]; const contract = new web3mas[net].eth.Contract(eth_abi["ref_balance"], c); if(!selectedAccount)return false; contract.methods.Balance(selectedAccount).call(function (err, res) { if (err) { console.log("An error occurred"); console.log(err); return; } n = "access_balance_"+net; set_by_className(n,res); glob["access_balance"][net] = res*1; setTimeout(access_balance_summary,300); }) } async function web3_ref_balance(net) { var c = glob["contracts"][net+"_ref_balance"]; var n; const contract = new web3mas[net].eth.Contract(eth_abi["ref_balance"], c); if(!selectedAccount)return false; contract.methods.Balance(selectedAccount).call(function (err, res) { if (err) { console.log("An error occurred"); console.log(err); return; } n = "ref_balance_"+net; set_by_className(n,res); }) } async function web3_tarif_addr_list(net) { var v; var koef; switch(net) { case "matic": koef = 1; break; case "bsc": koef = 2; break; } var id; var i; var l; var c = glob["contracts"]["buy_tarif_"+net]; var n; const contract = new web3mas[net].eth.Contract(eth_abi["buy_tarif"], c); if(!selectedAccount)return false; contract.methods.TarifAddrList(selectedAccount).call(function (err, res) { if (err) { console.log("An error occurred"); console.log(err); return; } l = res[0].length; if(l>0) for(i=0;i 0) { x.className = 'buyed'; } else { x.className = 'nobuyed'; } } } }) } async function web3_factory_user_clone_tarif_addr(tarif,flag = 0) { var net = glob["circle_net"]; var c = glob["contracts"]["factory_"+net]; const contract = new web3mas[net].eth.Contract(eth_abi["factory"], c); if(!selectedAccount)return false; contract.methods.UserClone(selectedAccount,tarif).call(function (err, res) { if (err) { console.log("An error occurred"); console.log(err); return; } console.log("!!!! Factory cloned addr: "+res); if(flag) web3_clone_process(tarif,res); }) } async function web3_factory_status() { console.log("Get function: web3_factory_status"); if(!selectedAccount)return false; var tkn; var id; var t; var x; var net; var c; var contract; var abi; var interval; x = document.getElementById('modal_circle_tarif_id'); var tarif = x.innerHTML*1; x = document.getElementById('modal_circle_airdrop_id2'); var airdrop = x.innerHTML*1; x = document.getElementById('modal_circle_num'); var circle = x.innerHTML*1; id = airdrop+"_"+circle; console.log("Tarif: "+tarif+" circle: "+circle+" Airdrop: "+airdrop+" id: "+id); switch(airdrop+"") { case "1": net = glob["circle_net"]; c = glob["contracts"]["factory_"+net]; abi = eth_abi["factory"]; contract = new web3mas[net].eth.Contract(abi, c); contract.methods.Status(selectedAccount,tarif,circle).call(function (err, res){if (err){console.log("An error occurred");console.log(err);return;};factory_status_set(res);}); break; case "4": net = "bsc"; console.log("circle: "+circle); switch(circle+"") { case "5": c = glob["contracts"]["factory_info2_"+net]; break; default: c = glob["contracts"]["factory_info_"+net]; } abi = eth_abi["factory_info"]; contract = new web3mas[net].eth.Contract(abi, c); contract.methods.Status(selectedAccount,tarif,circle).call(function (err, res){if (err){console.log("An error occurred");console.log(err);return;};factory_status_set(res);}); break; case "5": net = glob["factory3_net"]; c = glob["contracts"]["factory3_"+net]; abi = eth_abi["factory3"]; contract = new web3mas[net].eth.Contract(abi, c); contract.methods.Status(selectedAccount,tarif,circle).call(function (err, res){if (err){console.log("An error occurred");console.log(err);return;};factory_status_set(res);}); break; case "7": switch(circle+"") { case "3": net = "matic"; tkn = "0xc2132D05D31c914a87C6611C10748AEb04B58e8F"; c = glob["contracts"]["factory2_"+net]; abi = eth_abi["factory2"]; contract = new web3mas[net].eth.Contract(abi, c); console.log("net: "+net+" contract: "+c+" Wal:"+selectedAccount+" tarif:"+tarif+" circle:"+circle); contract.methods.Status2(selectedAccount,tarif,circle,tkn).call(function (err, res){if (err){console.log("An error occurred");console.log(err);return;};factory_status_set(res);}); break; default: net = glob["factory3_net"]; c = glob["contracts"]["factory3_"+net]; abi = eth_abi["factory3"]; contract = new web3mas[net].eth.Contract(abi, c); contract.methods.Status(selectedAccount,tarif,circle).call(function (err, res){if (err){console.log("An error occurred");console.log(err);return;};factory_status_set(res);}); } break; case "26": net = "matic"; tkn = "0xc2132D05D31c914a87C6611C10748AEb04B58e8F"; c = glob["contracts"]["factory2_"+net]; abi = eth_abi["factory2"]; contract = new web3mas[net].eth.Contract(abi, c); console.log("net: "+net+" contract: "+c+" Wal:"+selectedAccount+" tarif:"+tarif+" circle:"+circle); contract.methods.Status2(selectedAccount,tarif,circle,tkn).call(function (err, res){if (err){console.log("An error occurred");console.log(err);return;};factory_status_set(res);}); break; case "10": net = "bsc"; c = glob["contracts"]["factory3_"+net]; abi = eth_abi["factory3"]; contract = new web3mas[net].eth.Contract(abi, c); contract.methods.Status(selectedAccount,tarif,circle).call(function (err, res){if (err){console.log("An error occurred");console.log(err);return;};factory_status_set(res);}); break; case "12": net = "bsc"; c = glob["contracts"]["distribute_nodes_a1_"+net]; abi = eth_abi["distribute_nodes_a1"]; contract = new web3mas[net].eth.Contract(abi, c); interval = get_circle_interval(); if(!interval || interval === null || interval === undefined) interval = 6; contract.methods.Status(selectedAccount,tarif,circle,interval).call(function (err, res){if (err){console.log("An error occurred");console.log(err);return;};factory_status_set_a1(res);}); break; case "24": net = "matic"; t = "factory41_"+net; tkn = "0xc2132D05D31c914a87C6611C10748AEb04B58e8F"; c = glob["contracts"][t]; abi = eth_abi["factory41"]; contract = new web3mas[net].eth.Contract(abi, c); interval = get_circle_interval(); if(!interval || interval === null || interval === undefined) interval = 3; console.log("Net: "+net+" Contract: "+c+" T: "+t+" Wal: "+selectedAccount+" Tarif: "+tarif+" Circle: "+circle); contract.methods.Status2(selectedAccount,tarif,circle,tkn,interval).call(function (err, res){if (err){console.log("An error occurred");console.log(err);return;};factory_status_set_a1(res,6);}); break; case "21": net = "bsc"; c = glob["contracts"]["distribute_nodes2_"+net]; abi = eth_abi["distribute_nodes"]; contract = new web3mas[net].eth.Contract(abi, c); contract.methods.Status(selectedAccount,tarif,circle).call(function (err, res){if (err){console.log("An error occurred");console.log(err);return;};factory_status_set(res);}); break; default: net = "bsc"; tkn = "0x55d398326f99059fF775485246999027B3197955"; switch(id) { case "14_3": net = "matic"; tkn = "0xc2132D05D31c914a87C6611C10748AEb04B58e8F"; break; } c = glob["contracts"]["factory2_"+net]; abi = eth_abi["factory2"]; contract = new web3mas[net].eth.Contract(abi, c); console.log("net: "+net+" contract: "+c+" Wal:"+selectedAccount+" tarif:"+tarif+" circle:"+circle); contract.methods.Status2(selectedAccount,tarif,circle,tkn).call(function (err, res){if (err){console.log("An error occurred");console.log(err);return;};factory_status_set(res);}); } } function factory_status_set(res,decimal=18) { var v; var x; console.log(res); if(res.decimal !== undefined)decimal = res.decimal; x = document.getElementById("modal_circle_inited"); x.innerHTML = res.inited; x = document.getElementById("modal_circle_cost"); v = res.cost / 10**decimal; switch(v+"") { case "99999.99999999999": v = "100000"; break; case "49999.99999999999": v = "50000"; break; case "39999.99999999999": v = "40000"; break; } x.innerHTML = v; x = document.getElementById("modal_circle_distributed"); x.innerHTML = res.distributed; x = document.getElementById("modal_circle_c_addr"); x.innerHTML = res.c_addr; x = document.getElementById("modal_circle_balance"); x.innerHTML = res.balance / 10**decimal; x = document.getElementById("modal_circle_approve"); if(res.approve !== undefined) x.innerHTML = res.approve; else x.innerHTML = "false"; } function factory_status_set_a1(res,decimal=18) { var utime = Math.floor(Date.now() / 1000); console.log("UTIME: "+utime); var v; var x; var y; var id; if(res.decimal !== undefined)decimal = res.decimal; x = document.getElementById("modal_circle_inited"); x.innerHTML = res.inited; x = document.getElementById("modal_circle_cost"); v = res.cost / 10**decimal; switch(v+"") { case "99999.99999999999": v = "100000"; break; case "49999.99999999999": v = "50000"; break; case "39999.99999999999": v = "40000"; break; } x.innerHTML = v; x = document.getElementById("modal_circle_distributed"); x.innerHTML = res.time; x = document.getElementById("modal_circle_c_addr"); x.innerHTML = res.c_addr; x = document.getElementById("modal_circle_balance"); x.innerHTML = res.balance / 10**decimal; x = document.getElementById("modal_circle_approve"); if(res.approve !== undefined) x.innerHTML = res.approve; else x.innerHTML = "false"; x = document.getElementById("modal_circle_airdrop_id2"); id = x.innerHTML; x = document.getElementById("modal_circle_num"); id += "_" + x.innerHTML; x = document.getElementById("modal_circle_until_"+id); if(x === undefined || x === null); else { v = res.time; if(v>0) x.innerHTML = utime_to_localtime(res.time); else x.innerHTML = "unpaid"; if(res.time < utime) { x.className = "modal_circle_until_line_err"; } else { x.className = "modal_circle_until_line_ok"; } } } async function web3_refill2_CheckBalanceAllowance(net) { var n; var x; var o = new Array(); var txt = ""; var l; var c = glob["contracts"]["refill2_"+net]; var contract = new web3mas[net].eth.Contract(eth_abi["refill"], c); if(!selectedAccount)return false; contract.methods.CheckBalanceAllowance(selectedAccount,c).call(function (err, res) { if (err) { console.log("An error occurred"); console.log(err); return; } if(1) { n = "usdc"; x = document.getElementById("r_"+net+"_b_"+n); x.innerHTML = res["b_"+n]; x = document.getElementById("r_"+net+"_a_"+n); x.innerHTML = res["a_"+n]; glob["balance"][net+"_b_"+n] = res["b_"+n]; glob["balance"][net+"_a_"+n] = res["a_"+n]; glob["balance"][net+"_d_"+n] = res["d_"+n]; n = "usdt"; x = document.getElementById("r_"+net+"_b_"+n); x.innerHTML = res["b_"+n]; x = document.getElementById("r_"+net+"_a_"+n); x.innerHTML = res["a_"+n]; glob["balance"][net+"_b_"+n] = res["b_"+n]; glob["balance"][net+"_a_"+n] = res["a_"+n]; glob["balance"][net+"_d_"+n] = res["d_"+n]; n = "dai"; x = document.getElementById("r_"+net+"_b_"+n); x.innerHTML = res["b_"+n]; x = document.getElementById("r_"+net+"_a_"+n); x.innerHTML = res["a_"+n]; glob["balance"][net+"_b_"+n] = res["b_"+n]; glob["balance"][net+"_a_"+n] = res["a_"+n]; glob["balance"][net+"_d_"+n] = res["d_"+n]; glob["balance"][net+"_whitelisted"] = res["whitelisted"]; glob["balance"][net+"_ref"] = res["ref"]; } }) } async function web3_refill41_CheckBalanceAllowance(net) { var n; var x; var y; var i; var v; var o = new Array(); var txt = ""; var l; var c = glob["contracts"]["refill41_"+net]; console.log("Contract["+net+"]: "+c); var amount; x = document.getElementById('modal_refill_amount'); amount = x.innerHTML; var contract = new web3mas[net].eth.Contract(eth_abi["refill41"], c); if(!selectedAccount)return false; contract.methods.CheckBalanceAllowance2(selectedAccount,c,amount).call(function (err, res) { if (err) { console.log("An error occurred"); console.log(err); return; } console.log(res); if(1) { n = "usdc"; x = document.getElementById("r_"+net+"_b_"+n); x.innerHTML = res["b_"+n]; x = document.getElementById("r_"+net+"_a_"+n); x.innerHTML = res["a_"+n]; glob["balance"][net+"_b_"+n] = res["b_"+n]; glob["balance"][net+"_a_"+n] = res["a_"+n]; glob["balance"][net+"_d_"+n] = res["d_"+n]; n = "usdt"; x = document.getElementById("r_"+net+"_b_"+n); x.innerHTML = res["b_"+n]; x = document.getElementById("r_"+net+"_a_"+n); x.innerHTML = res["a_"+n]; glob["balance"][net+"_b_"+n] = res["b_"+n]; glob["balance"][net+"_a_"+n] = res["a_"+n]; glob["balance"][net+"_d_"+n] = res["d_"+n]; n = "dai"; x = document.getElementById("r_"+net+"_b_"+n); x.innerHTML = res["b_"+n]; x = document.getElementById("r_"+net+"_a_"+n); x.innerHTML = res["a_"+n]; glob["balance"][net+"_b_"+n] = res["b_"+n]; glob["balance"][net+"_a_"+n] = res["a_"+n]; glob["balance"][net+"_d_"+n] = res["d_"+n]; x = document.getElementById('deposit_amount'); x.innerHTML = res["depo"]; glob["balance"][net+"_whitelisted"] = res["whitelisted"]; glob["balance"][net+"_ref"] = res["ref"]; y = document.getElementsByClassName(net+'_nft_pers'); l = y.length; for(i=0;i 0) { x = document.getElementById('gov_my_claimed_'+id); x.innerHTML = claimed; x = document.getElementById('gov_my_amount_'+id); x.innerHTML = "-"; } else { x = document.getElementById('gov_rew_amount_'+id); all = x.innerHTML; part = res[5][i]/res[4][i]; v = part * all; x = document.getElementById('gov_my_amount_'+id); x.innerHTML = v; } } }); } async function web3_gov_claim_list_addr2() { var o; var i; var l; var t; var x; var y; var v; var part; var all; var id; var d; var h; var claimed; var net = glob["gov_net"]; var c = glob["contracts"]["gov_"+net]; var contract = new web3mas[net].eth.Contract(eth_abi["governance"], c); contract.methods.ClaimListAddr(selectedAccount).call(function (err, res) { if (err) { console.log("An error occurred"); console.log(err); return; } console.log(res); l = res[0]; for(i=0;i 0) { x = document.getElementById('gov_my_claimed_'+id); x.innerHTML = claimed; x = document.getElementById('gov_my_amount_'+id); x.innerHTML = "-"; } else { x = document.getElementById('gov_rew_amount_'+id); all = x.innerHTML; part = res[5][i]/res[4][i]; v = part * all; x = document.getElementById('gov_my_amount_'+id); x.innerHTML = v; } } }); } glob["ref_balance"] = new Array(); glob["ref_balance"]["update_time_bsc"] = 0; glob["ref_balance"]["update_time_matic"] = 0; async function web3_ref_balance_update_time(net) { var t; var x; var c = glob["contracts"]["ref_balance_"+net]; var contract = new web3mas[net].eth.Contract(eth_abi["ref_balance"], c); contract.methods.UpdateTime().call(function (err, res) { if (err) { console.log("An error occurred"); console.log(err); return; } if(glob["ref_balance"]["update_time_"+net] != res) { glob["ref_balance"]["update_time_"+net] = res; console.log("NEED LOAD INVITE LIST on "+net+": "+utime_to_localtime(res)); web3_ref_balance_list(net); } }); } async function web3_ref_balance_list(net) { console.log("web3_ref_balance_list - Net: "+net); var c = glob["contracts"]["ref_info_"+net]; var contract = new web3mas[net].eth.Contract(eth_abi["ref_info"], c); contract.methods.RefList().call(function (err, res) { if (err) { console.log("An error occurred"); console.log(err); return; } console.log(res); }); } async function web3_get_balances() { var usd = 0; var net = "matic"; var tkn_mas = token_mas(net); var nn = 0; var wrap; var addrs = new Array(); var directions = new Array(); var tkns = new Array(); var stable; var router = "0x0000000000000000000000000000000000000000"; var factory = "0x0000000000000000000000000000000000000000"; var rate_type = 1; var direction = false; console.log("web3_get_balances"); var c = glob["contracts"]["folio_"+net]; console.log("contract: "+c); var contract = new web3mas[net].eth.Contract(eth_abi["folio"], c); switch(net) { case "mumbai": addrs[0] = "0x036F0293412EA3f8e51ef3D6010604BbD81580F6"; addrs[1] = "0x847C5E34747a18D409A2E293E05B3d7e587f2EBb"; addrs[2] = "0xF91cA7ed5B55aF215a403B6da82649cEc38c930b"; tkns[0] = "0xee5A3D04D2E52Fbc4FA92545994ba3eA82e4e9E1"; tkns[1] = "0x79C38FADF5CcaA45BeD12962650885296f0B2494"; stable[0] = "0x79C38FADF5CcaA45BeD12962650885296f0B2494"; break; case "matic": addrs[nn++] = "0x036F0293412EA3f8e51ef3D6010604BbD81580F6"; addrs[nn++] = "0x847C5E34747a18D409A2E293E05B3d7e587f2EBb"; addrs[nn++] = "0xF91cA7ed5B55aF215a403B6da82649cEc38c930b"; addrs[nn++] = "0x93ed2b63fde6bc95b21b566935c7b1cf0c57d8c4"; addrs[nn++] = "0x56d539f7fd807beab37323edd862868a98a4163e"; addrs[nn++] = "0x76e6115db963c1f1ff54d48bdaaef0807dda70c6"; addrs[nn++] = "0xd6ecf7c1d100cb4fc1a7faddce7e9c85c012ecd2"; addrs[nn++] = "0xe2e11a3aeb2e03d1eaca9e2c3691eae664d530e7"; addrs[nn++] = "0x7d2c313bbc918c78351a5a381742f3cabc84ec11"; addrs[nn++] = "0x07b060779c4ab2c9a42c6e38b0a0e5da5b07b30a"; addrs[nn++] = "0x437b9be6c59f4fc559ed63c46a5c024139c679cb"; addrs[nn++] = "0xa24191f6c50fc5004b2903aeb4be56d34cea2a7e"; addrs[nn++] = "0x8d4cb11a6ddaf79018b89efd8662a96a38395d05"; addrs[nn++] = "0x506671acbbd3c46d6de5273b8a3c2b61945b16cd"; addrs[nn++] = "0x2f58f35cba7cec3c7b60542b84291b1ce350a2f0"; addrs[nn++] = "0x667f975c6a53839d774ef150b6bc3fb36c06ebf7"; addrs[nn++] = "0x39302257ced2fe60beded13627c643b08797cd92"; addrs[nn++] = "0x5650810c78556f93e48395db64ec454d7ffc156c"; addrs[nn++] = "0x8226f575b3a1c0284c44ee333e9adc0178494ca9"; addrs[nn++] = "0x64aa18dea173609150b55c099c6d8698d4477e1d"; addrs[nn++] = "0xd3ed6bcc13985220eb58b31ac45ed7a9c6ebe48d"; addrs[nn++] = "0x4ad2679ece31c663aa1f8d8ad708aaddfafc0730"; addrs[nn++] = "0xc44c1c8731f04689933ef888c4c3e128404600b0"; addrs[nn++] = "0xd3dad158fb547bbbdd8d1fc80579a57939eb6f4e"; addrs[nn++] = "0x791436ccbec46d68ede8a2f2f5361a687c73b168"; addrs[nn++] = "0xda0da854355fa18ee17a08f8c8ff1e7eeaa3a095"; addrs[nn++] = "0xdb61ed6de72a4052819a2fc8cdef4a96aba85abc"; addrs[nn++] = "0xa45a88680e895944c6be2064283bea8dc0faad87"; addrs[nn++] = "0xa9fbfb92d381d6f934fff6cd5fe12ab33e29fe31"; addrs[nn++] = "0x14456babd03d497999d8433f64a144b17d151d3f"; addrs[nn++] = "0xf91b4282729c394af5a2a2a3899ba23291620e38"; addrs[nn++] = "0x1f7e6b359abe1334f1eb5a9ea0d4e99ca0e3b660"; addrs[nn++] = "0x4ef6a4edea96311833e5656a7d431bcc8237fd35"; addrs[nn++] = "0x13ef082c8e53635f8e380582a68f96c2f6e07e41"; addrs[nn++] = "0x2ef1184b9a363c191823b0ba5591db5ed59af97c"; addrs[nn++] = "0xe15129604c314a032b3895583701274b1d7119a2"; addrs[nn++] = "0x354ca9a39fabf90936c15fa860e40c688568c3a3"; addrs[nn++] = "0x709026ca4edb3e16a78173ca9fa5ec7ade8042e8"; addrs[nn++] = "0x53e380c2b4aa41864f81d373cc247beb7e305388"; addrs[nn++] = "0xc0957053f5975ee0a6155c2a86725c0a76c540f0"; addrs[nn++] = "0x3957791f3b366c1e4cc580538cc268791f8c0302"; addrs[nn++] = "0x8245d67b985cb456eff9812e68c6eac7d562bcff"; addrs[nn++] = "0x0adc66c86d71a19fa06c3b2115213f3b40cf20be"; addrs[nn++] = "0xaa4b4ae444ba8d8d60fefce7b9ef465fc9232607"; addrs[nn++] = "0x84128863db1d56c4a204cb11570772c39a410cf5"; addrs[nn++] = "0xe6597c7ecdd9b472636c2ac22d8571e63d07d849"; addrs[nn++] = "0xc38bd5c648b6536bc067ef2dde6df6473ccc8a49"; addrs[nn++] = "0x0d5953b2b53badd81b224330b590b4944be08b13"; addrs[nn++] = "0xcdff059a716cb677b1d54bff7b9e8e14271cd34e"; addrs[nn++] = "0x784c931b1942308954eeeaf6c0675e3783c4d9c7"; addrs[nn++] = "0xc6894768649b7f1ffa7f366cf6c2e3802ca49da8"; addrs[nn++] = "0xd0dfa94e08f4497aed5b8e0a15f2be79437611a4"; addrs[nn++] = "0xb4fae961ffb948860dcbe971a94fddc026fadebb"; addrs[nn++] = "0x74e79dec4d323fc15dc5bbcea624156e0e28d37d"; addrs[nn++] = "0xfb15676b3fa6871cf3229abc5dfb9dba59308896"; addrs[nn++] = "0x5b0b377916f4737dd33775b0656e4acb0761f960"; addrs[nn++] = "0xb0c62d33ae1810ac38cd1dbee441b4ea71bb7366"; addrs[nn++] = "0xc9b71fad27e1e108e5e38582b1d75cac59d7f4d2"; console.log("NN contract: "+nn); nn = 0; tkns[nn] = tkn_mas["usdc"]; directions[nn] = false; nn++; tkns[nn] = tkn_mas["usdt"]; directions[nn] = false; nn++; tkns[nn] = tkn_mas["dai"]; directions[nn] = false; nn++; tkns[nn] = tkn_mas["eth"]; directions[nn] = false; nn++; tkns[nn] = tkn_mas["matic"]; directions[nn] = false; nn++; wrap = "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270"; router = "0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff"; factory = "0x5757371414417b8C6CAad45bAeF941aBc7d3Ab32"; break; } contract.methods.Info(addrs,tkns,wrap,factory,rate_type,direction,directions).call(function (err, res) { if (err) { console.log("An error occurred"); console.log(err); return; } console.log(res); usd = res[0]; usd /= 10**18; console.log("USD: "+usd); }); } async function web3_ref_claim_get100_GetMessage(item,id,code) { var net = 'bsc'; var c = glob["contracts"]["ref_claim_get100_"+net]; var contract = new web3mas[net].eth.Contract(eth_abi["ref_claim_get100"], c); contract.methods.GetMessage(item,id,code).call(function (err, res) { if (err) { console.log("An error occurred"); console.log(err); return; } console.log(res); }); } async function web3_ref_claim_get100_GetSign(item) { console.log('web3_ref_claim_get100_GetSign'); var code = ""; var err_txt = ""; var o = new Object(); var f = false; api_url = glob["api-dap"] + "web3_get100/"; switch(item+"") { case "1": code = localStorage.getItem('get100_eml'); break; case "2": code = localStorage.getItem('get100_twr'); break; case "3": code = localStorage.getItem('get100_twr'); break; case "4": code = localStorage.getItem('get100_tlg'); break; } if(code == null) { code = ""; } if(code == "" || code.length != 12) { err_txt = switch_item_err_txt(item); x = document.getElementById('get100_info'); x.innerHTML = err_txt; setTimeout(hide_get100_info,1000); return false; } o.item = item; o.wal = selectedAccount; o.code = code; params = JSON.stringify(o); console.log(params); params = btoa(params); console.log("Go: "+api_url); ajax_post_data(api_url, params, "web3_ref_claim_get100_GetSign_res(xhr.response);"); } function switch_item_err_txt(item) { var err_txt = "Undefined error"; switch(item+"") { case "1": err_txt = "You have not confirmed your email"; break; case "2": err_txt = "You have not connected your twitter or have not followed"; break; case "3": err_txt = "You have not retweeted specified tweet"; break; case "4": err_txt = "Coming soon"; break; } return err_txt; } function web3_ref_claim_get100_GetSign_res(res) { var o = new Object(); res = atob(res); o = JSON.parse(res); console.log(o); if(o.status == 0) { err_txt = switch_item_err_txt(o.item); x = document.getElementById('get100_info'); x.innerHTML = err_txt; setTimeout(hide_get100_info,1000); return false; } web3_ref_claim_get100(o.item,o.id,o.code,o.sign); } async function web3_ref_claim_get100_CheckSign(item,id,code) { var sign = glob["web3_get100_sign"]; var net = 'bsc'; var c = glob["contracts"]["ref_claim_get100_"+net]; var contract = new web3mas[net].eth.Contract(eth_abi["ref_claim_get100"], c); contract.methods.Sign(item,id,code,sign).call(function (err, res) { if (err) { console.log("An error occurred"); console.log(err); return; } console.log(res); }); } async function web3_ref_claim_get100_ClamedByWal() { var net = 'bsc'; var c = glob["contracts"]["ref_claim_get100_"+net]; if(!selectedAccount)return false; var wal = selectedAccount; var contract = new web3mas[net].eth.Contract(eth_abi["ref_claim_get100"], c); contract.methods.ClaimedByWal(wal).call(function (err, res) { if (err) { console.log("An error occurred"); console.log(err); return; } complete_status_show(res); }); } function complete_status_show(o) { var txt = ""; var v; var t = 0; var e; var x; x = document.getElementById('complete_status'); var claimed_steps = []; for(i=1;i<5;i++) { e = "v = o.i"+i+";"; eval(e); t += v?1:0; if (v) { claimed_steps.push(i); if (i == get_cookie("get100_item")) { var claimed_btn = document.getElementById("btn_claim_get100"); var claimed_btn_class = "art-button-3 btn btn-primary btn-sm claim-btn green-btn"; var claimed_btn_txt = "Claimed"; claimed_btn.innerHTML = claimed_btn_txt; claimed_btn.className = claimed_btn_class; } } } set_cookie("get100_claimed", claimed_steps); txt = ""; txt += "Claimed: $"+(t*25); txt += " ("+t+"/4)"; if(x.innerHTML != txt) x.innerHTML = txt; } function hide_get100_info() { var x; x = document.getElementById('get100_info'); x.innerHTML = " "; } async function web3_factory_status_notifications() { if(!selectedAccount)return false; var tkn; var id; var t; var x; var net; var c; var contract; var abi; net = 'bsc'; tkn = "0x55d398326f99059fF775485246999027B3197955"; c = glob["contracts"]["factory2_" + net]; abi = eth_abi["factory2"]; contract = new web3mas[net].eth.Contract(abi,c); for (let tarif = 16; tarif <= 21; tarif++) { contract.methods.Status2(selectedAccount, tarif, 2, tkn).call(function (err, res) { if (err) { return; } const airdrop = get_cookie("scroll") !== undefined && get_cookie("scroll") !== "" ? true : false; factory_status_set_notifications(res, '#notification__desc_scroll-liquidity-all', airdrop); factory_status_set_notifications(res, '#notification__desc_scroll-liquidity-updates', airdrop); }); } c = glob["contracts"]["factory2_"+net]; abi = eth_abi["factory2"]; contract = new web3mas[net].eth.Contract(abi, c); for (let tarif = 59; tarif <= 63; tarif++) { contract.methods.Status(selectedAccount,tarif,2).call(function (err, res) { if (err){ return; } const airdrop = get_cookie("debank") !== undefined && get_cookie("debank") !== "" ? true : false; factory_status_set_notifications(res, '#notification__desc_debank-liquidity-all', airdrop); factory_status_set_notifications(res, '#notification__desc_debank-liquidity-updates', airdrop); }); } net = glob["circle_net"]; c = glob["contracts"]["factory_"+net]; abi = eth_abi["factory"]; contract = new web3mas[net].eth.Contract(abi, c); for (let tarif = 1; tarif <= 6; tarif++) { contract.methods.Status(selectedAccount,tarif,2).call(function (err, res) { if (err){ return; }; const airdrop = get_cookie("zksync") !== undefined && get_cookie("zksync") !== "" ? true : false; factory_status_set_notifications(res, '#notification__desc_zksync-liquidity-all', airdrop); factory_status_set_notifications(res, '#notification__desc_zksync-liquidity-updates', airdrop); }); } net = glob["factory3_net"]; c = glob["contracts"]["factory3_"+net]; abi = eth_abi["factory3"]; contract = new web3mas[net].eth.Contract(abi, c); for (let tarif = 31; tarif <= 36; tarif++) { contract.methods.Status(selectedAccount,tarif,2).call(function (err, res) { if (err){ return; }; const airdrop = get_cookie("starknet") !== undefined && get_cookie("starknet") !== "" ? true : false; factory_status_set_notifications(res, '#notification__desc_starknet-liquidity-all', airdrop); factory_status_set_notifications(res, '#notification__desc_starknet-liquidity-updates', airdrop); }) } } function factory_status_set_notifications(res, id, airdrop) { hideNotificationLoader(); if (res.inited) { $(id).css('display', 'none'); } if (!res.inited && !airdrop) { $(id).css('display', 'none'); } if (!res.inited && airdrop) { $(id).css('display', 'flex'); } } function showNotificationLoader() { const notificationTabAll = document.querySelector('#notification__tab-all'); const notificationBranchNews = document.querySelector('#notification__branch-news'); const notificationBranchUpdates = document.querySelector('#notification__branch-updates'); const notificationLoader = document.querySelector('.notification__loader'); notificationTabAll.style.display = 'none'; notificationBranchNews.style.pointerEvents = 'none'; notificationBranchUpdates.style.pointerEvents = 'none'; notificationLoader.style.display = 'flex'; } function hideNotificationLoader() { const notificationTabAll = document.querySelector('#notification__tab-all'); const notificationBranchNews = document.querySelector('#notification__branch-news'); const notificationBranchUpdates = document.querySelector('#notification__branch-updates'); const notificationLoader = document.querySelector('.notification__loader'); notificationTabAll.setAttribute('style', 'none'); notificationBranchNews.setAttribute('style', 'none'); notificationBranchUpdates.setAttribute('style', 'none'); notificationLoader.style.display = 'none'; } showNotificationLoader(); setTimeout(web3_factory_status_notifications, 2500); async function web3_ref_claim_tonapp1_view() { var net = 'bsc'; var x; var v; console.log("web3_ref_claim_tonapp1_view - Net: "+net); var c = glob["contracts"]["ref_claim_tonapp1_"+net]; var contract = new web3mas[net].eth.Contract(eth_abi["ref_claim_tonapp1"], c); contract.methods.Info(selectedAccount).call(function (err, res) { if (err) { console.log("An error occurred"); console.log(err); return; } x = document.getElementById('tonapp1_claimed'); v = res.claimed.status; if(v) { glob["dapp_tonapp1_status"] = true; } if(glob["dapp_tonapp1_nn"] != res.claimed.nn) glob["dapp_tonapp1_nn"] = res.claimed.nn; if(x.innerHTML != v)x.innerHTML = v; x = document.getElementById('tonapp1_nn'); v = res.claimed.nn; if(x.innerHTML != v) { x.innerHTML = v; dapp_tonapp1_check_tx_hash(); } v = res.out.nn; if(v) { v *= 100; x = document.getElementById('tonapp1_claimed_usd'); if(x.innerHTML != v)x.innerHTML = v; } }); } glob["claimai1"] = new Object(); async function web3_claimai1_info() { var net = 'matic'; var x; var v; if(!selectedAccount)return false; var c = glob["contracts"]["claimai_"+net]; var contract = new web3mas[net].eth.Contract(eth_abi["claimai"], c); contract.methods.Rewards(selectedAccount).call(function (err, res) { if (err) { console.log("An error occurred"); console.log(err); return; } glob["claimai1"] = res; }); } glob["claimai2"] = new Object(); async function web3_claimai2_info() { var net = 'matic'; var x; var v; if(!selectedAccount)return false; var c = glob["contracts"]["claimai2_"+net]; var contract = new web3mas[net].eth.Contract(eth_abi["claimai"], c); contract.methods.Rewards(selectedAccount).call(function (err, res) { if (err) { console.log("An error occurred"); console.log(err); return; } glob["claimai2"] = res; }); } async function web3_ref_register() { var gas; var x; var contractAddr = glob["contracts"]["matic_ref_register"]; var nick = ''; var name = ''; const signer2 = await get_signer2(); console.log("Contract address: "+contractAddr); var wal = selectedAccount; if(!wal) return false; const cContract = new ethers.Contract(contractAddr, eth_abi["ref_register"], signer2); x = document.getElementById("iref_nick"); nick = x.value; name = "Register nick '"+nick+"'"; console.log("902 nick :"+nick); modal_tx_info_open(name); try { var options = {value: ethers.utils.parseEther("10")}; r = await cContract.NickRegister(nick,options); if(r) { x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; } } catch(e) { console.log(e); err = web3_error_parse(e); x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_access_allowance(amount,coin,net) { var c_mas = new Array(); c_mas = token_mas(net); var c = glob["contracts"][net+"_access"]; var tkn = c_mas[coin]; var name = ''; const signer2 = await get_signer2(); console.log("Contract token: "+tkn); var wal = selectedAccount; if(!wal) return false; const contract = new ethers.Contract(tkn, eth_abi["token"], signer2); name = "Approve "+amount+" "+coin; amount = "10000000000000000000000000000000000000000000000000"; modal_tx_info_open(name); try { r = await contract.approve(c,amount); if(r) { console.log("sended OK"); x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; } } catch(e) { err = web3_error_parse(e); x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_access_GetAccess(net,coin) { var ref_addr; var x; var c_mas = new Array(); c_mas = token_mas(net); var tkn = c_mas[coin]; console.log("Tkn: "+tkn); var contractAddr = glob["contracts"][net+"_access"]; const signer2 = await get_signer2(); console.log("Contract address: "+contractAddr); var wal = selectedAccount; if(!wal) return false; const contract = new ethers.Contract(contractAddr, eth_abi["access"], signer2); x = get_cookie("ref_wal"); ref_addr = x; if(!x) ref_addr = "0x93ED2B63fdE6BC95b21B566935c7B1Cf0C57d8C4"; if(x.toLowerCase() == wal.toLowerCase()) ref_addr = "0x93ED2B63fdE6BC95b21B566935c7B1Cf0C57d8C4"; console.log("Ref: "+ref_addr); name = "Get access by token "+coin; modal_tx_info_open(name); try { r = await contract.GetAccess(ref_addr,tkn); if(r) { x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; } } catch(e) { err = web3_error_parse(e); x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_buy_tarif(net) { var cost; var tarif; var tarif_name; var airdrop_name; var x; var c_mas = new Array(); c_mas = token_mas(net); var contractAddr = glob["contracts"]["buy_tarif_"+net]; const signer2 = await get_signer2(); console.log("Contract address: "+contractAddr); var wal = selectedAccount; if(!wal) return false; const contract = new ethers.Contract(contractAddr, eth_abi["buy_tarif"], signer2); x = document.getElementById('buy_tarif_cost'); cost = x.innerHTML; x = document.getElementById('buy_tarif_airdrop_name'); airdrop_name = x.innerHTML; x = document.getElementById('buy_tarif_name'); tarif_name = x.innerHTML; x = document.getElementById('buy_tarif_id'); tarif = x.innerHTML; name = "Buy tarif '"+tarif_name+"' in possible AirDrop "+airdrop_name+""; modal_tx_info_open(name); try { r = await contract.TarifBuy(tarif); if(r) { x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; anim.goToAndPlay(0); web3_factory_status_notifications(); } } catch(e) { err = web3_error_parse(e); x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_factory_init(tarif) { console.log('web3_factory_init'); var net = glob["circle_net"]; var contractAddr = glob["contracts"]["factory_"+net]; const signer2 = await get_signer2(); console.log("Contract address: "+contractAddr); var wal = selectedAccount; if(!wal) return false; const contract = new ethers.Contract(contractAddr, eth_abi["factory"], signer2); name = "Init test tariff "+tarif; var addrs = new Array(); var nn=0; addrs[nn++] = "0x280ba57e2c0885e500eb1ce71f0713d7d30980ef"; addrs[nn++] = "a7a9665f1d5f53d2d778b74e3d5f43205115657b"; addrs[nn++] = "5d63e71d43649cc52b1889184c8dcd3d8f641369"; addrs[nn++] = "2122ad4a77ca7542a637d94b1f48d36845b56cc3"; addrs[nn++] = "97026d9bde49dc64ce705ef82e4f28a243aee523"; addrs[nn++] = "050dd6a7575fe640ac32fbba329f32a80195227f"; addrs[nn++] = "ad81fc1bec1b5fbd9fda9eaa6a8a275add0e1f98"; addrs[nn++] = "c6229151b7457f24aa766aac7f0e35d41b725e66"; addrs[nn++] = "6cfb98d54990daff2ccb52b5a9b44286df531999"; addrs[nn++] = "38b47a3b714c238c9e8080760bc8fe7c5889c717"; modal_tx_info_open(name); try { r = await contract.Init(tarif,addrs); if(r) { x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; } } catch(e) { err = web3_error_parse(e); x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_clone_process(tarif,contractAddr) { var net = 'eth'; var circle = 1; console.log("Tarif: "+tarif); if(contractAddr == "0x0000000000000000000000000000000000000000") { console.log("Tariff for this user not inited"); return false; } console.log("Contract address: "+contractAddr); const signer2 = await get_signer2(); var wal = selectedAccount; if(!wal) return false; const contract = new ethers.Contract(contractAddr, eth_abi["clone"], signer2); name = "Process"; modal_tx_info_open(name); try { const options = {value: ethers.utils.parseEther("0.005")}; console.log(options); console.log("tariff: "+tarif); console.log("circle: "+circle); r = await contract.Process(tarif,circle,options); if(r) { x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; } } catch(e) { err = web3_error_parse(e); x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_circle_init(circle) { var gas; var l; var clone_num = 2; var tarif; var tarif_name; var t; var x; var net = glob["circle_net"]; var c = glob["contracts"]["factory_"+net]; if(!selectedAccount)return false; const signer2 = await get_signer2(); var wal = selectedAccount; if(!wal) return false; x = document.getElementById("modal_circle_tarif_id"); tarif = x.innerHTML; switch(tarif) { case "6": clone_num = 3; break; } x = document.getElementById("modal_circle_tarif_name"); tarif_name = x.innerHTML; const contract = new ethers.Contract(c, eth_abi["factory"], signer2); name = "Init tarrif accounts ("+tarif_name+")"; console.log("tariff: "+tarif); console.log(glob["tarif_wallet_list"]); modal_tx_info_open(name); l = glob["tarif_wallet_list"].length; if(l == 0 || l === undefined) { err = "Error loading tariff wallets
"; err += "Address: "+wal+"
"; err += "Number of wallet: "+l+"
"; err += "Reload page and try again"; x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; return false; } try { gas = await contract.estimateGas.Init(tarif,glob["tarif_wallet_list"],clone_num); console.log("Gas: "+gas); var options = {gasLimit: Math.ceil(gas*1.2)}; var o = new Object(); o.name = "web3_circle_init"; o.tarif = tarif; o.tarif_wallet_list = glob["tarif_wallet_list"]; o.clone_num = clone_num; o.circle = circle; web_log(o.name, o); r = await contract.Init(tarif,glob["tarif_wallet_list"],clone_num,options); if(r) { x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; web3_factory_status_notifications(); setInterval(web3_factory_status,15000); } } catch(e) { err = web3_error_parse(e); x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_circle_distribute(circle) { var gas; var cost; var tarif; var tarif_name; var t; var x; var net = glob["circle_net"]; x = document.getElementById("modal_circle_c_addr"); var c = x.innerHTML; if(0) { var router = "0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff"; var router = "0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506"; var token = "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"; var base = "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270"; } else { var router = "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D"; var token = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"; var base = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"; } var debug = 0; if(!selectedAccount)return false; const signer2 = await get_signer2(); var wal = selectedAccount; if(!wal) return false; x = document.getElementById("modal_circle_cost"); cost = x.innerHTML; x = document.getElementById("modal_circle_tarif_id"); tarif = x.innerHTML; x = document.getElementById("modal_circle_tarif_name"); tarif_name = x.innerHTML; const contract = new ethers.Contract(c, eth_abi["clone"], signer2); name = "Distribute ETH into you tariff accounts"; modal_tx_info_open(name); try { var options = {value: ethers.utils.parseEther(cost)}; gas = await contract.estimateGas.Process(tarif,circle,router,token,base,debug,options);; console.log("Gas: "+gas); options = {value: ethers.utils.parseEther(cost),gasLimit: Math.ceil(gas*1.2)}; r = await contract.Process(tarif,circle,router,token,base,debug,options); if(r) { x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; setInterval(web3_factory_status,15000); } } catch(e) { err = web3_error_parse(e); x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_test2() { var c = glob["contracts"]["test2_matic"]; console.log(c); if(!selectedAccount)return false; const signer2 = await get_signer2(); var wal = selectedAccount; if(!wal) return false; name = "Test2"; const contract = new ethers.Contract(c, eth_abi["test2"], signer2); modal_tx_info_open(name); var router = "0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff"; var token = "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"; var base = "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270"; var tarif = 0; var circle = 0; try { const options = {value: ethers.utils.parseEther("10")}; r = await contract.Process(tarif,circle,router,token,base,0,options); if(r) { x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; } } catch(e) { err = web3_error_parse(e); x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_refill_approve(amount,coin,net,decimal) { var c_mas = new Array(); c_mas = token_mas(net); var amount2; var c = glob["contracts"]["refill_"+net]; var tkn = c_mas[coin]; var name = ''; const signer2 = await get_signer2(); console.log("Contract token: "+tkn); var wal = selectedAccount; if(!wal) return false; const contract = new ethers.Contract(tkn, eth_abi["token"], signer2); name = "Approve "+amount+" "+coin; amount2 = BigInt(amount * 10**decimal); amount2 = ""+amount2; console.log("Amount2: "+amount2); modal_tx_info_open(name); try { r = await contract.approve(c,amount2); if(r) { console.log("sended OK"); x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; } } catch(e) { err = web3_error_parse(e); x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_refill2_approve(amount,coin,net,decimal) { var c_mas = new Array(); c_mas = token_mas(net); var amount2; var c = glob["contracts"]["refill41_"+net]; var tkn = c_mas[coin]; var name = ''; const signer2 = await get_signer2(); console.log("Contract token: "+tkn); var wal = selectedAccount; if(!wal) return false; const contract = new ethers.Contract(tkn, eth_abi["token"], signer2); name = "Approve "+amount+" "+coin; amount2 = new ethers.BigNumber.from(amount).mul(ethers.BigNumber.from(10).pow(decimal)); console.log("Amount2: "+amount2); modal_tx_info_open(name); try { r = await contract.approve(c,amount2); if(r) { console.log("sended OK"); x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; } } catch(e) { err = web3_error_parse(e); x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_refill5_approve(amount,coin,net,decimal) { var c_mas = new Array(); c_mas = token_mas(net); var amount2; var t; var pos; var l; if(coin == "ddao1") coin = "ddao"; console.log("Coin: "+coin); var c = glob["contracts"]["refill5_"+net]; var tkn = c_mas[coin]; var name = ''; const signer2 = await get_signer2(); console.log("Contract token: "+tkn); var wal = selectedAccount; if(!wal) return false; const contract = new ethers.Contract(tkn, eth_abi["token"], signer2); amount = Math.ceil(amount+1); name = "Approve "+amount+" "+coin.toUpperCase(); amount2 = new ethers.BigNumber.from(amount).mul(ethers.BigNumber.from(10).pow(decimal)); console.log("Amount2: "+amount2); modal_tx_info_open(name); try { r = await contract.approve(c,amount2); if(r) { console.log("sended OK"); x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; } } catch(e) { err = web3_error_parse(e); x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_refill6_approve(amount,coin,net,decimal) { var c_mas = new Array(); c_mas = token_mas(net); var amount2; var t; var pos; var l; if(coin == "ddao2") coin = "ddao"; console.log("Coin: "+coin); var c = glob["contracts"]["refill6_"+net]; var tkn = c_mas[coin]; var name = ''; const signer2 = await get_signer2(); console.log("Contract token: "+tkn); var wal = selectedAccount; if(!wal) return false; const contract = new ethers.Contract(tkn, eth_abi["token"], signer2); name = "Approve "+amount+" "+coin.toUpperCase(); amount2 = new ethers.BigNumber.from(amount).mul(ethers.BigNumber.from(10).pow(decimal)); console.log("Amount2: "+amount2); modal_tx_info_open(name); try { r = await contract.approve(c,amount2); if(r) { console.log("sended OK"); x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; } } catch(e) { err = web3_error_parse(e); x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_refillai_approve(amount,coin,net,decimal) { var c_mas = new Array(); c_mas = token_mas(net); var amount2; var t; var pos; var l; console.log("Coin: "+coin); var c = glob["contracts"]["refillai_"+net]; var tkn = c_mas[coin]; var name = ''; const signer2 = await get_signer2(); console.log("Contract token: "+tkn); var wal = selectedAccount; if(!wal) return false; const contract = new ethers.Contract(tkn, eth_abi["token"], signer2); name = "Approve "+amount+" "+coin.toUpperCase(); amount2 = new ethers.BigNumber.from(amount).mul(ethers.BigNumber.from(10).pow(decimal)); console.log("Amount2: "+amount2); modal_tx_info_open(name); try { r = await contract.approve(c,amount2); if(r) { console.log("sended OK"); x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; } } catch(e) { err = web3_error_parse(e); x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_nftbuy_approve(amount,coin,net,decimal) { var c_mas = new Array(); c_mas = token_mas(net); var amount2; var t; var pos; var l; console.log("Coin: "+coin); var c = glob["contracts"]["nftbuy_"+net]; var tkn = c_mas[coin]; var name = ''; const signer2 = await get_signer2(); console.log("Contract token: "+tkn); var wal = selectedAccount; if(!wal) return false; const contract = new ethers.Contract(tkn, eth_abi["token"], signer2); name = "Approve "+amount+" "+coin.toUpperCase(); amount2 = new ethers.BigNumber.from(amount).mul(ethers.BigNumber.from(10).pow(decimal)); console.log("Amount2: "+amount2); modal_tx_info_open(name); try { r = await contract.approve(c,amount2); if(r) { console.log("sended OK"); x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; } } catch(e) { err = web3_error_parse(e); x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_refill_pay(net,coin,amount) { console.log('web3_refill_pay'); var ref_addr; var x; var c_mas = new Array(); c_mas = token_mas(net); var tkn = c_mas[coin]; console.log("Tkn: "+tkn); var contractAddr = glob["contracts"]["refill_"+net]; const signer2 = await get_signer2(); console.log("Contract address: "+contractAddr); var wal = selectedAccount; if(!wal) return false; const contract = new ethers.Contract(contractAddr, eth_abi["refill"], signer2); x = get_cookie("ref_wal"); ref_addr = x; if(!ref_addr) ref_addr = "0x93ED2B63fdE6BC95b21B566935c7B1Cf0C57d8C4"; if(ref_addr.toLowerCase() == wal.toLowerCase()) ref_addr = "0x93ED2B63fdE6BC95b21B566935c7B1Cf0C57d8C4"; console.log("Ref: "+ref_addr); console.log("Tkn: "+tkn); console.log("Amount: "+amount); name = "Pay "+amount+" "+coin+" into access balance"; console.log(name); modal_tx_info_open(name); try { r = await contract.Pay(ref_addr,tkn,amount); if(r) { x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; } } catch(e) { err = web3_error_parse(e); x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_refill2_pay(net,coin,amount) { console.log('web3_refill2_pay'); var data; var debug = 0; var ref_addr; var x; var c_mas = new Array(); c_mas = token_mas(net); var tkn = c_mas[coin]; console.log("Tkn: "+tkn); var contractAddr = glob["contracts"]["refill41_"+net]; const signer2 = await get_signer2(); console.log("Contract address: "+contractAddr); var wal = selectedAccount; if(!wal) return false; const contract = new ethers.Contract(contractAddr, eth_abi["refill2"], signer2); x = get_cookie("ref_wal"); ref_addr = x; if(!ref_addr) ref_addr = glob["ah_ref_addr"]; if(ref_addr.toLowerCase() == wal.toLowerCase()) ref_addr = glob["ah_ref_addr"]; if(ref_addr.toLowerCase() == '0x4c79a41a1a73cd82267b59d4278159fdbce5989a' && ref_addr.toLowerCase() != glob["default_wallet"]) { ref_addr = glob["default_wallet"]; } console.log("Ref: "+ref_addr); console.log("Tkn: "+tkn); console.log("Amount: "+amount); name = "Pay "+amount+" "+coin+" into access balance"; console.log(name); modal_tx_info_open(name); try { console.log("Debug: "+debug); data = contract.interface.encodeFunctionData('Pay', [ref_addr,tkn,amount,debug]); console.log("Data: "+data); gas = await contract.estimateGas.Pay(ref_addr,tkn,amount,debug); console.log("Gas: "+gas); console.log("From: "+wal); console.log("To: "+contractAddr); r = await contract.Pay(ref_addr,tkn,amount,debug); if(r) { set_cookie('depositPoints', parseInt(amount)*2); log("Check prod: "+glob["prod"]); x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; setTimeout(add_deposit_points, 300); setTimeout(check_points, 500); if(glob["prod"]) { ga_dataLayer_push("deposit",name+" ["+net+"]",amount,"",r.hash); log("NEED ga_dataLayer_push"); } } } catch(e) { err = web3_error_parse(e); x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_refill5_pay(net,coin,amount) { console.log('web3_refill5_pay'); var data; var debug = 0; var ref_addr; var x; var c_mas = new Array(); var pers = 30; c_mas = token_mas(net); var usd; var usd2; x = document.getElementById('modal_refill_amount'); usd = x.innerHTML; usd2 = usd * (100+pers)/100; usd2 = Math.floor(usd2); if(coin == "ddao1") coin = "ddao"; var tkn = c_mas[coin]; console.log("Tkn: "+tkn); var contractAddr = glob["contracts"]["refill5_"+net]; const signer2 = await get_signer2(); console.log("Contract address: "+contractAddr); var wal = selectedAccount; if(!wal) return false; const contract = new ethers.Contract(contractAddr, eth_abi["refill5"], signer2); console.log(eth_abi["refill5"]); x = get_cookie("ref_wal"); ref_addr = x; if(!ref_addr) ref_addr = glob["ah_ref_addr"]; if(ref_addr.toLowerCase() == wal.toLowerCase()) ref_addr = glob["ah_ref_addr"]; console.log("Ref: "+ref_addr); console.log("Tkn: "+tkn); console.log("Amount: "+amount); amount = Math.ceil(amount); console.log("Amount: "+amount); console.log("Persent: "+pers); console.log("usd: "+usd); name = "Pay ~"+amount+" "+coin.toUpperCase()+" and get "+usd2+"\$ into access balance"; console.log(name); modal_tx_info_open(name); try { console.log("Debug: "+debug); console.log("Before encodeFunctionData"); data = contract.interface.encodeFunctionData('Pay', [ref_addr,tkn,usd,pers,debug]); console.log("Data: "+data); console.log("Before estimateGas"); gas = await contract.estimateGas.Pay(ref_addr,tkn,usd,pers,debug); console.log("Gas: "+gas); console.log("From: "+wal); console.log("To: "+contractAddr); console.log("Before pay"); r = await contract.Pay(ref_addr,tkn,usd,pers,debug); if(r) { set_cookie('depositPoints', parseInt(amount)*2); log("Check prod: "+glob["prod"]); x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; setTimeout(add_deposit_points, 300); setTimeout(check_points, 500); if(glob["prod"]) { ga_dataLayer_push("deposit",name+" ["+net+"]",amount,"",r.hash); log("NEED ga_dataLayer_push"); } } } catch(e) { err = web3_error_parse(e); x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_refill6_pay(net,coin,amount) { console.log('web3_refill6_pay'); var data; var debug = 0; var ref_addr; var x; var c_mas = new Array(); var pers = 30; c_mas = token_mas(net); var usd; var usd2; x = document.getElementById('modal_refill_amount'); usd = x.innerHTML; usd2 = usd * (100+pers)/100; usd2 = Math.floor(usd2); if(coin == "ddao1") coin = "ddao"; var tkn = c_mas[coin]; console.log("Tkn: "+tkn); var contractAddr = glob["contracts"]["refill6_"+net]; const signer2 = await get_signer2(); console.log("Contract address: "+contractAddr); var wal = selectedAccount; if(!wal) return false; const contract = new ethers.Contract(contractAddr, eth_abi["refill6"], signer2); console.log(eth_abi["refill5"]); x = get_cookie("ref_wal"); ref_addr = x; if(!ref_addr) ref_addr = glob["ah_ref_addr"]; if(ref_addr.toLowerCase() == wal.toLowerCase()) ref_addr = glob["ah_ref_addr"]; console.log("Ref: "+ref_addr); console.log("Tkn: "+tkn); console.log("Amount: "+amount); amount = Math.ceil(amount); console.log("Amount: "+amount); console.log("Persent: "+pers); console.log("usd: "+usd); name = "Pay "+amount+" "+coin.toUpperCase()+" and get "+usd2+"\$ into access balance via DDAO"; console.log(name); modal_tx_info_open(name); try { console.log("Debug: "+debug); console.log("Before encodeFunctionData"); data = contract.interface.encodeFunctionData('Pay', [ref_addr,tkn,usd,pers,debug]); console.log("Data: "+data); console.log("Before estimateGas"); gas = await contract.estimateGas.Pay(ref_addr,tkn,usd,pers,debug); console.log("Gas: "+gas); console.log("From: "+wal); console.log("To: "+contractAddr); console.log("Before pay"); r = await contract.Pay(ref_addr,tkn,usd,pers,debug); if(r) { set_cookie('depositPoints', parseInt(amount)*2); log("Check prod: "+glob["prod"]); x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; setTimeout(add_deposit_points, 300); setTimeout(check_points, 500); if(glob["prod"]) { ga_dataLayer_push("deposit",name+" ["+net+"]",amount,"",r.hash); log("NEED ga_dataLayer_push"); } } } catch(e) { err = web3_error_parse(e); x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_refillai_pay(net,coin,amount) { console.log('web3_refillai_pay'); var data; var debug = 0; var ref_addr; var x; var c_mas = new Array(); var pers = 30; c_mas = token_mas(net); var usd; var usd2; var pay_name = "aicard"; x = document.getElementById('ai_card_deposit_amount'); usd = x.innerHTML; usd2 = usd * (100+pers)/100; usd2 = Math.floor(usd2); if(coin == "ddao1") coin = "ddao"; var tkn = c_mas[coin]; console.log("Tkn: "+tkn); var contractAddr = glob["contracts"]["refillai_"+net]; const signer2 = await get_signer2(); console.log("Contract address: "+contractAddr); var wal = selectedAccount; if(!wal) return false; const contract = new ethers.Contract(contractAddr, eth_abi["refillai"], signer2); x = get_cookie("ref_wal"); ref_addr = x; if(!ref_addr) ref_addr = glob["ah_ref_addr"]; if(ref_addr.toLowerCase() == wal.toLowerCase()) ref_addr = glob["ah_ref_addr"]; console.log("Ref: "+ref_addr); console.log("Tkn: "+tkn); console.log("Amount: "+amount); amount = Math.ceil(amount); console.log("Amount: "+amount); console.log("Persent: "+pers); console.log("usd: "+usd); name = "Pay "+amount+" "+coin.toUpperCase()+" and participate on AI AirdropHunter card"; console.log(name); modal_tx_info_open(name); try { console.log("Debug: "+debug); console.log("Before encodeFunctionData"); data = contract.interface.encodeFunctionData('Pay', [pay_name,tkn,usd,debug]); console.log("Data: "+data); console.log("Before estimateGas"); gas = await contract.estimateGas.Pay(pay_name,tkn,usd,debug); console.log("Gas: "+gas); console.log("From: "+wal); console.log("To: "+contractAddr); console.log("Before pay"); r = await contract.Pay(pay_name,tkn,usd,debug); if(r) { set_cookie('depositPoints', parseInt(amount)*2); x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; setTimeout(add_deposit_points, 300); setTimeout(check_points, 500); if(glob["prod"]) { ga_dataLayer_push("deposit",name+" ["+net+"]",amount,"",r.hash); log("NEED ga_dataLayer_push"); } } } catch(e) { err = web3_error_parse(e); x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_nftbuy_pay(net,coin,amount) { console.log('web3_nftbuy_pay'); var data; var debug = 0; var x; var c_mas = new Array(); c_mas = token_mas(net); var usd; var usd2; x = document.getElementById('nft_card_deposit_amount'); usd = x.innerHTML; var tkn = c_mas[coin]; console.log("Tkn: "+tkn); var contractAddr = glob["contracts"]["nftbuy_"+net]; const signer2 = await get_signer2(); console.log("Contract address: "+contractAddr); var wal = selectedAccount; if(!wal) return false; const contract = new ethers.Contract(contractAddr, eth_abi["nftbuy"], signer2); x = get_cookie("ref_wal"); console.log("Tkn: "+tkn); console.log("Amount: "+amount); amount = Math.ceil(amount); console.log("Amount: "+amount); name = "Pay "+amount+" "+coin.toUpperCase()+" and buy NFT AIRDROP HUNTER"; console.log(name); modal_tx_info_open(name); try { console.log("Debug: "+debug); console.log("Before encodeFunctionData"); data = contract.interface.encodeFunctionData('Buy', [wal,tkn]); console.log("Data: "+data); console.log("Before estimateGas"); gas = await contract.estimateGas.Buy(wal,tkn); console.log("Gas: "+gas); console.log("From: "+wal); console.log("To: "+contractAddr); console.log("Before buy"); r = await contract.Buy(wal,tkn); if(r) { set_cookie('depositPoints', parseInt(amount)*2); x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; setTimeout(add_deposit_points, 300); setTimeout(check_points, 500); if(glob["prod"]) { ga_dataLayer_push("deposit",name+" ["+net+"]",amount,"",r.hash); log("NEED ga_dataLayer_push"); } } } catch(e) { err = web3_error_parse(e); x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_circle_init_v02(id) { var gas; var l; var clone_num = 2; var tarif; var tarif_name; var t; var x; var pos; var airdrop; var tarif; var circle; var net; var c; var abi; console.log("ID: "+id); pos = id.indexOf("_"); airdrop = id.substr(0,pos); console.log("Airdrop: "+airdrop); circle = id.substr(pos+1); x = document.getElementById("modal_circle_tarif_id"); tarif = x.innerHTML; switch(airdrop) { case "1": net = "eth"; decimal = 18; c = glob["contracts"]["factory_"+net]; abi = eth_abi["factory"]; break; case "7": switch(circle) { case "3": net = "matic"; decimal = 6; c = glob["contracts"]["factory2_"+net]; clone_num = 4; abi = eth_abi["factory2"]; break; } break; case "2": case "3": case "9": case "19": case "17": case "18": net = "bsc"; decimal = 18; c = glob["contracts"]["factory2_"+net]; clone_num = 4; abi = eth_abi["factory2"]; break; case "4": net = "bsc"; decimal = 18; c = glob["contracts"]["factory2_"+net]; clone_num = 6; abi = eth_abi["factory2"]; break; case "9": net = "bsc"; decimal = 18; c = glob["contracts"]["factory2_"+net]; clone_num = 41; abi = eth_abi["factory2"]; break; case "14": net = "bsc"; decimal = 18; clone_num = 14; switch(id) { case "14_3": net = "matic"; decimal = 6; clone_num = 45; break; } c = glob["contracts"]["factory2_"+net]; abi = eth_abi["factory2"]; break; case "20": net = "bsc"; decimal = 18; c = glob["contracts"]["factory2_"+net]; clone_num = 43; abi = eth_abi["factory2"]; break; case "23": net = "bsc"; decimal = 18; c = glob["contracts"]["factory2_"+net]; clone_num = 44; abi = eth_abi["factory2"]; break; case "24": net = "matic"; decimal = 18; c = glob["contracts"]["factory41_"+net]; clone_num = 101; abi = eth_abi["factory41"]; break; case "26": net = "matic"; decimal = 6; c = glob["contracts"]["factory2_"+net]; clone_num = 46; abi = eth_abi["factory2"]; break; } switch(tarif) { case "16": clone_num = 5; break; case "23": break; } if(!selectedAccount)return false; const signer2 = await get_signer2(); var wal = selectedAccount; if(!wal) return false; switch(tarif) { case "6": clone_num = 3; break; } x = document.getElementById("modal_circle_tarif_name"); tarif_name = x.innerHTML; const contract = new ethers.Contract(c, abi, signer2); name = "Init tariff accounts ("+tarif_name+")"; console.log("tariff: "+tarif); modal_tx_info_open(name); l = glob["tarif_wallet_list"].length; if(l == 0 || l === undefined) { err = "Error loading tariff wallets
"; err += "Address: "+wal+"
"; err += "Number of wallet: "+l+"
"; err += "Reload page and try again"; x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; return false; } try { console.log("Clone_num: "+clone_num); gas = await contract.estimateGas.Init(tarif,glob["tarif_wallet_list"],clone_num); console.log("Gas: "+gas); var options = {gasLimit: Math.ceil(gas*1.2)}; r = await contract.Init(tarif,glob["tarif_wallet_list"],clone_num,options); if(r) { x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; setTimeout(web3_factory_status,15000); setTimeout(web3_factory_status,60000); } } catch(e) { err = web3_error_parse(e); x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_circle_init_v41(id) { var gas; var l; var clone_num = 2; var tarif; var tarif_name; var t; var x; var pos; var airdrop; var tarif; var circle; var net; var c; var abi; var data; var debug = 0; console.log("ID: "+id); pos = id.indexOf("_"); airdrop = id.substr(0,pos); circle = id.substr(pos+1); x = document.getElementById("modal_circle_tarif_id"); tarif = x.innerHTML; switch(airdrop) { case "1": net = "eth"; decimal = 18; c = glob["contracts"]["factory_"+net]; abi = eth_abi["factory"]; break; case "2": case "3": case "9": case "19": case "17": case "18": net = "bsc"; decimal = 18; c = glob["contracts"]["factory2_"+net]; clone_num = 4; abi = eth_abi["factory2"]; break; case "4": net = "bsc"; decimal = 18; c = glob["contracts"]["factory2_"+net]; clone_num = 6; abi = eth_abi["factory2"]; break; case "9": net = "bsc"; decimal = 18; c = glob["contracts"]["factory2_"+net]; clone_num = 41; abi = eth_abi["factory2"]; break; case "14": net = "bsc"; decimal = 18; clone_num = 14; switch(id) { case "14_3": net = "matic"; decimal = 6; clone_num = 45; break; } c = glob["contracts"]["factory2_"+net]; abi = eth_abi["factory2"]; break; case "20": net = "bsc"; decimal = 18; c = glob["contracts"]["factory2_"+net]; clone_num = 43; abi = eth_abi["factory2"]; break; case "23": net = "bsc"; decimal = 18; c = glob["contracts"]["factory2_"+net]; clone_num = 44; abi = eth_abi["factory2"]; break; case "24": net = "matic"; decimal = 18; c = glob["contracts"]["factory41_"+net]; clone_num = 101; abi = eth_abi["factory41"]; break; } switch(tarif) { case "16": clone_num = 5; break; case "23": break; } if(!selectedAccount)return false; const signer2 = await get_signer2(); var wal = selectedAccount; if(!wal) return false; x = document.getElementById("modal_circle_tarif_name"); tarif_name = x.innerHTML; const contract = new ethers.Contract(c, abi, signer2); name = "Init tariff accounts ("+tarif_name+") in circle: "+circle; console.log("tariff: "+tarif); modal_tx_info_open(name); l = glob["tarif_wallet_list"].length; if(l == 0 || l === undefined) { err = "Error loading tariff wallets
"; err += "Address: "+wal+"
"; err += "Number of wallet: "+l+"
"; err += "Reload page and try again"; x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; return false; } try { debug = 0; data = contract.interface.encodeFunctionData('Init', [tarif,circle,glob["tarif_wallet_list"],clone_num,debug]); gas = await contract.estimateGas.Init(tarif,circle,glob["tarif_wallet_list"],clone_num,debug); var options = {gasLimit: Math.ceil(gas*1.2)}; r = await contract.Init(tarif,circle,glob["tarif_wallet_list"],clone_num,debug,options); if(r) { x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; setTimeout(web3_factory_status,15000); setTimeout(web3_factory_status,60000); } } catch(e) { err = web3_error_parse(e); x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_circle_distribute_v02(circle) { var gas; var cost; var tarif; var tarif_name; var t; var x; var id; var net = "bsc"; x = document.getElementById("modal_circle_c_addr"); var c = x.innerHTML; var router = "0x10ED43C718714eb63d5aA57B78B54704E256024E"; var token = "0x55d398326f99059fF775485246999027B3197955"; var base = "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"; var debug = 0; if(!selectedAccount)return false; const signer2 = await get_signer2(); var wal = selectedAccount; if(!wal) return false; x = document.getElementById("modal_circle_cost"); cost = x.innerHTML; x = document.getElementById("modal_circle_tarif_id"); tarif = x.innerHTML; x = document.getElementById("modal_circle_tarif_name"); tarif_name = x.innerHTML; const contract = new ethers.Contract(c, eth_abi["clone"], signer2); id = tarif+"_"+circle; console.log("ID: "+id); switch(id) { case "16_7": case "17_7": case "18_7": case "19_7": case "20_7": case "21_7": name = "Distribute USDT and Bridge to SCROLL into you tariff accounts"; break; case "129_2": case "130_2": case "131_2": case "132_2": case "133_2": case "134_2": name = "Distribute USDT to server side processing to 6 month"; break; case "142_2": case "143_2": case "144_2": case "145_2": case "146_2": case "147_2": case "148_2": name = "Distribute USDT to server side processing to 4 month"; break; default: name = "Distribute BNB from USDT into you tariff accounts"; } console.log("Contract: "+c); console.log("tarif: "+tarif); console.log("Circle: "+circle); console.log("Router: "+router); console.log("Base: "+base); modal_tx_info_open(name); try { var options = {}; gas = await contract.estimateGas.Process(tarif,circle,router,token,base,debug,options); console.log("Gas: "+gas); options = {gasLimit: Math.ceil(gas*1.2)}; r = await contract.Process(tarif,circle,router,token,base,debug,options); if(r) { x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; setTimeout(web3_factory_status,15000); } } catch(e) { err = web3_error_parse(e); x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_circle_distribute_v02_matic(circle) { var gas; var cost; var tarif; var tarif_name; var t; var x; var id; var net = "matic"; x = document.getElementById("modal_circle_c_addr"); var c = x.innerHTML; var router = "0xa5e0829caced8ffdd4de3c43696c57f7d7a678ff"; var token = "0xc2132D05D31c914a87C6611C10748AEb04B58e8F"; var base = "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270"; var debug = 0; if(!selectedAccount)return false; const signer2 = await get_signer2(); var wal = selectedAccount; if(!wal) return false; x = document.getElementById("modal_circle_cost"); cost = x.innerHTML; x = document.getElementById("modal_circle_tarif_id"); tarif = x.innerHTML; x = document.getElementById("modal_circle_tarif_name"); tarif_name = x.innerHTML; const contract = new ethers.Contract(c, eth_abi["clone"], signer2); id = tarif+"_"+circle; console.log("ID: "+id); switch(id) { case "89_3": case "90_3": case "91_3": case "92_3": case "93_3": case "94_3": case "95_3": case "96_3": name = "Payment for layer3 automation and distribute POL(MATIC) for claim EYWA NFT"; break; case "129_2": case "130_2": case "131_2": case "132_2": case "133_2": case "134_2": name = "Distribute USDT to server side processing to 6 month"; break; case "142_2": case "143_2": case "144_2": case "145_2": case "146_2": case "147_2": case "148_2": name = "Distribute USDT to server side processing to 4 month"; break; default: name = "Distribute POL(MATIC) from USDT into you tariff accounts"; } console.log("Contract: "+c); console.log("tarif: "+tarif); console.log("Circle: "+circle); console.log("Router: "+router); console.log("Base: "+base); modal_tx_info_open(name); try { var options = {}; gas = await contract.estimateGas.Process(tarif,circle,router,token,base,debug,options); console.log("Gas: "+gas); options = {gasLimit: Math.ceil(gas*1.2)}; r = await contract.Process(tarif,circle,router,token,base,debug,options); if(r) { x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; setTimeout(web3_factory_status,15000); } } catch(e) { err = web3_error_parse(e); x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_circle_distribute_v41_matic(circle) { var interval = get_circle_interval(); var gas; var cost; var tarif; var tarif_name; var t; var x; var id; var amount; var net = "matic"; x = document.getElementById("modal_circle_c_addr"); var c = x.innerHTML; console.log("Contract: "+c); var router = "0xa5e0829caced8ffdd4de3c43696c57f7d7a678ff"; var token = "0xc2132D05D31c914a87C6611C10748AEb04B58e8F"; var base = "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270"; var debug = 0; if(!selectedAccount)return false; const signer2 = await get_signer2(); var wal = selectedAccount; if(!wal) return false; x = document.getElementById("modal_circle_cost"); cost = x.innerHTML; x = document.getElementById("modal_circle_tarif_id"); tarif = x.innerHTML; x = document.getElementById("modal_circle_tarif_name"); tarif_name = x.innerHTML; const contract = new ethers.Contract(c, eth_abi["clone101"], signer2); id = tarif+"_"+circle; console.log("ID: "+id); switch(id) { case "89_3": case "90_3": case "91_3": case "92_3": case "93_3": case "94_3": case "95_3": case "96_3": name = "Payment for layer3 automation and distribute MATIC for claim EYWA NFT"; break; case "129_2": case "130_2": case "131_2": case "132_2": case "133_2": case "134_2": name = "Distribute USDT to server side processing to 6 month"; break; case "142_2": case "143_2": case "144_2": case "145_2": case "146_2": case "147_2": case "148_2": name = "Distribute USDT to server side processing to 4 month"; break; case "149_2": case "150_2": case "151_2": case "152_2": case "153_2": case "154_2": amount = cost * interval; name = "Distribute "+amount+" USDT to process automation"; break; default: name = "Distribute MATIC from USDT into you tariff accounts"; } console.log("Contract: "+c); console.log("tarif: "+tarif); console.log("Circle: "+circle); console.log("Router: "+router); console.log("Base: "+base); console.log("Interval: "+interval); modal_tx_info_open(name); try { var options = {}; gas = await contract.estimateGas.Process(tarif,circle,router,token,base,interval,debug,options); console.log("Gas: "+gas); options = {gasLimit: Math.ceil(gas*1.2)}; r = await contract.Process(tarif,circle,router,token,base,interval,debug,options); if(r) { x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; setTimeout(web3_factory_status,15000); } } catch(e) { err = web3_error_parse(e); x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_distribute_approve() { var net = "bsc"; var c_mas = new Array(); c_mas = token_mas(net); var amount2; var coin = "usdt"; var x; var c; x = document.getElementById("modal_circle_c_addr"); c = x.innerHTML; console.log("Contract: "+c); var tkn = c_mas[coin]; var name = ''; const signer2 = await get_signer2(); console.log("Contract token: "+tkn); var wal = selectedAccount; if(!wal) return false; const contract = new ethers.Contract(tkn, eth_abi["token"], signer2); name = "Approve "+coin+" to distribute"; amount2 = "10000000000000000000000000000000000000000000000000"; modal_tx_info_open(name); try { r = await contract.approve(c,amount2); if(r) { console.log("sended OK"); x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; setInterval(web3_factory_status,15000); setInterval(web3_factory_status,60000); } } catch(e) { err = web3_error_parse(e); x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_distribute_approve_matic() { var net = "matic"; var decimal = 6; var c_mas = new Array(); c_mas = token_mas(net); var amount2; var amount; var coin = "usdt"; var x; var c; x = document.getElementById("modal_circle_c_addr"); c = x.innerHTML; console.log("Contract: "+c); x = document.getElementById("modal_circle_cost"); amount = x.innerHTML; var tkn = c_mas[coin]; var name = ''; const signer2 = await get_signer2(); console.log("Contract token: "+tkn); var wal = selectedAccount; if(!wal) return false; const contract = new ethers.Contract(tkn, eth_abi["token"], signer2); name = "Approve "+amount+" "+coin+" to distribute"; amount2 = amount * 10**decimal; modal_tx_info_open(name); try { r = await contract.approve(c,amount2); if(r) { console.log("sended OK"); x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; setInterval(web3_factory_status,15000); setInterval(web3_factory_status,60000); } } catch(e) { err = web3_error_parse(e); x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_distribute_approve_41(net="bsc",decimal=18) { var interval = get_circle_interval(); var c_mas = new Array(); c_mas = token_mas(net); var amount2; var coin = "usdt"; var cost; var amount; var x; var c; x = document.getElementById("modal_circle_cost"); cost = x.innerHTML; amount = cost * interval; x = document.getElementById("modal_circle_c_addr"); c = x.innerHTML; console.log("Contract: "+c); var tkn = c_mas[coin]; var name = ''; const signer2 = await get_signer2(); console.log("Contract token: "+tkn); var wal = selectedAccount; if(!wal) return false; const contract = new ethers.Contract(tkn, eth_abi["token"], signer2); name = "Approve "+amount+" "+coin+" to distribute"; amount2 = new ethers.BigNumber.from(amount).mul(ethers.BigNumber.from(10).pow(decimal)); modal_tx_info_open(name); try { r = await contract.approve(c,amount2); if(r) { console.log("sended OK"); x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; setInterval(web3_factory_status,15000); setInterval(web3_factory_status,60000); } } catch(e) { err = web3_error_parse(e); x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_circle_distribute_v03(circle) { var pers = 90; var gas; var cost; var tarif; var tarif_name; var t; var x; var net = "bsc"; x = document.getElementById("modal_circle_c_addr"); var c = x.innerHTML; var debug = 0; if(!selectedAccount)return false; const signer2 = await get_signer2(); var wal = selectedAccount; if(!wal) return false; x = document.getElementById("modal_circle_cost"); cost = x.innerHTML; x = document.getElementById("modal_circle_tarif_id"); tarif = x.innerHTML; switch(tarif) { case "23": pers = 85; break; } x = document.getElementById("modal_circle_tarif_name"); tarif_name = x.innerHTML; const contract = new ethers.Contract(c, eth_abi["clone6"], signer2); name = "Distribute BNB into you tariff accounts"; console.log("Contract: "+c); console.log("tarif: "+tarif); console.log("Circle: "+circle); console.log("Cost: "+cost); console.log("Debug: "+debug); console.log("Pers: "+pers); modal_tx_info_open(name); try { var options = {value: ethers.utils.parseEther(cost)}; gas = await contract.estimateGas.Process(tarif,circle,pers,debug,options); console.log("Gas: "+gas); options = {gasLimit: Math.ceil(gas*1.2),value: ethers.utils.parseEther(cost)}; r = await contract.Process(tarif,circle,pers,debug,options); if(r) { x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; setTimeout(web3_factory_status,15000); } } catch(e) { err = web3_error_parse(e); x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_gov_approve(net,tkn) { var amount; var d; var x; var a; var c_mas = new Array(); c_mas = token_mas(net); var c = glob["contracts"]["gov_"+net]; const signer2 = await get_signer2(); var wal = selectedAccount; if(!wal) return false; x = document.getElementById("gov_"+net+"_i_"+tkn); a = x.value; a *= 1; x = document.getElementById("gov_"+net+"_d_"+tkn); d = x.innerHTML; amount = a * 10**d; amount = BigInt(amount); amount += ""; const contract = new ethers.Contract(c_mas[tkn], eth_abi["token"], signer2); name = "Approve "+a+" "+tkn.toUpperCase()+" to deposit"; modal_tx_info_open(name); try { r = await contract.approve(c,amount); if(r) { console.log("sended OK"); x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; } } catch(e) { err = web3_error_parse(e); x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_gov_deposit(net,tkn) { var snap = 0; var debug = 0; var c_mas = new Array(); c_mas = token_mas(net); var c = glob["contracts"]["gov_"+net]; const signer2 = await get_signer2(); console.log("Contract: "+c); var wal = selectedAccount; if(!wal) return false; x = document.getElementById("gov_"+net+"_i_"+tkn); a = x.value; a *= 1; x = document.getElementById("gov_"+net+"_d_"+tkn); d = x.innerHTML; amount = a * 10**d; amount = BigInt(amount); amount += ""; const contract = new ethers.Contract(c, eth_abi["governance"], signer2); name = "Deposit "+a+" "+tkn.toUpperCase()+" to rewards"; modal_tx_info_open(name); try { gas = await contract.estimateGas.Deposit(c_mas[tkn],amount,snap,debug); console.log("Gas: "+gas); var options = {gasLimit: Math.ceil(gas*1.2)}; console.log("Deposit Amount: "+amount); r = await contract.Deposit(c_mas[tkn],amount,debug,snap,options); if(r) { x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; } } catch(e) { err = web3_error_parse(e); x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_gov_claim(rew) { var net = glob["gov_net"]; console.log("web3_gov_claim()"); if(!selectedAccount || !glob['onConnected']) { onConnect(); setTimeout(web3_gov_claim,500,rew); return false; } var c = glob["contracts"]["gov_"+net]; const signer2 = await get_signer2(); console.log("Contract: "+c); var wal = selectedAccount; if(!wal) return false; const contract = new ethers.Contract(c, eth_abi["governance"], signer2); name = "Claim rewards: "+rew; modal_tx_info_open(name); try { console.log("Rew: "+rew); gas = await contract.estimateGas.Claim(selectedAccount,rew); console.log("Gas: "+gas); var options = {gasLimit: Math.ceil(gas*1.2)}; r = await contract.Claim(selectedAccount,rew,options); if(r) { x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; } } catch(e) { err = web3_error_parse(e); x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_gov_claim_hunt_token(rew) { var net = glob["gov_net"]; console.log("web3_gov_claim()"); if(!selectedAccount || !glob['onConnected']) { onConnect(); setTimeout(web3_gov_claim,500,rew); return false; } console.log(chainId); if(chainId != 137) { change_chain('matic'); return false; } var c = glob["contracts"]["gov_"+net]; const signer2 = await get_signer2(); console.log("Contract: "+c); var wal = selectedAccount; if(!wal) return false; const contract = new ethers.Contract(c, eth_abi["governance"], signer2); name = "Claim rewards: "+rew; modal_tx_info_open(name); try { console.log("Rew: "+rew); gas = await contract.estimateGas.Claim(selectedAccount,rew); console.log("Gas: "+gas); var options = {gasLimit: Math.ceil(gas*1.2)}; r = await contract.Claim(selectedAccount,rew,options); if(r) { x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; } } catch(e) { err = web3_error_parse(e); x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_gov_withdraw(rew) { var net = glob["gov_net"]; console.log("web3_gov_withdraw()"); if(!selectedAccount || !glob['onConnected']) { onConnect(); setTimeout(web3_gov_withdraw,500,rew); return false; } var c = glob["contracts"]["gov_"+net]; const signer2 = await get_signer2(); console.log("Contract: "+c); var wal = selectedAccount; if(!wal) return false; const contract = new ethers.Contract(c, eth_abi["governance"], signer2); name = "Withdraw rewards: "+rew; modal_tx_info_open(name); try { console.log("Rew: "+rew); gas = await contract.estimateGas.Withdraw(rew); console.log("Gas: "+gas); var options = {gasLimit: Math.ceil(gas*1.2)}; r = await contract.Withdraw(rew,options); if(r) { x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; } } catch(e) { err = web3_error_parse(e); x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_gov_rew_show_hide(rew) { var net = glob["gov_net"]; console.log("web3_gov_withdraw()"); if(!selectedAccount || !glob['onConnected']) { onConnect(); setTimeout(web3_gov_rew_show_hide,500,rew); return false; } var c = glob["contracts"]["gov_"+net]; const signer2 = await get_signer2(); console.log("Contract: "+c); var wal = selectedAccount; if(!wal) return false; const contract = new ethers.Contract(c, eth_abi["governance"], signer2); name = "Show/Hide rewards: "+rew; modal_tx_info_open(name); try { console.log("Rew: "+rew); gas = await contract.estimateGas.RewardShowHide(rew); console.log("Gas: "+gas); var options = {gasLimit: Math.ceil(gas*1.2)}; r = await contract.RewardShowHide(rew,options); if(r) { x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; } } catch(e) { err = web3_error_parse(e); x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_circle_init_v03(id) { var gas; var l; var clone_num = 2; var tarif; var tarif_name; var t; var x; var pos; var airdrop; var tarif; var circle; var net; var c; var abi; console.log("ID: "+id); pos = id.indexOf("_"); airdrop = id.substr(0,pos); console.log("Airdrop: "+airdrop); circle = id.substr(pos+1); x = document.getElementById("modal_circle_tarif_id"); tarif = x.innerHTML; switch(airdrop) { case "4": net = "bsc"; decimal = 18; c = glob["contracts"]["factory3_"+net]; clone_num = 8; abi = eth_abi["factory3"]; break; case "7": switch(circle) { case "3": net = "matic"; decimal = 6; c = glob["contracts"]["factory3_"+net]; clone_num = 4; abi = eth_abi["factory3"]; break; default: net = glob["factory3_net"]; decimal = 18; c = glob["contracts"]["factory3_"+net]; clone_num = 8; abi = eth_abi["factory3"]; } break; case "5": case "8": net = glob["factory3_net"]; decimal = 18; c = glob["contracts"]["factory3_"+net]; clone_num = 8; abi = eth_abi["factory3"]; break; case "9": net = "bsc"; decimal = 18; c = glob["contracts"]["factory3_"+net]; clone_num = 8; abi = eth_abi["factory3"]; break; case "10": net = "bsc"; decimal = 18; c = glob["contracts"]["factory3_"+net]; clone_num = 8; abi = eth_abi["factory3"]; break; case "14": net = "bsc"; decimal = 18; c = glob["contracts"]["factory3_"+net]; clone_num = 8; abi = eth_abi["factory3"]; break; } console.log("Clone_num: "+clone_num); if(!selectedAccount)return false; const signer2 = await get_signer2(); var wal = selectedAccount; if(!wal) return false; x = document.getElementById("modal_circle_tarif_name"); tarif_name = x.innerHTML; const contract = new ethers.Contract(c, abi, signer2); name = "Init tariff accounts ("+tarif_name+")"; console.log("tariff: "+tarif); modal_tx_info_open(name); try { console.log("Clone_num: "+clone_num); gas = await contract.estimateGas.Init(tarif,circle,clone_num); console.log("Gas: "+gas); var options = {gasLimit: Math.ceil(gas*1.2)}; r = await contract.Init(tarif,circle,clone_num,options); if(r) { x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; setTimeout(web3_factory_status,15000); setTimeout(web3_factory_status,60000); } } catch(e) { err = web3_error_parse(e); x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_circle_distribute_v04(circle,net2="") { var cname; var pers = 90; var gas; var cost; var tarif; var tarif_name; var t; var x; var l; var net; if(net2 == "") net = glob["factory3_net"]; else net = net2; x = document.getElementById("modal_circle_c_addr"); var c = x.innerHTML; var debug = 0; if(!selectedAccount)return false; const signer2 = await get_signer2(); var wal = selectedAccount; if(!wal) return false; x = document.getElementById("modal_circle_cost"); cost = x.innerHTML; x = document.getElementById("modal_circle_tarif_id"); tarif = x.innerHTML; switch(tarif) { case "31": case "23": case "50": case "64": pers = 85; break; } x = document.getElementById("modal_circle_tarif_name"); tarif_name = x.innerHTML; const contract = new ethers.Contract(c, eth_abi["clone8"], signer2); l = glob["tarif_wallet_list"].length; if(l == 0 || l === undefined) { err = "Error loading tariff wallets
"; err += "Address: "+wal+"
"; err += "Number of wallet: "+l+"
"; err += "Reload page and try again"; x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; return false; } switch(net) { case "eth": cname = "ETH"; break; case "bsc": cname = "BNB"; break; default: cname = "COIN"; } name = "Distribute "+cost+" "+cname+" into you tariff accounts ["+l+" wallets]"; console.log("Contract: "+c); console.log("tarif: "+tarif); console.log("Circle: "+circle); console.log("Cost: "+cost); console.log("Debug: "+debug); console.log("Pers: "+pers); modal_tx_info_open(name); try { var options = {value: ethers.utils.parseEther(cost)}; gas = await contract.estimateGas.Process(tarif,circle,pers,glob["tarif_wallet_list"],debug,options); console.log("Gas: "+gas); options = {gasLimit: Math.ceil(gas*1.2),value: ethers.utils.parseEther(cost)}; r = await contract.Process(tarif,circle,pers,glob["tarif_wallet_list"],debug,options); if(r) { x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; setTimeout(web3_factory_status,15000); } } catch(e) { err = web3_error_parse(e); x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_ref_claim20(net="bsc",cost=20) { var cname; var o = new Object(); o.name = whoCallsMe2(); var t; var x; var l; var ref; var c = glob["contracts"]["ref_claim20_"+net]; var debug = 0; const signer2 = await get_signer2(); var wal = selectedAccount; if(!wal) return false; const contract = new ethers.Contract(c, eth_abi["ref_claim20"], signer2); ref = get_cookie("ref_wal"); name = "Claim \$"+cost+" into you DEPOSIT"; console.log("Ref: "+ref); modal_tx_info_open(name); o.txt = name; try { console.log("From: "+wal); console.log("To: "+c); data = contract.interface.encodeFunctionData('Claim', [ref]); console.log("Data: "+data); o.from = wal; o.to = c; o.data = data; web_log(o.name,o); gas = await contract.estimateGas.Claim(ref); console.log("Gas: "+gas); options = {gasLimit: Math.ceil(gas*1.2)}; r = await contract.Claim(ref,options); if(r) { x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; anim.goToAndPlay(0); setTimeout(web3_factory_status,15000); } } catch(e) { err = web3_error_parse(e); x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_ref_claim20_2(net="bsc",cost=20) { var o = new Object(); o.name = whoCallsMe2(); var t; var x; var l; var ref; var c = glob["contracts"]["ref_claim20_02_"+net]; const signer2 = await get_signer2(); var wal = selectedAccount; if(!wal) return false; const contract = new ethers.Contract(c, eth_abi["ref_claim20_02"], signer2); ref = get_cookie("ref_wal"); if(!ref)ref = glob["ah_ref_addr"]; name = "Claim \$"+cost+" into you DEPOSIT"; console.log("Ref: "+ref); modal_tx_info_open(name); o.txt = name; try { console.log("From: " + wal); console.log("To: " + c); console.log("Ref: " + ref); const data = contract.interface.encodeFunctionData('Claim', [ref]); console.log("Data: " + data); o.from = wal; o.to = c; o.data = data; web_log(o.name, o); const currentCost = await contract.Cost(); console.log("Cost: "+currentCost); var options = { value: currentCost.toString() }; r = await contract.Claim(ref, options); if (r) { x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; anim.goToAndPlay(0); setTimeout(add_100_points, 300); setTimeout(check_points, 500); setTimeout(web3_factory_status,15000); } } catch(e) { err = web3_error_parse(e); if (err.includes('insufficient funds for gas')) { err = 'Error: Insufficient balance.'; } x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_ref_claim_tonapp1(net="bsc",cost=20) { tonapp1_send_status_set(7,"Click on Claim button"); var o = new Object(); o.name = whoCallsMe2(); var t; var x; var l; var currentCost; var ref; var c = glob["contracts"]["ref_claim_tonapp1_"+net]; console.log("Contract: "+c); const signer2 = await get_signer2(); var wal = selectedAccount; if(!wal) return false; const contract = new ethers.Contract(c, eth_abi["ref_claim_tonapp1"], signer2); ref = get_cookie("ref_wal"); if(!ref)ref = glob["ah_ref_addr"]; name = "Claim \$"+cost+" into you DEPOSIT"; console.log("Ref: "+ref); modal_tx_info_open(name); o.txt = name; try { console.log("From: " + wal); console.log("To: " + c); console.log("Cost: "+cost); console.log("Try to fetch data"); const data = contract.interface.encodeFunctionData('Claim', [ref,cost]); console.log("Data: " + data); o.from = wal; o.to = c; o.data = data; web_log(o.name, o); currentCost = await contract.Cost(); currentCost = currentCost.toString(); console.log("Cost: "+currentCost); var options = { value: currentCost }; r = await contract.Claim(ref,cost, options); if (r) { tonapp1_send_status_set(5,"tx: "+r.hash); x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; anim.goToAndPlay(0); setTimeout(add_100_points, 500); setTimeout(check_points, 500); } } catch(e) { err = web3_error_parse(e); if (err.includes('insufficient funds for gas')) { err = 'Error: Insufficient balance. Total fee for claim: ~0.02 BNB'; } tonapp1_send_status_set(-1,"tx error: "+err); x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_ref_claim_get100(item,id,code,signature) { var net = "bsc"; var cost = 25; var cname; var o = new Object(); o.name = whoCallsMe2(); var t; var x; var l; var ref; var c = glob["contracts"]["ref_claim_get100_"+net]; var debug = 0; const signer2 = await get_signer2(); var wal = selectedAccount; if(!wal) return false; const contract = new ethers.Contract(c, eth_abi["ref_claim_get100"], signer2); ref = get_cookie("ref_wal"); if(!ref)ref = glob["ah_ref_addr"]; switch(item+"") { case "1": cname = "for your email subscribe"; break; case "2": cname = "for twitter following"; break; case "3": cname = "for retweet"; break; case "4": cname = "for your telegram subscribe"; break; } name = "Claim \$"+cost+": "+cname; console.log("Contract: "+c); console.log("id: "+id); console.log("item: "+item); console.log("Ref: "+ref); console.log("sign: "+signature); modal_tx_info_open(name); o.txt = name; try { console.log("From: "+wal); console.log("To: "+c); data = contract.interface.encodeFunctionData('Claim', [item,id,code,ref,signature]); console.log("Data: "+data); o.from = wal; o.to = c; o.data = data; web_log(o.name,o); gas = await contract.estimateGas.Claim(item,id,code,ref,signature); console.log("Gas: "+gas); options = {gasLimit: Math.ceil(gas*1.2)}; r = await contract.Claim(item,id,code,ref,signature,options); if(r) { x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; anim.goToAndPlay(0); setTimeout(web3_factory_status,15000); } } catch(e) { err = web3_error_parse(e); x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_distribute_node_approve() { var net = "bsc"; var c_mas = new Array(); c_mas = token_mas(net); var amount2; var coin = "usdt"; var decimal = 18; var amount; var x; var c; x = document.getElementById("modal_circle_cost"); amount = x.innerHTML; x = document.getElementById("modal_circle_c_addr"); c = x.innerHTML; console.log("Contract: "+c); var tkn = c_mas[coin]; var name = ''; const signer2 = await get_signer2(); console.log("Contract token: "+tkn); var wal = selectedAccount; if(!wal) return false; const contract = new ethers.Contract(tkn, eth_abi["token"], signer2); name = "Approve "+amount+" "+coin+" to distribute"; amount2 = new ethers.BigNumber.from(amount).mul(ethers.BigNumber.from(10).pow(decimal)); modal_tx_info_open(name); try { r = await contract.approve(c,amount2); if(r) { console.log("sended OK"); x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; setInterval(web3_factory_status,15000); setInterval(web3_factory_status,60000); } } catch(e) { err = web3_error_parse(e); x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_distribute_node2_approve() { var net = "bsc"; var c_mas = new Array(); c_mas = token_mas(net); var amount2; var coin = "usdt"; var decimal = 18; var amount; var x; var c; x = document.getElementById("modal_circle_cost"); amount = x.innerHTML; x = document.getElementById("modal_circle_c_addr"); c = x.innerHTML; console.log("Contract: "+c); var tkn = c_mas[coin]; var name = ''; const signer2 = await get_signer2(); console.log("Contract token: "+tkn); var wal = selectedAccount; if(!wal) return false; const contract = new ethers.Contract(tkn, eth_abi["token"], signer2); name = "Approve "+amount+" "+coin+" to distribute"; amount2 = new ethers.BigNumber.from(amount).mul(ethers.BigNumber.from(10).pow(decimal)); modal_tx_info_open(name); try { r = await contract.approve(c,amount2); if(r) { console.log("sended OK"); x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; setInterval(web3_factory_status,15000); setInterval(web3_factory_status,60000); } } catch(e) { err = web3_error_parse(e); x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_distribute_node_approve_a1() { var net = "bsc"; var interval = get_circle_interval(); var c_mas = new Array(); c_mas = token_mas(net); var amount2; var coin = "usdt"; var decimal = 18; var cost; var amount; var x; var c; x = document.getElementById("modal_circle_cost"); cost = x.innerHTML; amount = cost * interval; x = document.getElementById("modal_circle_c_addr"); c = x.innerHTML; console.log("Contract: "+c); var tkn = c_mas[coin]; var name = ''; const signer2 = await get_signer2(); console.log("Contract token: "+tkn); var wal = selectedAccount; if(!wal) return false; const contract = new ethers.Contract(tkn, eth_abi["token"], signer2); name = "Approve "+amount+" "+coin+" to distribute"; amount2 = new ethers.BigNumber.from(amount).mul(ethers.BigNumber.from(10).pow(decimal)); modal_tx_info_open(name); try { r = await contract.approve(c,amount2); if(r) { console.log("sended OK"); x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; setInterval(web3_factory_status,15000); setInterval(web3_factory_status,60000); } } catch(e) { err = web3_error_parse(e); x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_circle_distribute_node(circle) { var gas; var cost; var tarif; var tarif_name; var t; var x; var net = "bsc"; var amount; x = document.getElementById("modal_circle_cost"); amount = x.innerHTML; x = document.getElementById("modal_circle_c_addr"); var c = x.innerHTML; var debug = 0; if(!selectedAccount)return false; const signer2 = await get_signer2(); var wal = selectedAccount; if(!wal) return false; x = document.getElementById("modal_circle_cost"); cost = x.innerHTML; x = document.getElementById("modal_circle_tarif_id"); tarif = x.innerHTML; x = document.getElementById("modal_circle_tarif_name"); tarif_name = x.innerHTML; const contract = new ethers.Contract(c, eth_abi["distribute_nodes"], signer2); name = "Distribute "+amount+" USDT for node processing"; console.log("Contract: "+c); console.log("tarif: "+tarif); console.log("Circle: "+circle); console.log("Cost: "+cost); console.log("Debug: "+debug); modal_tx_info_open(name); try { data = contract.interface.encodeFunctionData('Process', [tarif,circle,debug]); console.log("Data: "+data); var options = {}; console.log(options); console.log("before Gas"); gas = await contract.estimateGas.Process(tarif,circle,debug,options); console.log("after Gas"); console.log("Gas: "+gas); options = {gasLimit: Math.ceil(gas*1.2)}; r = await contract.Process(tarif,circle,debug,options); if(r) { x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; setTimeout(web3_factory_status,15000); } } catch(e) { err = web3_error_parse(e); x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_circle_distribute_node2(circle) { console.log("web3_circle_distribute_node2"); var gas; var cost; var tarif; var tarif_name; var t; var x; var net = "bsc"; var amount; x = document.getElementById("modal_circle_cost"); amount = x.innerHTML; x = document.getElementById("modal_circle_c_addr"); var c = x.innerHTML; var debug = 0; if(!selectedAccount)return false; const signer2 = await get_signer2(); var wal = selectedAccount; if(!wal) return false; x = document.getElementById("modal_circle_cost"); cost = x.innerHTML; x = document.getElementById("modal_circle_tarif_id"); tarif = x.innerHTML; x = document.getElementById("modal_circle_tarif_name"); tarif_name = x.innerHTML; const contract = new ethers.Contract(c, eth_abi["distribute_nodes"], signer2); name = "Distribute "+amount+" USDT for node processing"; console.log("Contract: "+c); console.log("tarif: "+tarif); console.log("Circle: "+circle); console.log("Cost: "+cost); console.log("Debug: "+debug); modal_tx_info_open(name); try { data = contract.interface.encodeFunctionData('Process', [tarif,circle,debug]); console.log("Data: "+data); var options = {}; console.log(options); console.log("before Gas"); gas = await contract.estimateGas.Process(tarif,circle,debug,options); console.log("after Gas"); console.log("Gas: "+gas); options = {gasLimit: Math.ceil(gas*1.2)}; r = await contract.Process(tarif,circle,debug,options); if(r) { x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; setTimeout(web3_factory_status,15000); } } catch(e) { err = web3_error_parse(e); x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_circle_distribute_node_a1(circle) { var interval = get_circle_interval(); console.log("Interval: "+interval); var gas; var cost; var tarif; var tarif_name; var t; var x; var net = "bsc"; var amount; var amount2; var utime = Math.floor(Date.now() / 1000); var period = 86400*30; var until; var until2; x = document.getElementById("modal_circle_distributed"); until = x.innerHTML; until *= 1; if(until == 0) until = utime + period * interval; else until += period * interval; until2 = utime_to_localtime(until); x = document.getElementById("modal_circle_cost"); amount = x.innerHTML; amount2 = amount * interval; x = document.getElementById("modal_circle_c_addr"); var c = x.innerHTML; var debug = 0; if(!selectedAccount)return false; const signer2 = await get_signer2(); var wal = selectedAccount; if(!wal) return false; x = document.getElementById("modal_circle_cost"); cost = x.innerHTML; x = document.getElementById("modal_circle_tarif_id"); tarif = x.innerHTML; x = document.getElementById("modal_circle_tarif_name"); tarif_name = x.innerHTML; const contract = new ethers.Contract(c, eth_abi["distribute_nodes_a1"], signer2); name = "Distribute "+amount2+" USDT for node processing on "+interval+" month
until "+until2; console.log("Contract: "+c); console.log("tarif: "+tarif); console.log("Circle: "+circle); console.log("Cost: "+cost); console.log("Debug: "+debug); modal_tx_info_open(name); try { data = contract.interface.encodeFunctionData('Process', [tarif,circle,interval,debug]); console.log("Data: "+data); var options = {}; console.log(options); console.log("before Gas"); gas = await contract.estimateGas.Process(tarif,circle,interval,debug,options); console.log("after Gas"); console.log("Gas: "+gas); options = {gasLimit: Math.ceil(gas*1.2)}; r = await contract.Process(tarif,circle,interval,debug,options); if(r) { x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; setTimeout(web3_factory_status,15000); } } catch(e) { err = web3_error_parse(e); x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_rew_claim(net="bsc",id,amount) { var cname; var o = new Object(); o.name = whoCallsMe2(); var t; var x; var l; var ref; switch(net) { case "matic": chain = 137; nchain = "Polygon"; break; case "bsc": chain = 56; nchain = "BSC"; break; case "eth": chain = 1; nchain = "Ethereum"; break; case "mumbai": chain = 80001; nchain = "Mumbai"; break; } if(chainId != chain) { change_chain(net); return false; } var c = glob["contracts"]["ref_claim_"+net]; var debug = 0; const signer2 = await get_signer2(); var wal = selectedAccount; if(!wal) return false; const contract = new ethers.Contract(c, eth_abi["ref_claim"], signer2); name = "Claim "+amount+" USDT [id:"+id+"] on "+nchain; modal_tx_info_open(name); o.txt = name; try { console.log("From: "+wal); console.log("To: "+c); data = contract.interface.encodeFunctionData('Claim', [wal,id]); console.log("Data: "+data); o.from = wal; o.to = c; o.data = data; web_log(o.name,o); gas = await contract.estimateGas.Claim(wal,id); console.log("Gas: "+gas); options = {gasLimit: Math.ceil(gas*1.2)}; r = await contract.Claim(wal,id,options); if(r) { x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; anim.goToAndPlay(0); setTimeout(web3_factory_status,15000); t = "btn_"+net+"_"+id; console.log("need disable btn: "+t); y = document.getElementById(t); y.innerHTML = "Claimed"; y.classList.add("disabled"); } } catch(e) { err = web3_error_parse(e); x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_ref_china_claim(net="bsc") { var cname; var o = new Object(); o.name = whoCallsMe2(); var t; var x; var l; var ref; var c = glob["contracts"]["ref_claim_china_"+net]; var debug = 0; const signer2 = await get_signer2(); var wal = selectedAccount; if(!wal) return false; const provider = new ethers.providers.Web3Provider(window.ethereum); const contract = new ethers.Contract(c, eth_abi["ref_claim_china"], signer2); selectedAccount = get_cookie("selectedAccount"); if (get_cookie("ref_wal") !== undefined) { ref = get_cookie("ref_wal"); } else { ref = default_wallet; } claimAmount = get_cookie('randomChinaNumber'); name = "Сlaim you bonus between 10\$ and 50\$(randomly) on deposit"; console.log("Ref: "+ref); modal_tx_info_open(name); o.txt = name; try { console.log("From: " + wal); console.log("To: " + c); data = contract.interface.encodeFunctionData('Claim', [ref, claimAmount]); o.from = wal; o.to = c; o.data = data; web_log(o.name, o); var cost = await contract.Cost(); var tx = { value: ethers.utils.parseEther('0.015') }; r = await contract.Claim(ref, claimAmount, tx); if(r) { x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; anim.goToAndPlay(0); var claim = await contract.Claimed(selectedAccount); set_cookie("chineseClaimed", claim.status); checkModalClaim(); if($('#chinese_button')) { $('#chinese_button').hide(); } setTimeout(web3_factory_status,15000); } } catch(e) { err = web3_error_parse(e); if (err.includes('insufficient funds for gas')) { err = 'Error: Insufficient balance. Total fee for claim: ~0.015BNB'; } x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_ogc_claim_bonus(net="bsc") { var o = new Object(); o.name = whoCallsMe2(); var x; var ref; var c = glob["contracts"]["ref_claim_socialfi_"+net]; const signer2 = await get_signer2(); var wal = selectedAccount; if(!wal) return false; const provider = new ethers.providers.Web3Provider(window.ethereum); const contract = new ethers.Contract(c, eth_abi["ref_claim_socialfi"], signer2); selectedAccount = get_cookie("selectedAccount"); if (get_cookie("ref_wal") !== undefined) { ref = get_cookie("ref_wal"); } else { ref = default_wallet; } name = "Claim you bonus."; console.log("Ref: "+ref); modal_tx_info_open(name); o.txt = name; try { console.log("From: " + wal); console.log("To: " + c); data = contract.interface.encodeFunctionData('Claim', [1, ref]); o.from = wal; o.to = c; o.data = data; web_log(o.name, o); const currentCost = await contract.CostGet(1); var options = { value: currentCost.toString() }; r = await contract.Claim(1, ref, options); if(r) { x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; anim.goToAndPlay(0); setTimeout(web3_factory_status,15000); } } catch(e) { err = web3_error_parse(e); if (err.includes('insufficient funds for gas')) { err = 'Error: Insufficient balance. Total fee for claim: ~0.024BNB'; } x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_solana_claim_bonus(net="bsc") { var o = new Object(); o.name = whoCallsMe2(); var x; var ref; var c = glob["contracts"]["ref_claim_socialfi_"+net]; const signer2 = await get_signer2(); var wal = selectedAccount; if(!wal) return false; const provider = new ethers.providers.Web3Provider(window.ethereum); const contract = new ethers.Contract(c, eth_abi["ref_claim_socialfi"], signer2); if (get_cookie("ref_wal") !== undefined) { ref = get_cookie("ref_wal"); } else { ref = default_wallet; } name = "Claim you bonus"; console.log("Ref: "+ref); modal_tx_info_open(name); o.txt = name; try { console.log("From: " + wal); console.log("To: " + c); data = contract.interface.encodeFunctionData('Claim', [2, ref]); o.from = wal; o.to = c; o.data = data; web_log(o.name, o); const currentCost = await contract.CostGet(2); var options = { value: currentCost.toString() }; r = await contract.Claim(2, ref, options); if(r) { x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; anim.goToAndPlay(0); setTimeout(web3_factory_status,15000); } } catch(e) { err = web3_error_parse(e); if (err.includes('insufficient funds for gas')) { err = 'Error: Insufficient balance. Total fee for claim: ~0.024BNB'; } x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_claimai1_claim() { var o = new Object(); o.name = whoCallsMe2(); var x; var net = "matic"; var ref; var c = glob["contracts"]["claimai_"+net]; const signer2 = await get_signer2(); var wal = selectedAccount; if(!wal) return false; const provider = new ethers.providers.Web3Provider(window.ethereum); const contract = new ethers.Contract(c, eth_abi["claimai"], signer2); name = "Claim "+glob["claimai1"].amount+" USDT"; modal_tx_info_open(name); o.txt = name; try { console.log("From: " + wal); console.log("To: " + c); data = contract.interface.encodeFunctionData('Claim', [selectedAccount]); o.from = wal; o.to = c; o.data = data; web_log(o.name, o); var currentCost = 10 * 10**18; var options = { value: currentCost.toString() }; r = await contract.Claim(selectedAccount, options); if(r) { x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; anim.goToAndPlay(0); } } catch(e) { err = web3_error_parse(e); if (err.includes('insufficient funds for gas')) { err = 'Error: Insufficient balance. Total fee for claim: 10 MATIC'; } x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } async function web3_claimai2_claim() { var o = new Object(); o.name = whoCallsMe2(); var x; var net = "matic"; var ref; var c = glob["contracts"]["claimai2_"+net]; const signer2 = await get_signer2(); var wal = selectedAccount; if(!wal) return false; const provider = new ethers.providers.Web3Provider(window.ethereum); const contract = new ethers.Contract(c, eth_abi["claimai"], signer2); name = "Claim "+glob["claimai2"].amount+" USDT"; modal_tx_info_open(name); o.txt = name; try { console.log("From: " + wal); console.log("To: " + c); data = contract.interface.encodeFunctionData('Claim', [selectedAccount]); o.from = wal; o.to = c; o.data = data; web_log(o.name, o); var currentCost = 20 * 10**18; var options = { value: currentCost.toString() }; r = await contract.Claim(selectedAccount, options); if(r) { x = document.getElementById('modal_txs_info_id'); x.innerHTML = r.hash; console.log(r); x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'View in Explorer'; x.disabled = 0; anim.goToAndPlay(0); } } catch(e) { err = web3_error_parse(e); if (err.includes('insufficient funds for gas')) { err = 'Error: Insufficient balance. Total fee for claim: 20 POL(old MATIC)'; } x = document.getElementById('modal_txs_info_err'); x.innerHTML = err; x = document.getElementById('modal_txs_info_btn'); x.innerHTML = 'Transaction error'; } } glob["abi"] = [ "function claim(uint8 round)external", "function approve(address spender, uint256 amount) external returns (bool)", ]; glob["abi_ref_register"] = [ "function NickRegister(string memory name) external payable returns(bool)", ]; glob["abi_ref_balance"] = [ "function Balance(address addr)external view returns(uint256)", ]