From c157908d555bd5e2817e58e34ffbcd627b30d0f5 Mon Sep 17 00:00:00 2001 From: Daniel Gruesso Date: Fri, 13 Oct 2023 05:23:50 -0400 Subject: [PATCH 1/3] Update placeholder formatting (#1579) * Update placeholder formatting * Update src/content/chainlink-nodes/oracle-jobs/all-jobs.mdx --------- Co-authored-by: Dwight Lyle --- .../any-api/get-request/examples/multi-variable-responses.mdx | 2 +- .../any-api/get-request/examples/single-word-response.mdx | 2 +- src/content/chainlink-nodes/node-versions.mdx | 4 ++-- src/content/chainlink-nodes/oracle-jobs/all-jobs.mdx | 4 ++-- src/content/chainlink-nodes/oracle-jobs/all-tasks.mdx | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/content/any-api/get-request/examples/multi-variable-responses.mdx b/src/content/any-api/get-request/examples/multi-variable-responses.mdx index ec7087525cb..7646b6a49e7 100644 --- a/src/content/any-api/get-request/examples/multi-variable-responses.mdx +++ b/src/content/any-api/get-request/examples/multi-variable-responses.mdx @@ -85,7 +85,7 @@ To use this contract: 1. Run the `requestMultipleParameters` function. This builds the `Chainlink.Request` using the correct parameters: - - The `req.add("urlBTC", "")` request parameter provides the oracle node with the [url](https://min-api.cryptocompare.com/data/price?fsym=ETH&tsyms=BTC) where to fetch the _ETH-BTC_ price. Same logic for `req.add("urlEUR", "")` and `req.add("urlUSD", "")`. + - The `req.add("urlBTC", "CRYPTOCOMPARE_ETH_BTC_URL")` request parameter provides the oracle node with the [url](https://min-api.cryptocompare.com/data/price?fsym=ETH&tsyms=BTC) where to fetch the _ETH-BTC_ price. Same logic for `req.add("urlEUR", "CRYPTOCOMPARE_ETH_BTC_URL")` and `req.add("urlUSD", "CRYPTOCOMPARE_ETH_BTC_URL")`. - THe `req.add('pathBTC', 'BTC')` request parameter tells the oracle node where to fetch the _ETH-BTC_ price in the _json_ response. Same logic for `req.add('pathUSD', 'EUR')` and `req.add('pathEUR', 'USD')`. Because you provide the URLs and paths, the `MultiWordConsumer` in the example can call any public API as long as the URLs and paths are correct. diff --git a/src/content/any-api/get-request/examples/single-word-response.mdx b/src/content/any-api/get-request/examples/single-word-response.mdx index 9fe25262b5c..d34692e358e 100644 --- a/src/content/any-api/get-request/examples/single-word-response.mdx +++ b/src/content/any-api/get-request/examples/single-word-response.mdx @@ -106,7 +106,7 @@ To use this contract: 1. Run the `requestVolumeData` function. This builds the `Chainlink.Request` using the correct parameters: - - The `req.add("get", "")` request parameter provides the oracle node with the [URL](https://min-api.cryptocompare.com/data/pricemultifull?fsyms=ETH&tsyms=USD) from which to fetch _ETH-USD_ trading info. + - The `req.add("get", "CRYPTOCOMPARE_URL")` request parameter provides the oracle node with the [URL](https://min-api.cryptocompare.com/data/pricemultifull?fsyms=ETH&tsyms=USD) from which to fetch _ETH-USD_ trading info. - The `req.add('path', 'RAW,ETH,USD,VOLUME24HOUR')` request parameter tells the oracle node where to fetch the 24h ETH volume in the _json_ response. It uses a [JSONPath expression](https://jsonpath.com/) with comma(,) delimited string for nested objects. For example: `'RAW,ETH,USD,VOLUME24HOUR'`. - The `req.addInt('times', timesAmount)` request parameter provides the oracle node with the multiplier `timesAmount` by which the fetched volume is multiplied. Use this to remove any decimals from the volume. **_Note_**: The `times` parameter is mandatory. If the API that you call returns a number without any decimals then provide `1`as `timesAmount`. The `APIConsumer` in the example above is flexible enough to call any public API as long as the URL in _get_, _path_, and _timesAmounnt_ are correct. diff --git a/src/content/chainlink-nodes/node-versions.mdx b/src/content/chainlink-nodes/node-versions.mdx index 6177cfccbc9..5ba59583a09 100644 --- a/src/content/chainlink-nodes/node-versions.mdx +++ b/src/content/chainlink-nodes/node-versions.mdx @@ -172,7 +172,7 @@ Node operators may wish to add alerting based around these metrics. ### TOML Configuration -TOML configuration for Chainlink nodes is stable and recommended for mainnet deployments. TOML configuration will be the only supported configuration method starting with `v2.0.0`. Enable TOML configuration by specifying the `-config .toml` flag with the path to your TOML file. Alternatively, you can specify the raw TOML config in the [`CL_CONFIG` environment variable](/chainlink-nodes/v1/configuration#cl_config). See the [CONFIG.md](https://github.com/smartcontractkit/chainlink/blob/v1.13.0/docs/CONFIG.md) and [SECRETS.md](https://github.com/smartcontractkit/chainlink/blob/v1.13.0/docs/SECRETS.md) on GitHub to learn more. +TOML configuration for Chainlink nodes is stable and recommended for mainnet deployments. TOML configuration will be the only supported configuration method starting with `v2.0.0`. Enable TOML configuration by specifying the `-config FILENAME.toml` flag with the path to your TOML file. Alternatively, you can specify the raw TOML config in the [`CL_CONFIG` environment variable](/chainlink-nodes/v1/configuration#cl_config). See the [CONFIG.md](https://github.com/smartcontractkit/chainlink/blob/v1.13.0/docs/CONFIG.md) and [SECRETS.md](https://github.com/smartcontractkit/chainlink/blob/v1.13.0/docs/SECRETS.md) on GitHub to learn more. ### Added @@ -227,7 +227,7 @@ TOML configuration for Chainlink nodes is stable and recommended for mainnet dep - `bridge_errors_total` - `bridge_cache_hits_total` - `bridge_cache_errors_total` -- ⚠️ Experimental: ⚠️ Added static configuration using TOML files as an alternative to the existing combination of environment variables and persisted database configurations. For this release, use TOML for configuration only on test networks. In the future with `v2.0.0`, TOML configuration will become the only supported configuration method. Enable TOML configuration by specifying the `-config .toml` flag with the path to your TOML file. Alternatively, you can specify the raw TOML config in the [`CL_CONFIG` environment variable](/chainlink-nodes/v1/configuration#cl_config). See the [CONFIG.md](https://github.com/smartcontractkit/chainlink/blob/v1.12.0/docs/CONFIG.md) and [SECRETS.md](https://github.com/smartcontractkit/chainlink/blob/v1.12.0/docs/SECRETS.md) on GitHub to learn more. +- ⚠️ Experimental: ⚠️ Added static configuration using TOML files as an alternative to the existing combination of environment variables and persisted database configurations. For this release, use TOML for configuration only on test networks. In the future with `v2.0.0`, TOML configuration will become the only supported configuration method. Enable TOML configuration by specifying the `-config FILENAME.toml` flag with the path to your TOML file. Alternatively, you can specify the raw TOML config in the [`CL_CONFIG` environment variable](/chainlink-nodes/v1/configuration#cl_config). See the [CONFIG.md](https://github.com/smartcontractkit/chainlink/blob/v1.12.0/docs/CONFIG.md) and [SECRETS.md](https://github.com/smartcontractkit/chainlink/blob/v1.12.0/docs/SECRETS.md) on GitHub to learn more. ### Fixed diff --git a/src/content/chainlink-nodes/oracle-jobs/all-jobs.mdx b/src/content/chainlink-nodes/oracle-jobs/all-jobs.mdx index b68f473ce3c..aaec346fe25 100644 --- a/src/content/chainlink-nodes/oracle-jobs/all-jobs.mdx +++ b/src/content/chainlink-nodes/oracle-jobs/all-jobs.mdx @@ -305,11 +305,11 @@ See [shared fields](/chainlink-nodes/oracle-jobs/jobs/#shared-fields). - `evmChainID`: The chain ID of the EVM chain in which the job will operate. - `p2pBootstrapPeers`: A list of libp2p dial addresses of the other bootstrap nodes helping oracle nodes find one another on the network. It is used with P2P networking stack V1 as follows: - `p2pBootstrapPeers = [ "/dns4//tcp//p2p/" ]` + `p2pBootstrapPeers = [ "/dns4/HOST_NAME_OR_IP/tcp/PORT/p2p/BOOTSTRAP_NODE'S_P2P_ID" ]` - `p2pv2Boostrappers`: A list of libp2p dial addresses of the other bootstrap nodes helping oracle nodes find one another on the network. It is used with P2P networking stack V2 as follows: - `p2pv2Boostrappers = [ "@:" ]` + `p2pv2Boostrappers = [ "BOOTSTRAP_NODE'S_P2P_ID@HOST_NAME_OR_IP:PORT" ]` - `isBootstrapPeer`: This must be set to `true`. diff --git a/src/content/chainlink-nodes/oracle-jobs/all-tasks.mdx b/src/content/chainlink-nodes/oracle-jobs/all-tasks.mdx index 3bf2b8679b6..229e66144dc 100644 --- a/src/content/chainlink-nodes/oracle-jobs/all-tasks.mdx +++ b/src/content/chainlink-nodes/oracle-jobs/all-tasks.mdx @@ -477,7 +477,7 @@ Given the input string "xyz", the task will return 3, length of the string. ## Less Than task -Returns a boolean, result of computing `left < right`. +Returns a boolean, result of computing `left LESS_THAN right`. **Parameters** @@ -502,7 +502,7 @@ The result of less than comparison. my_lessthan_task [type="lessthan" left="3" right="10"] ``` -the task will return true which is the result of `3 < 10` +the task will return true which is the result of `3 LESS_THAN 10` ## Lowercase task From 0a14f78f115fdd1ffe15fcc40cbb79fdf6d884ae Mon Sep 17 00:00:00 2001 From: yacine-benichou <78235417+yacine-benichou@users.noreply.github.com> Date: Fri, 13 Oct 2023 16:22:27 +0200 Subject: [PATCH 2/3] Add warning block when gas price is higher than selected gas lane to VRF calculator (#1578) * Add warning text and icon when gas price is higher than selected gas lane * Add logs to investigate errors * Use big numbers to compare current gas price and curren gas lane * Remove icon component to test warning text * Try node icon * Test other structure to solve icon error * Solve Icon issue by using slot to pass Icon component to CostTable * Change big number to number * Fix units issues when comparing gas price and gas lane * Replace Icon component for Aside component --------- Co-authored-by: Yacine Benichou --- src/features/vrf/v2/components/CostTable.tsx | 9 ++++++++- src/features/vrf/v2/components/Dropdown.astro | 12 +++++++++++- src/features/vrf/v2/components/MethodCheckbox.tsx | 10 ++++++---- src/features/vrf/v2/components/costTable.css | 4 ++++ 4 files changed, 29 insertions(+), 6 deletions(-) diff --git a/src/features/vrf/v2/components/CostTable.tsx b/src/features/vrf/v2/components/CostTable.tsx index 619c808b44c..fd08ce06205 100644 --- a/src/features/vrf/v2/components/CostTable.tsx +++ b/src/features/vrf/v2/components/CostTable.tsx @@ -8,6 +8,7 @@ import button from "@chainlink/design-system/button.module.css" interface Props { method: "vrfSubscription" | "vrfDirectFunding" network: string + aside: HTMLElement | undefined } interface directFundingResponse { @@ -176,7 +177,7 @@ export const getGasCalculatorUrl = ({ }&method=${method === "vrfSubscription" ? "subscription" : "directFunding"}` } -export const CostTable = ({ method, network }: Props) => { +export const CostTable = ({ method, network, aside }: Props) => { const [state, dispatch] = useReducer(reducer, initialState) const getDataResponse = useCallback( async (mainChainName: string, networkName: string, chainNetwork: ChainNetwork): Promise => { @@ -697,6 +698,12 @@ export const CostTable = ({ method, network }: Props) => { Calculate + {method === "vrfSubscription" && + (state.currentGasPrice === state.gasPrice + ? BigNumber.from(state.currentGasPrice).gt(utils.parseUnits(state.currentGasLane.toString(), "gwei")) + : parseFloat(state.currentGasPrice) > state.currentGasLane) && ( +
{aside}
+ )}
Estimated cost per request: {formatTotal()} LINK
{method === "vrfSubscription" && ( diff --git a/src/features/vrf/v2/components/Dropdown.astro b/src/features/vrf/v2/components/Dropdown.astro index d34ceec9e08..10b447fbb78 100644 --- a/src/features/vrf/v2/components/Dropdown.astro +++ b/src/features/vrf/v2/components/Dropdown.astro @@ -1,7 +1,17 @@ --- +import { Aside } from "~/components" import { MethodCheckbox } from "./MethodCheckbox" +import { Props } from "astro" ---
- + + +
diff --git a/src/features/vrf/v2/components/MethodCheckbox.tsx b/src/features/vrf/v2/components/MethodCheckbox.tsx index fc48b26ca57..1345f09566d 100644 --- a/src/features/vrf/v2/components/MethodCheckbox.tsx +++ b/src/features/vrf/v2/components/MethodCheckbox.tsx @@ -6,10 +6,13 @@ import { CostTable } from "./CostTable" import { Dropdown } from "./Dropdown" import useQueryString from "~/hooks/useQueryString" -export const MethodCheckbox = () => { +interface Props { + aside?: HTMLElement | undefined +} + +export const MethodCheckbox = ({ aside }: Props) => { const [vrfMethodUsed, setVrfMethodUsed] = useState<"vrfSubscription" | "vrfDirectFunding">("vrfSubscription") const [network] = useQueryString("network", "") - const handleChange = (event) => { setVrfMethodUsed(event.target.value) } @@ -43,9 +46,8 @@ export const MethodCheckbox = () => { - - {network && } + {network && } ) } diff --git a/src/features/vrf/v2/components/costTable.css b/src/features/vrf/v2/components/costTable.css index e606395f349..c63e344f423 100644 --- a/src/features/vrf/v2/components/costTable.css +++ b/src/features/vrf/v2/components/costTable.css @@ -33,6 +33,10 @@ th { padding: 1.5rem; } +.warning-container { + padding-bottom: 1.5rem; +} + @media screen and (min-width: 768px) { .keyhash-radio-container { flex-direction: row; From e8288d12d4453afbc215a247621d9057f43f9369 Mon Sep 17 00:00:00 2001 From: Crystal Gomes Date: Fri, 13 Oct 2023 13:38:11 -0400 Subject: [PATCH 3/3] Add missing contract variables (#1581) * Add missing contract variables * Update src/content/vrf/v2/getting-started.mdx Co-authored-by: yacine-benichou <78235417+yacine-benichou@users.noreply.github.com> --------- Co-authored-by: yacine-benichou <78235417+yacine-benichou@users.noreply.github.com> --- src/content/vrf/v2/getting-started.mdx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/content/vrf/v2/getting-started.mdx b/src/content/vrf/v2/getting-started.mdx index 25128fc9cf8..ba5165f457d 100644 --- a/src/content/vrf/v2/getting-started.mdx +++ b/src/content/vrf/v2/getting-started.mdx @@ -95,14 +95,17 @@ This example is adapted for [Sepolia testnet](/vrf/v2/subscription/supported-net {/* prettier-ignore */} ```solidity uint64 s_subscriptionId; +address s_owner; +VRFCoordinatorV2Interface COORDINATOR; address vrfCoordinator = 0x8103B0A8A00be2DDC778e6e7eaa21791Cd364625; bytes32 s_keyHash = 0x474e34a077df58807dbe9c96d3c009b23b3c6d0cce433e59bbf5b34f823bc56c; uint32 callbackGasLimit = 40000; uint16 requestConfirmations = 3; uint32 numWords = 1; ``` - - `uint64 s_subscriptionId`: The subscription ID that this contract uses for funding requests. Initialized in the `constructor`. +- `address s_owner`: The address of the owner of the contract that you will deploy. This is initialized in the `constructor`, and it will be the address you use when deploying the contract. +- `VRFCoordinatorV2Interface COORDINATOR`: The address of the Chainlink VRF Coordinator contract that this contract will use. Initialized in the `constructor`. - `address vrfCoordinator`: The address of the Chainlink VRF Coordinator contract. - `bytes32 s_keyHash`: The gas lane key hash value, which is the maximum gas price you are willing to pay for a request in wei. It functions as an ID of the off-chain VRF job that runs in response to requests. - `uint32 callbackGasLimit`: The limit for how much gas to use for the callback request to your contract's `fulfillRandomWords` function. It must be less than the `maxGasLimit` on the coordinator contract. Adjust this value for larger requests depending on how your `fulfillRandomWords` function processes and stores the received random values. If your `callbackGasLimit` is not sufficient, the callback will fail and your subscription is still charged for the work done to generate your requested random values.