From 5971b1cc7e3992d3fd26d43b137a294b5897b4a6 Mon Sep 17 00:00:00 2001 From: "Micmac.eth" <56690114+MichaelMacaulay@users.noreply.github.com> Date: Wed, 14 Sep 2022 09:41:42 -0400 Subject: [PATCH] new billing section (#198) * new billing section * Small fixes A few small fixes based on Nena's feedback * Updates Making changes based on Adam's feedback * 2 small fixes Fixed: -mentioning the network switcher in subgraph studio -Clarity on the billing policy --- navigation/navigation.ts | 6 +-- pages/en/billing.mdx | 76 +++++++++++++++++++++++++++++++++++ pages/en/querying/billing.mdx | 60 --------------------------- 3 files changed, 79 insertions(+), 63 deletions(-) create mode 100644 pages/en/billing.mdx delete mode 100644 pages/en/querying/billing.mdx diff --git a/navigation/navigation.ts b/navigation/navigation.ts index 8a7363dc992f..387affa41068 100644 --- a/navigation/navigation.ts +++ b/navigation/navigation.ts @@ -36,6 +36,9 @@ export const navigation = (locale: AppLocale): NavItemDefinition[] => [ }, ], }, + { + slug: 'billing', + }, { divider: true, }, @@ -133,9 +136,6 @@ export const navigation = (locale: AppLocale): NavItemDefinition[] => [ { slug: 'querying-the-hosted-service', }, - { - slug: 'billing', - }, ], }, { diff --git a/pages/en/billing.mdx b/pages/en/billing.mdx new file mode 100644 index 000000000000..0b9e3b697fb2 --- /dev/null +++ b/pages/en/billing.mdx @@ -0,0 +1,76 @@ +--- +title: Billing on Subgraph Studio +--- + +### Overview + +For a quick demo of how billing works on the Subgraph Studio, check out the video below: + + + +Invoices are statements of payment amounts owed by a customer and are typically generated on a weekly basis in the system. You'll be required to pay fees based on the query fees you generate using your API keys. While The Graph protocol operates on Ethereum Mainnet, the billing contract lives on the [Polygon](https://polygon.technology/) network to reduce transaction times and cost. It'll allow you to: + +- Add and remove GRT from your wallet +- Keep track of your balances based on how much GRT you have added to your account, how much you have removed, and your invoices +- automatically pay invoices based on query fees generated, as long as there is enough billing balance in your account. + +There are 4 states your invoice can be in: + +1. Pending - the invoice is in the queue to be paid from your billing balance +2. Paid - your invoice has been successfully paid +3. Unpaid - there is not enough GRT in your billing balance +4. Partially Paid - only part of the invoice was paid, since there was not enough billing balance + +**See the diagram below for more information:** + +![Billing Flow](/img/billing-flow.png) + +### Adding GRT to Account + +Before making queries on The Graph Network, you will need to add GRT to your account. This will take about 10-30 minutes depending on network traffic. To add GRT to your account, take the following steps: + +1. Purchase GRT and ETH on an exchange or decentralized exchange of your choice +2. Send the GRT and ETH to your wallet +3. Bridge GRT to Polygon using the Subgraph Studio UI + + a) You will receive 0.001 Matic within a few minutes of sending GRT to the Polygon bridge. You can monitor the transaction by inputting your wallet address into the search bar on [Polygonscan](https://polygonscan.com/). + +4. Add bridged GRT to the billing contract on Polygon in the Subgraph Studio UI. The billing contract address is: [0x10829DB618E6F520Fa3A01c75bC6dDf8722fA9fE](https://polygonscan.com/address/0x10829DB618E6F520Fa3A01c75bC6dDf8722fA9fE). + + a) In order to complete step #4, you must switch from Ethereum to the Polygon network. You can do this using the Subgraph Studio. + +If you used your API keys over the course of any given week, you will receive an invoice based on the query fees you have generated during this period. This invoice will be paid using GRT available in your balance. Query volume is evaluated by the API keys you own. Your balance will be updated after fees are withdrawn. + +### Understanding Invoices in Subgraph Studio + +When using The Graph Network, dapps and users pay for query fees in GRT, the protocol's native work-utility token. Maintaining a positive balance for an account is the user's or dapp's responsibility. + +Here are ways to be notified about and/or check a query fee balance: + +- You can set up a billing notification that will be sent to an email address [here](https://thegraph.com/studio/settings/). + +- You can query the billing subgraph API directly [here](https://thegraph.com/hosted-service/subgraph/graphprotocol/billing) + +Also, you can learn how to (re)fill your query fee balance by watching [this video](https://www.loom.com/share/a81de6ef11d64c62872ea210c58c6af5). + +> IMPORTANT: If there are 2 unpaid invoices, Indexers will stop serving queries for all API Keys associated with the account. Indexers will automatically start serving queries again once the billing balance is paid in full and GRT is added to the account for future query fees. + +Lastly, learn how to prioritize price, speed, data freshness (among other factors) for your queries by watching [this video](https://www.loom.com/share/b5fc533e48584cb694017392c80c75e0). If you have any questions, please ask in [The Graph Discord](https://discord.gg/fjDWCTZE) and the community will be happy to help. + +### How to Fill Your Account With a Mulisig Wallet + +Multisigs are smart contracts that can exist only on the network they have been created, so if you created one on Ethereum Mainnet - it will only exist on Mainnet. Since our billing uses Polygon, if you were to bridge GRT to the multisig address on Polygon the funds would be lost. + +To overcome this issue, we created [a dedicated tool](https://multisig-billing.thegraph.com/) that will help you deposit GRT on our billing contract (on behalf of the multisig) with a standard wallet / EOA (an account controlled by a private key). + +You can access our Multisig Billing Tool here: https://multisig-billing.thegraph.com/ + +This tool will guide you to go through the following steps: + +1. Connect your standard wallet / EOA (this wallet needs to own some ETH as well as the GRT you want to deposit) +2. Bridge GRT to Polygon. You will have to wait 7-8 minutes after the transaction is complete for the bridge transfer to be finalized. +3. Once your GRT is available on your Polygon balance you can deposit them to the billing contract while specifying the multisig address you are funding in the `Multisig Address` field. + +Once the deposit transaction has been confirmed you can go back to [Subgraph Studio](https://thegraph.com/studio/) and connect with your Gnosis Safe Multisig to create API keys and use them to generate queries. + +Those queries will generate invoices that will be paid automatically using the multisig's billing balance. diff --git a/pages/en/querying/billing.mdx b/pages/en/querying/billing.mdx deleted file mode 100644 index 9c939670d0d8..000000000000 --- a/pages/en/querying/billing.mdx +++ /dev/null @@ -1,60 +0,0 @@ ---- -title: Billing on the Subgraph Studio ---- - -### Overview - -Invoices are statements of payment amounts owed by a customer and are typically generated on a weekly basis in the system. You’ll be required to pay fees based on the query fees you generate using your API keys. The billing contract lives on the [Polygon](https://polygon.technology/) network. It’ll allow you to: - -- Add and remove GRT -- Keep track of your balances based on how much GRT you have added to your account, how much you have removed, and your invoices -- Automatically clear payments based on query fees generated - -In order to add GRT to your account, you will need to go through the following steps: - -1. Purchase GRT and ETH on an exchange of your choice -2. Send the GRT and ETH to your wallet -3. Bridge GRT to Polygon using the UI - - a) You will receive 0.001 Matic in a few minutes after you send any amount of GRT to the Polygon bridge. You can track the transaction on [Polygonscan](https://polygonscan.com/) by inputting your address into the search bar. - -4. Add bridged GRT to the billing contract on Polygon. The billing contract address is: [0x10829DB618E6F520Fa3A01c75bC6dDf8722fA9fE](https://polygonscan.com/address/0x10829DB618E6F520Fa3A01c75bC6dDf8722fA9fE). - - a) In order to complete step #4, you'll need to switch your network in your wallet to Polygon. You can add Polygon's network by connecting your wallet and clicking on "Choose Matic (Polygon) Mainnet" [here.](https://chainlist.org/) Once you've added the network, switch it over in your wallet by navigating to the network pill on the top right-hand side corner. In Metamask, the network is called **Matic Mainnnet.** - -At the end of each week, if you used your API keys, you will receive an invoice based on the query fees you have generated during this period. This invoice will be paid using GRT available in your balance. Query volume is evaluated by the API keys you own. Your balance will be updated after fees are withdrawn. - -#### Here’s how you go through the invoicing process: - -There are 4 states your invoice can be in: - -1. Created - your invoice has just been created and not been paid yet -2. Paid - your invoice has been successfully paid -3. Unpaid - there is not enough GRT in your balance on the billing contract -4. Error - there is an error processing the payment - -**See the diagram below for more information:** - -![Billing Flow](/img/billing-flow.png) - -For a quick demo of how billing works on the Subgraph Studio, check out the video below: - - - -### Multisig Users - -Multisigs are smart contracts that can exist only on the network they have been created, so if you created one on Ethereum Mainnet - it will only exist on Mainnet. Since our billing uses Polygon, if you were to bridge GRT to the multisig address on Polygon the funds would be lost. - -To overcome this issue, we created [a dedicated tool](https://multisig-billing.thegraph.com/) that will help you deposit GRT on our billing contract (on behalf of the multisig) with a standard wallet / EOA (an account controlled by a private key). - -You can access our Multisig Billing Tool here: https://multisig-billing.thegraph.com/ - -This tool will guide you to go through the following steps: - -1. Connect your standard wallet / EOA (this wallet needs to own some ETH as well as the GRT you want to deposit) -2. Bridge GRT to Polygon. You will have to wait 7-8 minutes after the transaction is complete for the bridge transfer to be finalized. -3. Once your GRT is available on your Polygon balance you can deposit them to the billing contract while specifying the multisig address you are funding in the `Multisig Address` field. - -Once the deposit transaction has been confirmed you can go back to [Subgraph Studio](https://thegraph.com/studio/) and connect with your Gnosis Safe Multisig to create API keys and use them to generate queries. - -Those queries will generate invoices that will be paid automatically using the multisig’s billing balance.