Overview

In this process we will automate the the process of invoicing gateway operators for the relays they have sent to pocket protocl.

The step by step flow of creating the invoice is as follows:

  1. Extract gateways productivity information for the past 7 days (Monday to Sunday)

  2. Calculate sum of the relays sent to protocol during the period for each gateway operator

  3. Get POKT closing price from CoinGecko and proceed to calculate the average price during the mentioned period

  4. Calculate the owed amount using gateway operator fee constant ($0.00000085): $TotalOwedUSD = Total7DayRelay \times 0.00000085$ $TotalOwedPOKT = TotalOwendUSD/AveragePOKTPrice$

  5. Store the information in an excel sheet

    Sheet Name Information
    Gateways Productivity Information - Daily relay info
  6. Create an email from the email template, attach the excel sheet and send it to the gateway operator email list and CC PNF.

  7. After processing all of the gateway operators, calculate the total fee generated and email it to PNF

Google Sheet Source Schema

Here’s the template itself:

Gateway Operator Sheet Schema Sample

Email template

Dear ${gatewayOperatorName},
Please transfer the gateway operating fees for the prior week into the DAO treasury address below:
${daoTreasuryAddress}
For total sum of: 
${totalPOKTOwed} POKT
The calculations to arrive at this amount are as follows:
Gateway Operating Fee: ${gatewayOperatingFee}
Total 7d Relays: ${totalRelays}
Total USD Owed: ${totalUsdOwed} USD
Average Closing Price: ${avgClosingPrice}
Total POKT Owed: ${totalOwedPokt} POKT
Which you can find in the attached excel file.

Best,
Pocket Network Foundation (on behalf of the Pocket Network DAO)

To be provided by POKT