diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 7df02399..ce2d2c70 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -38,7 +38,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL diff --git a/.github/workflows/deploy-airwire-testnet.yaml b/.github/workflows/deploy-airwire-testnet.yaml index f19d67d4..3dec4226 100644 --- a/.github/workflows/deploy-airwire-testnet.yaml +++ b/.github/workflows/deploy-airwire-testnet.yaml @@ -11,13 +11,13 @@ jobs: environment: airwire-testnet steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - - name: Log in to the Container registry - uses: docker/login-action@v2 + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3.1.0 with: registry: ghcr.io - username: ${{ github.actor }} + username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: 'step-log' diff --git a/.github/workflows/deploy-airwire.yaml b/.github/workflows/deploy-airwire.yaml index 62783f33..edf0af00 100644 --- a/.github/workflows/deploy-airwire.yaml +++ b/.github/workflows/deploy-airwire.yaml @@ -11,13 +11,13 @@ jobs: environment: airwire steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - - name: Log in to the Container registry - uses: docker/login-action@v2 + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3.1.0 with: registry: ghcr.io - username: ${{ github.actor }} + username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: 'step-log' diff --git a/.github/workflows/deploy-fio-testnet.yaml b/.github/workflows/deploy-fio-testnet.yaml new file mode 100644 index 00000000..d5b95470 --- /dev/null +++ b/.github/workflows/deploy-fio-testnet.yaml @@ -0,0 +1,136 @@ +name: Build images for FIO testnet environment + +on: + push: + tags: + - fio-testnet-v* + +jobs: + create-fio-testnet-image: + runs-on: ubuntu-latest + environment: fio-testnet + steps: + - name: Checkout Repo + uses: actions/checkout@v4 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3.1.0 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: 'step-log' + run: | + echo "github.ref: ${{github.ref}}" + + - name: Build new images and push + run: | + make \ + build-docker-images \ + push-docker-images + env: + DOCKER_USERNAME: ${{ secrets.DOCKER_HUB_USER }} + DOCKER_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }} + # webapp + PORT: '80' + REACT_APP_TITLE: 'FIO Testnet Network Dashboard' + REACT_APP_VERSION: ${{github.ref}} + REACT_APP_DEFAULT_PRODUCER_LOGO: 'https://antelope.tools/images/fio.png' + REACT_APP_FOOTER_LINKS: '[{ "text": "FIO Website", "src": "https://fio.net/" },{ "text": "FIO Block Explorer", "src": "https://fio-test.bloks.io/" },{"text": "Documentation","src": "https://dev.fio.net/"},{"text": "FIO Network Monitor","src": "https://fio.antelope.tools"}]' + REACT_APP_EOS_RATE_LINK: '' + REACT_APP_USE_REWARDS: 'true' + REACT_APP_USE_VOTES: 'true' + REACT_APP_HASURA_URL: 'https://graphql-fio-testnet.antelope.tools/v1/graphql' + REACT_APP_EOS_API_NETWORK_NAME: 'fio-testnet' + REACT_APP_EOS_API_NETWORK_LABEL: 'FIO Testnet' + REACT_APP_EOS_API_NETWORK_LOGO: 'https://antelope.tools/images/fio.png' + REACT_APP_EOS_API_HOSTS: '[\"testnet.fioprotocol.io\",\"fio-testnet.eosphere.io\"]' + REACT_APP_EOS_API_PORT: '443' + REACT_APP_EOS_API_PROTOCOL: 'https' + REACT_APP_EOS_CHAIN_ID: 'b20901380af44ef59c5918439a1f9a41d83669020319a80574b804a5f95cbd7e' + REACT_APP_EOS_USE_BP_JSON_ON_CHAIN: 'false' + REACT_APP_EOS_BP_JSON_ON_CHAIN_CONTRACT: 'producerjson' + REACT_APP_EOS_BP_JSON_ON_CHAIN_TABLE: 'producerjson' + REACT_APP_EOS_BP_JSON_ON_CHAIN_SCOPE: 'producerjson' + REACT_APP_SYNC_TOLERANCE_INTERVAL: 180000 + REACT_APP_TOKEN_SYMBOL: 'FIO' + REACT_APP_NETWORK_URL: '[{"label":"EOS","value":"https://eos.antelope.tools","mainnet":true,"icon":"eos","order":5},{"label":"XPR Network","value":"https://xpr.antelope.tools","mainnet":true,"icon":"xpr","order":3},{"label":"WAX","value":"https://wax.antelope.tools","mainnet":true,"icon":"wax","order":4},{"label":"Telos","value":"https://telos.antelope.tools","mainnet":true,"icon":"telos","order":1},{"label":"Libre","value":"https://libre.antelope.tools","mainnet":true,"icon":"libre","order":2},{"label":"LACChain EOSIO","value":"https://lacchain.antelope.tools","mainnet":true,"icon":"lacchain","order":6},{"label":"Jungle4 Testnet","value":"https://jungle.antelope.tools","mainnet":false,"icon":"jungle","order":5},{"label":"XPR Testnet","value":"https://xpr-testnet.antelope.tools","mainnet":false,"icon":"xpr","order":3},{"label":"WAX Testnet","value":"https://wax-testnet.antelope.tools","mainnet":false,"icon":"wax","order":4},{"label":"Telos Testnet","value":"https://telos-testnet.antelope.tools","mainnet":false,"icon":"telos","order":1},{"label":"Libre Testnet","value":"https://libre-testnet.antelope.tools","mainnet":false,"icon":"libre","order":2},{"label":"Ultra Testnet","value":"https://ultra-testnet.antelope.tools","mainnet":false,"icon":"ultra","order":6}]' + REACT_APP_DISABLED_MENU_ITEMS: '["/missed-blocks","/block-distribution","/cpu-benchmark","/stress-test","/evm","/evm-rpc-endpoints"]' + REACT_APP_BLOCK_EXPLORER_URL: '{"url": "https://fio-test.bloks.io/", "tx": "/transaction/(transaction)", "account": {"url":"/account/","abi":"","actions":""}}' + REACT_APP_STATE_HISTORY_ENABLED: 'false' + REACT_APP_GOOGLE_ANALITIC_PAGE_ID: 'G-E6Y0EC9FT8' + REACT_APP_PUBLIC_RE_CAPTCHA_KEY: ${{ secrets.REACT_APP_PUBLIC_RE_CAPTCHA_KEY }} + + - name: Build and deploy kubernetes files + id: build_kubernetes_files + run: | + make \ + build-kubernetes + env: + # general + NAMESPACE: fio-testnet-dashboard + INGRESS_HOST: fio-testnet.antelope.tools + INGRESS_GRAPHQL_HOST: graphql-fio-testnet.antelope.tools + # webapp + REACT_APP_EOS_API_NETWORK_NAME: fio-testnet + # postgres + POSTGRES_USER: ${{ secrets.POSTGRES_USER }} + POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} + POSTGRES_DB: ${{ secrets.POSTGRES_DB }} + POSTGRES_DATA: ${{ secrets.POSTGRES_DATA }} + # hapi + HAPI_EOS_API_NETWORK_NAME: fio-testnet + HAPI_EOS_API_ENDPOINTS: '["https://testnet.fioprotocol.io","https://fio-testnet.eosphere.io"]' + HAPI_EOS_STATE_HISTORY_PLUGIN_ENDPOINT: '' + HAPI_EOS_MISSED_BLOCKS_ENABLED: 'false' + HAPI_EOS_BLOCK_HISTORY_DAYS: 90 + HAPI_EOS_MAX_CPU_BLOCK: 250000 + HAPI_EOS_MAX_NET_BLOCK: 1048576 + HAPI_EOS_API_CHAIN_ID: b20901380af44ef59c5918439a1f9a41d83669020319a80574b804a5f95cbd7e + HAPI_EOS_BASE_ACCOUNT: ${{ secrets.HAPI_EOS_BASE_ACCOUNT }} + HAPI_EOS_BASE_ACCOUNT_PASSWORD: ${{ secrets.HAPI_EOS_BASE_ACCOUNT_PASSWORD }} + HAPI_EOS_MECHANICS_ACCOUNT: ${{ secrets.HAPI_EOS_MECHANICS_ACCOUNT }} + HAPI_EOS_MECHANICS_PASSWORD: ${{ secrets.HAPI_EOS_MECHANICS_PASSWORD }} + HAPI_EOS_MECHANICS_CUSTOM_PERMISSION: 'benchmark' + HAPI_EOS_FAUCET_ACCOUNT_PASSWORD: ${{ secrets.HAPI_EOS_FAUCET_ACCOUNT_PASSWORD }} + GOOGLE_CREDENTIALS_JSON: ${{ secrets.GOOGLE_CREDENTIALS_JSON }} + HAPI_EOS_WALLET_URL: http://dashboard-wallet:8888 + HAPI_EOS_BP_JSON_ON_CHAIN: 'false' + HAPI_EOS_BP_JSON_ON_CHAIN_CONTRACT: producerjson + HAPI_EOS_BP_JSON_ON_CHAIN_TABLE: producerjson + HAPI_EOS_BP_JSON_ON_CHAIN_SCOPE: producerjson + HAPI_HASURA_URL: 'http://dashboard-hasura:8080/v1/graphql' + HAPI_HASURA_ADMIN_SECRET: ${{ secrets.HAPI_HASURA_ADMIN_SECRET }} + HAPI_SERVER_PORT: '9090' + HAPI_SERVER_ADDRESS: '0.0.0.0' + HAPI_DATABASE_URL: ${{ secrets.HAPI_DATABASE_URL }} + HAPI_SYNC_PRODUCERS_INTERVAL: '14400' + HAPI_SYNC_PRODUCER_CPU_INTERVAL: '6' + HAPI_SYNC_PRODUCER_INFO_INTERVAL: '1' + HAPI_SYNC_SCHEDULE_HISTORY_INTERVAL: 86400 + HAPI_SYNC_STATS_INTERVAL: 3600 + HAPI_EOS_EXCHANGE_RATE_API: https://api.coingecko.com/api/v3/simple/price?ids=fio-protocol&vs_currencies=usd + HAPI_COINGECKO_API_TOKEN_ID: fio-protocol + HAPI_REWARDS_TOKEN: FIO + HAPI_CREATE_ACCOUNT_ACTION_NAME: newaccount + HAPI_EOS_FAUCET_ACCOUNT: ${{ secrets.HAPI_EOS_FAUCET_ACCOUNT }} + GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }} + HAPI_EOS_GET_FAUCET_ACCOUNT: ${{ secrets.HAPI_EOS_GET_FAUCET_ACCOUNT }} + HAPI_PUBLIC_RE_CAPTCHA_KEY: ${{ secrets.HAPI_PUBLIC_RE_CAPTCHA_KEY }} + HAPI_RE_CAPTCHA_PROJECT_ID: ${{ secrets.HAPI_RE_CAPTCHA_PROJECT_ID }} + # hasura + HASURA_GRAPHQL_ENABLE_CONSOLE: 'true' + HASURA_GRAPHQL_DATABASE_URL: ${{ secrets.HASURA_GRAPHQL_DATABASE_URL }} + HASURA_GRAPHQL_ADMIN_SECRET: ${{ secrets.HASURA_GRAPHQL_ADMIN_SECRET }} + HASURA_GRAPHQL_UNAUTHORIZED_ROLE: guest + HASURA_GRAPHQL_ACTION_BASE_URL: http://dashboard-hapi:9090 + + - name: Setup and deploy kubernetes environment + uses: steebchen/kubectl@v1.1.0 + env: + KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }} + NAMESPACE: fio-testnet-dashboard + K8S_BUILD_DIR: build_k8s + with: + args: version && make deploy-kubernetes diff --git a/.github/workflows/deploy-jungle-testnet.yaml b/.github/workflows/deploy-jungle-testnet.yaml index a925584a..854d4293 100644 --- a/.github/workflows/deploy-jungle-testnet.yaml +++ b/.github/workflows/deploy-jungle-testnet.yaml @@ -11,13 +11,13 @@ jobs: environment: jungle-testnet steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - - name: Log in to the Container registry - uses: docker/login-action@v2 + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3.1.0 with: registry: ghcr.io - username: ${{ github.actor }} + username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build new images and push diff --git a/.github/workflows/deploy-lacchain.yaml b/.github/workflows/deploy-lacchain.yaml index b3a652b1..9aebf796 100644 --- a/.github/workflows/deploy-lacchain.yaml +++ b/.github/workflows/deploy-lacchain.yaml @@ -11,13 +11,13 @@ jobs: environment: lacchain steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - - name: Log in to the Container registry - uses: docker/login-action@v2 + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3.1.0 with: registry: ghcr.io - username: ${{ github.actor }} + username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build new images and push diff --git a/.github/workflows/deploy-libre-testnet.yaml b/.github/workflows/deploy-libre-testnet.yaml index f0e81034..eae1322e 100644 --- a/.github/workflows/deploy-libre-testnet.yaml +++ b/.github/workflows/deploy-libre-testnet.yaml @@ -11,13 +11,13 @@ jobs: environment: libre-testnet steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - - name: Log in to the Container registry - uses: docker/login-action@v2 + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3.1.0 with: registry: ghcr.io - username: ${{ github.actor }} + username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: 'step-log' diff --git a/.github/workflows/deploy-libre.yaml b/.github/workflows/deploy-libre.yaml index 58958bed..6824df16 100644 --- a/.github/workflows/deploy-libre.yaml +++ b/.github/workflows/deploy-libre.yaml @@ -11,13 +11,13 @@ jobs: environment: libre steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - - name: Log in to the Container registry - uses: docker/login-action@v2 + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3.1.0 with: registry: ghcr.io - username: ${{ github.actor }} + username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: 'step-log' diff --git a/.github/workflows/deploy-mainnet.yaml b/.github/workflows/deploy-mainnet.yaml index 9a4e16b9..21a965d7 100644 --- a/.github/workflows/deploy-mainnet.yaml +++ b/.github/workflows/deploy-mainnet.yaml @@ -11,13 +11,13 @@ jobs: environment: mainnet steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - - name: Log in to the Container registry - uses: docker/login-action@v2 + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3.1.0 with: registry: ghcr.io - username: ${{ github.actor }} + username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build new images and push diff --git a/.github/workflows/deploy-telos-testnet.yaml b/.github/workflows/deploy-telos-testnet.yaml index 07bab71a..d446f367 100644 --- a/.github/workflows/deploy-telos-testnet.yaml +++ b/.github/workflows/deploy-telos-testnet.yaml @@ -11,13 +11,13 @@ jobs: environment: telos-testnet steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - - name: Log in to the Container registry - uses: docker/login-action@v2 + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3.1.0 with: registry: ghcr.io - username: ${{ github.actor }} + username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: 'step-log' diff --git a/.github/workflows/deploy-telos.yaml b/.github/workflows/deploy-telos.yaml index 3d8d027f..d307db6c 100644 --- a/.github/workflows/deploy-telos.yaml +++ b/.github/workflows/deploy-telos.yaml @@ -11,13 +11,13 @@ jobs: environment: telos steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - - name: Log in to the Container registry - uses: docker/login-action@v2 + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3.1.0 with: registry: ghcr.io - username: ${{ github.actor }} + username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: 'step-log' diff --git a/.github/workflows/deploy-ultra-testnet.yaml b/.github/workflows/deploy-ultra-testnet.yaml index 4d7a40c0..b72994bd 100644 --- a/.github/workflows/deploy-ultra-testnet.yaml +++ b/.github/workflows/deploy-ultra-testnet.yaml @@ -11,13 +11,13 @@ jobs: environment: ultra-testnet steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - - name: Log in to the Container registry - uses: docker/login-action@v2 + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3.1.0 with: registry: ghcr.io - username: ${{ github.actor }} + username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: 'step-log' diff --git a/.github/workflows/deploy-wax-testnet.yaml b/.github/workflows/deploy-wax-testnet.yaml index 1f3b1d37..edc86370 100644 --- a/.github/workflows/deploy-wax-testnet.yaml +++ b/.github/workflows/deploy-wax-testnet.yaml @@ -11,13 +11,13 @@ jobs: environment: wax-testnet steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - - name: Log in to the Container registry - uses: docker/login-action@v2 + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3.1.0 with: registry: ghcr.io - username: ${{ github.actor }} + username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: 'step-log' diff --git a/.github/workflows/deploy-wax.yaml b/.github/workflows/deploy-wax.yaml index 8a32273a..837537a4 100644 --- a/.github/workflows/deploy-wax.yaml +++ b/.github/workflows/deploy-wax.yaml @@ -11,13 +11,13 @@ jobs: environment: wax steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - - name: Log in to the Container registry - uses: docker/login-action@v2 + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3.1.0 with: registry: ghcr.io - username: ${{ github.actor }} + username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: 'step-log' diff --git a/.github/workflows/deploy-xpr-testnet.yaml b/.github/workflows/deploy-xpr-testnet.yaml index 3c6dfb10..ce71dd08 100644 --- a/.github/workflows/deploy-xpr-testnet.yaml +++ b/.github/workflows/deploy-xpr-testnet.yaml @@ -11,13 +11,13 @@ jobs: environment: proton-testnet steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - - name: Log in to the Container registry - uses: docker/login-action@v2 + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3.1.0 with: registry: ghcr.io - username: ${{ github.actor }} + username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: 'step-log' diff --git a/.github/workflows/deploy-xpr.yaml b/.github/workflows/deploy-xpr.yaml index eabe354e..173d5156 100644 --- a/.github/workflows/deploy-xpr.yaml +++ b/.github/workflows/deploy-xpr.yaml @@ -11,13 +11,13 @@ jobs: environment: proton steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - - name: Log in to the Container registry - uses: docker/login-action@v2 + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3.1.0 with: registry: ghcr.io - username: ${{ github.actor }} + username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: 'step-log' diff --git a/docs/images/fio.png b/docs/images/fio.png new file mode 100644 index 00000000..4fcf5ea9 Binary files /dev/null and b/docs/images/fio.png differ diff --git a/hapi/src/services/fioProducers.js b/hapi/src/services/fioProducers.js new file mode 100644 index 00000000..00605fba --- /dev/null +++ b/hapi/src/services/fioProducers.js @@ -0,0 +1,84 @@ +const axios = require('axios'); + +// FIO API endpoint (replace with the correct endpoint if needed) +const FIO_API_URL = 'https://testnet.fioprotocol.io/v1/chain/get_table_rows'; + +const getProducers = async () => { + let producers = []; + let totalVoteWeight; + let hasMore = true; + let nextKey; + + try { + while (hasMore) { + const response = await axios.post(FIO_API_URL, { + code: 'fio.system', // Contract name + table: 'producers', // Table name + scope: 'fio', // Scope + limit: 100, + json: true, + lower_bound: nextKey + }); + + if (response.status !== 200) { + throw new Error(`Request failed with status code ${response.status}`); + } + + const { + rows, + more, + total_producer_vote_weight: _totalVoteWeight + } = response.data; + + if (!rows) { + throw new Error('Response data does not contain rows'); + } + + hasMore = !!more; + nextKey = more; + totalVoteWeight = parseFloat(_totalVoteWeight); + producers.push(...rows); + } + } catch (error) { + console.error('PRODUCER SYNC ERROR', error.message); + return; + } + + producers = producers + .filter(producer => !!producer.is_active) + .sort((a, b) => { + if (parseFloat(a.total_votes) > parseFloat(b.total_votes)) { + return -1; + } + + if (parseFloat(a.total_votes) < parseFloat(b.total_votes)) { + return 1; + } + + return 0; + }); + + producers = producers.map((producer, index) => { + return { + id: producer.id, + owner: producer.owner, + fio_address: producer.fio_address, + total_votes: producer.total_votes, + total_votes_percent: producer.total_votes / totalVoteWeight, + total_votes_eos: producer.total_votes, + rank: index + 1, + producer_public_key: producer.producer_public_key, + url: producer.url, + unpaid_blocks: producer.unpaid_blocks, + last_claim_time: producer.last_claim_time, + location: producer.location, + is_active: !!producer.is_active + }; + }); + + console.log(producers); + return producers; +} + +// Call the function to test it +getProducers(); diff --git a/webapp/src/language/en/en.fio-testnet.json b/webapp/src/language/en/en.fio-testnet.json new file mode 100644 index 00000000..e69de29b diff --git a/webapp/src/language/en/en.fio.json b/webapp/src/language/en/en.fio.json new file mode 100644 index 00000000..e69de29b