Skip to content

Commit

Permalink
Merge branch 'main' into automation-log-trig
Browse files Browse the repository at this point in the history
  • Loading branch information
ritika-b authored Oct 13, 2023
2 parents 875a756 + e8288d1 commit 1233664
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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", "<cryptocompareETHBTCURL>")` 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", "<cryptocompareETHEURURL>")` and `req.add("urlUSD", "<cryptocompareETHUSDURL>")`.
- 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.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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", "<cryptocompareURL>")` 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.
Expand Down
4 changes: 2 additions & 2 deletions src/content/chainlink-nodes/node-versions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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 <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.
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

Expand Down Expand Up @@ -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 <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.
- ⚠️ 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

Expand Down
4 changes: 2 additions & 2 deletions src/content/chainlink-nodes/oracle-jobs/all-jobs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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/<host name or ip>/tcp/<port>/p2p/<bootstrap node's P2P ID>" ]`
`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 = [ "<bootstrap node's P2P ID>@<host name or ip>:<port>" ]`
`p2pv2Boostrappers = [ "BOOTSTRAP_NODE'S_P2P_ID@HOST_NAME_OR_IP:PORT" ]`

- `isBootstrapPeer`: This must be set to `true`.

Expand Down
4 changes: 2 additions & 2 deletions src/content/chainlink-nodes/oracle-jobs/all-tasks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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**

Expand All @@ -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

Expand Down
5 changes: 4 additions & 1 deletion src/content/vrf/v2/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
9 changes: 8 additions & 1 deletion src/features/vrf/v2/components/CostTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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<dataResponse> => {
Expand Down Expand Up @@ -697,6 +698,12 @@ export const CostTable = ({ method, network }: Props) => {
Calculate
</button>
</div>
{method === "vrfSubscription" &&
(state.currentGasPrice === state.gasPrice
? BigNumber.from(state.currentGasPrice).gt(utils.parseUnits(state.currentGasLane.toString(), "gwei"))
: parseFloat(state.currentGasPrice) > state.currentGasLane) && (
<div className="warning-container">{aside}</div>
)}
<h6>Estimated cost per request: {formatTotal()} LINK</h6>

{method === "vrfSubscription" && (
Expand Down
12 changes: 11 additions & 1 deletion src/features/vrf/v2/components/Dropdown.astro
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
---
import { Aside } from "~/components"
import { MethodCheckbox } from "./MethodCheckbox"
import { Props } from "astro"
---

<div>
<MethodCheckbox client:load />
<MethodCheckbox client:load>
<Aside type="caution" slot="aside">
<p>
Your chosen gas price is higher than the selected gas lane, which means that the request will not be fulfilled
until the network gas price goes down to the maximum price for the selected gas lane. The estimated cost shown
is for informational purposes only.
</p>
</Aside>
</MethodCheckbox>
</div>
10 changes: 6 additions & 4 deletions src/features/vrf/v2/components/MethodCheckbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -43,9 +46,8 @@ export const MethodCheckbox = () => {
<label for="funding">Direct funding</label>
</div>
</div>

<Dropdown options={options} />
{network && <CostTable method={vrfMethodUsed} network={network.toString()} />}
{network && <CostTable method={vrfMethodUsed} network={network.toString()} aside={aside} />}
</div>
)
}
4 changes: 4 additions & 0 deletions src/features/vrf/v2/components/costTable.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1233664

Please sign in to comment.