diff --git a/src/content/chainlink-functions/resources/billing.mdx b/src/content/chainlink-functions/resources/billing.mdx index a017eb43093..cd013e51fd7 100644 --- a/src/content/chainlink-functions/resources/billing.mdx +++ b/src/content/chainlink-functions/resources/billing.mdx @@ -5,6 +5,7 @@ title: "Chainlink Functions Billing" --- import { Aside } from "@components" +import { TabsContent } from "@components/Tabs" ## Request costs @@ -41,6 +42,8 @@ During the **request** step: total estimated cost in LINK = total estimated gas cost + premium fees ``` + For networks with USD-denominated premium fees, the fixed premium fee is denominated in USD but no USD is ever used. The LINK equivalent of this fee is calculated at request time. + 1. The total estimated cost is then added to the subscription reservation. ### Cost calculation (fulfillment) @@ -55,14 +58,23 @@ When a DON's oracle reports the response, subscription accounts are charged base total cost in LINK = total gas cost + premium fees ``` + For networks with USD-denominated premium fees, the LINK equivalent of the fixed premium fee was calculated at request time. At response time, this calculated value in LINK is charged to your subscription. + 1. The FunctionsRouter contract performs several accounting movements. ### Cost calculation example This is an example of cost estimation for a request and then cost calculation at fulfillment. +For networks with USD-denominated premium fees, the premium fees are set in USD, but no USD is ever used. The LINK equivalent of the fee is calculated at request time, and then deducted from your subscription in LINK at response time. + #### Cost Simulation (Reservation) +{/* prettier-ignore */} + +LINK-denominated premium fee +USD-denominated premium fee + | Parameter | Value | | ----------------------- | -------- | | Overestimated gas price | 9 gwei | @@ -93,8 +105,55 @@ This is an example of cost estimation for a request and then cost calculation at For this example request, 0.82 LINK is reserved from your subscription balance, but not yet deducted. When the request is fulfilled, the exact request cost is deducted. The estimated cost of a request is overestimated to allow for 99% of gas price fluctuation increases in between request and response time. + + +| Parameter | Value | +| ----------------------- | -------- | +| Overestimated gas price | 9 gwei | +| Callback gas limit | 300000 | +| Gas overhead | 185000 | +| Premium fee | 320 cents USD | + +1. Calculate the total estimated gas cost in LINK, using an overestimated gas price, the gas overhead, and the full callback gas limit: + + | Gas cost calculation | Total estimated gas cost | + | ------------------------------------------------------------- | --------------------------- | + | Overestimated gas price x (Gas overhead + Callback gas limit) | | + | 9 gwei x (300000 + 185000) | 4365000 gwei (0.004365 ETH) | + +1. Convert the gas cost to LINK using the [LINK/ETH feed](https://data.chain.link/ethereum/mainnet/crypto-eth/link-eth). + For this example, assume the feed returns a conversion value of Ξ0.007 ETH per 1 LINK. + + | ETH to LINK cost conversion | Total gas cost (LINK) | + | ----------------------------- | --------------------- | + | 0.004365 ETH / 0.007 ETH/LINK | 0.62 LINK | + +1. Convert the USD-denominated premium fee to LINK using the [LINK/USD feed](https://data.chain.link/feeds/ethereum/mainnet/link-usd). + For this example, assume the feed returns a conversion value of $20.00 USD per 1 LINK: + + | USD to LINK cost conversion | Premium fee (LINK) | + | --------------------------- | ------------------ | + | $3.20 USD / 20.00 USD/LINK | 0.16 LINK | + +1. Add the converted premium fee to get the estimated cost for a subscription reservation: + + | Adding converted LINK premium | Maximum request cost (LINK) | + | ----------------------------------- | --------------------------- | + | Total gas cost (LINK) + Premium fee | | + | 0.62 LINK + 0.16 LINK | 0.78 LINK | + +For this example request, 0.78 LINK is reserved from your subscription balance, but not yet deducted. When the request is fulfilled, the exact request cost is deducted. The estimated cost of a request is overestimated to allow for 99% of gas price fluctuation increases in between request and response time. + + + + #### Cost calculation (fulfillment) +{/* prettier-ignore */} + +LINK-denominated premium fee +USD-denominated premium fee + | Parameter | Value | | ------------ | -------- | | Gas price | 1.5 gwei | @@ -125,6 +184,41 @@ For this example request, 0.82 LINK is reserved from your subscription balance, This example request would cost 0.2825 LINK when it is fulfilled. The subscription reservation for the 0.82 LINK is released, and the actual cost of 0.2825 LINK is deducted from your subscription balance. + + +| Parameter | Value | +| ------------ | -------- | +| Gas price | 1.5 gwei | +| Callback gas | 200000 | +| Gas overhead | 185000 | +| Premium fee converted to LINK | 0.16 LINK | + +1. Calculate the total gas cost: + + | Gas cost calculation | Total gas cost | + | ----------------------------------------- | --------------------------- | + | Gas price x (Gas overhead + Callback gas) | | + | 1.5 gwei x (200000 + 185000) | 577500 gwei (0.0005775 ETH) | + +1. Convert the gas cost to LINK using the [LINK/ETH feed](https://data.chain.link/ethereum/mainnet/crypto-eth/link-eth). + For this example, assume the feed returns a conversion value of Ξ0.007 ETH per 1 LINK. + + | ETH to LINK cost conversion | Total gas cost (LINK) | + | ------------------------------ | --------------------- | + | 0.0005775 ETH / 0.007 ETH/LINK | 0.0825 LINK | + +1. The premium fee was converted from USD to LINK at the time of the request. Add this converted premium fee to get the total cost of a request: + + | Adding premium fee | Total request cost (LINK) | + | ----------------------------------- | ------------------------- | + | Total gas cost (LINK) + premium fee | | + | 0.0825 LINK + 0.16 LINK | 0.2425 LINK | + +This example request would cost 0.2425 LINK when it is fulfilled. The subscription reservation for the 0.78 LINK is released, and the actual cost of 0.2425 LINK is deducted from your subscription balance. + + + + ## Minimum balance for uploading encrypted secrets If you choose to store the encrypted secrets with the DON (learn more on the [Secrets Management page](/chainlink-functions/resources/secrets)), then one of your subscriptions must maintain a balance greater than the minimum required for uploading encrypted secrets. This balance is blockchain-specific. You can find the specific values for each blockchain on the [Supported Networks](/chainlink-functions/supported-networks) page. diff --git a/src/content/chainlink-functions/resources/release-notes.mdx b/src/content/chainlink-functions/resources/release-notes.mdx index f0bb5b0469c..c635912d8cd 100644 --- a/src/content/chainlink-functions/resources/release-notes.mdx +++ b/src/content/chainlink-functions/resources/release-notes.mdx @@ -6,6 +6,15 @@ title: "Chainlink Functions Release Notes" import { Aside } from "@components" +## USD-denominated premium fees and new testnets - 2024-03-22 + +Chainlink Functions is available as an open beta on the following testnets: + +- [BASE Sepolia](/chainlink-functions/supported-networks#base-sepolia-testnet) +- [Optimism Sepolia](/chainlink-functions/supported-networks#optimism-sepolia-testnet) + +Both of these networks have USD-denominated fixed premium fees. This means that the premium fees are set in USD, but no USD is ever used. The LINK equivalent of the fee is calculated at request time, and then deducted from your subscription in LINK at response time. See the [example cost calculation](/chainlink-functions/resources/billing#cost-calculation-example) for more information. + ## Module imports supported on mainnet - 2024-01-12 - You can use external module imports with Chainlink Functions source code on mainnet networks. See the [Using Imports with Functions](/chainlink-functions/tutorials/importing-packages) tutorial to see an example of how to import and use imported modules with your Functions source code. This feature requires the [Functions Toolkit NPM package](https://www.npmjs.com/package/@chainlink/functions-toolkit/v/0.2.7) `v0.2.7` or later. diff --git a/src/content/chainlink-functions/supported-networks.mdx b/src/content/chainlink-functions/supported-networks.mdx index c14510102a4..f809e7bb0dc 100644 --- a/src/content/chainlink-functions/supported-networks.mdx +++ b/src/content/chainlink-functions/supported-networks.mdx @@ -5,7 +5,7 @@ title: "Supported Networks" --- import ResourcesCallout from "@features/resources/callouts/ResourcesCallout.astro" -import { Address, CopyText } from "@components" +import { Aside, Address, CopyText } from "@components" import { DonId } from "@features/chainlink-functions" Read the [LINK Token Contracts](/resources/link-token-contracts) page to learn where to get testnet LINK and ETH. @@ -139,3 +139,49 @@ Read the [LINK Token Contracts](/resources/link-token-contracts) page to learn w | Request threshold (withdrawing funds) | 10 requests | | Cancellation fees (withdrawing funds) | 2 LINK | | Minimum balance for uploading encrypted secrets | 2 LINK | + +## BASE + + + +### BASE Sepolia testnet + +| Item | Value | +| ---------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Functions router |
| +| | / | +| Encrypted secrets upload endpoints |
| + +| Billing Item | Value | +| ------------------------------------------------ | ------------- | +| Premium fees (converted to LINK at request time) | 320 cents USD | +| Request threshold (withdrawing funds) | 10 requests | +| Cancellation fees (withdrawing funds) | 2 LINK | +| Minimum balance for uploading encrypted secrets | 2 LINK | + +## Optimism + + + +### Optimism Sepolia testnet + +| Item | Value | +| ---------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Functions router |
| +| | / | +| Encrypted secrets upload endpoints |
| + +| Billing Item | Value | +| ------------------------------------------------ | ------------- | +| Premium fees (converted to LINK at request time) | 320 cents USD | +| Request threshold (withdrawing funds) | 10 requests | +| Cancellation fees (withdrawing funds) | 2 LINK | +| Minimum balance for uploading encrypted secrets | 2 LINK | diff --git a/src/features/landing/data/index.ts b/src/features/landing/data/index.ts index 4d7a64007e5..5f4522ba7d2 100644 --- a/src/features/landing/data/index.ts +++ b/src/features/landing/data/index.ts @@ -90,6 +90,8 @@ export const evmProducts = [ { id: "polygon", title: "Polygon" }, { id: "avalanche", title: "Avalanche" }, { id: "arbitrum", title: "Arbitrum" }, + { id: "optimism", title: "Optimism" }, + { id: "base", title: "BASE" }, ], }, {