Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update @chainlink/contracts to v1.1.1 and other updates #1922

Merged
merged 14 commits into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3,045 changes: 1,778 additions & 1,267 deletions package-lock.json

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@
"@11ty/eleventy-fetch": "^4.0.1",
"@astro-community/astro-embed-youtube": "^0.4.5",
"@astrojs/mdx": "^2.3.1",
"@astrojs/partytown": "^2.0.4",
"@astrojs/preact": "^3.2.0",
"@astrojs/partytown": "^2.1.0",
"@astrojs/preact": "^3.3.0",
"@astrojs/prism": "^3.1.0",
"@astrojs/react": "^3.3.0",
"@astrojs/sitemap": "^3.1.4",
"@astrojs/react": "^3.4.0",
"@astrojs/sitemap": "^3.1.5",
"@chainlink/components": "^0.4.16",
"@chainlink/contracts": "1.1.0",
"@chainlink/contracts": "1.1.1",
"@chainlink/contracts-ccip": "1.4.0",
"@chainlink/design-system": "^0.1.50",
"@chainlink/solana-sdk": "^0.2.2",
Expand All @@ -47,7 +47,7 @@
"@nanostores/preact": "^0.5.1",
"@nanostores/react": "^0.7.2",
"@openzeppelin/contracts": "^4.9.6",
"astro": "^4.6.3",
"astro": "^4.9.1",
"bignumber.js": "^9.1.2",
"clipboard": "^2.0.11",
"dotenv": "^16.4.5",
Expand All @@ -57,8 +57,8 @@
"lodash": "^4.17.21",
"marked": "^12.0.2",
"nanostores": "^0.9.5",
"preact": "^10.20.2",
"react-instantsearch": "^7.7.2",
"preact": "^10.22.0",
"react-instantsearch": "^7.9.0",
"rehype-autolink-headings": "^7.1.0",
"rehype-slug": "^6.0.0",
"rehype-wrap-all": "^1.1.0",
Expand All @@ -68,8 +68,8 @@
"@nomicfoundation/hardhat-toolbox": "^2.0.2",
"@nomiclabs/hardhat-ethers": "^2.2.3",
"@project-serum/anchor": "^0.26.0",
"@types/node": "^20.12.7",
"@types/react": "^18.2.79",
"@types/node": "^20.12.12",
"@types/react": "^18.3.3",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"eslint": "^8.57.0",
Expand All @@ -79,7 +79,7 @@
"eslint-plugin-n": "^15.7.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-promise": "^6.1.1",
"hardhat": "^2.22.3",
"hardhat": "^2.22.4",
"husky": "^8.0.3",
"lint-staged": "^13.3.0",
"prettier": "^2.8.8",
Expand All @@ -88,7 +88,7 @@
"solhint": "^3.6.2",
"solhint-plugin-chainlink-solidity": "github:smartcontractkit/chainlink-solhint-rules",
"solhint-plugin-prettier": "^0.0.5",
"ts-jest": "^29.1.2",
"ts-jest": "^29.1.3",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.4.5"
},
Expand Down
2 changes: 1 addition & 1 deletion public/samples/ChainlinkNodes/Operator.sol
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
import "@chainlink/contracts/src/v0.8/operatorforwarder/dev/Operator.sol";
import "@chainlink/contracts/src/v0.8/operatorforwarder/Operator.sol";
2 changes: 1 addition & 1 deletion public/samples/VRF/v2-5/SubscriptionConsumer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ contract SubscriptionConsumer is VRFConsumerBaseV2Plus {

function fulfillRandomWords(
uint256 _requestId,
uint256[] memory _randomWords
uint256[] calldata _randomWords
) internal override {
require(s_requests[_requestId].exists, "request not found");
s_requests[_requestId].fulfilled = true;
Expand Down
2 changes: 1 addition & 1 deletion public/samples/VRF/v2-5/SubscriptionManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ contract VRFv2PlusSubscriptionManager is VRFConsumerBaseV2Plus {

function fulfillRandomWords(
uint256 /* requestId */,
uint256[] memory randomWords
uint256[] calldata randomWords
) internal override {
s_randomWords = randomWords;
}
Expand Down
2 changes: 1 addition & 1 deletion public/samples/VRF/v2-5/VRFD20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ contract VRFD20 is VRFConsumerBaseV2Plus {
*/
function fulfillRandomWords(
uint256 requestId,
uint256[] memory randomWords
uint256[] calldata randomWords
) internal override {
uint256 d20Value = (randomWords[0] % 20) + 1;
s_results[s_rollers[requestId]] = d20Value;
Expand Down
20 changes: 0 additions & 20 deletions src/content/vrf/v2-5/migration-from-v2.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -157,16 +157,6 @@ To modify your existing smart contract code to work with VRF v2.5, complete the
</Fragment>
<Fragment slot="panel.2">

<Aside type="caution" title="Outdated V2.5 direct funding interface and wrapper in chainlink 1.1.0 package">
The [`chainlink/contracts` 1.1.0 package](https://www.npmjs.com/package/@chainlink/contracts/v/1.1.0) currently has an outdated interface and wrapper for V2.5 direct funding. If you deploy contracts for direct funding with these outdated interfaces, your `requestRandomness` function will revert.

Use this interface and wrapper:

- `VRFV2PlusWrapperConsumerBase.sol`: https://github.com/smartcontractkit/chainlink/blob/develop/contracts/src/v0.8/vrf/dev/VRFV2PlusWrapperConsumerBase.sol
- `IVRFV2PlusWrapper.sol`: https://github.com/smartcontractkit/chainlink/blob/develop/contracts/src/v0.8/vrf/dev/interfaces/IVRFV2PlusWrapper.sol

</Aside>

1. Import the [`VRFV2PlusWrapperConsumerBase`](https://github.com/smartcontractkit/chainlink/blob/develop/contracts/src/v0.8/vrf/dev/VRFV2PlusWrapperConsumerBase.sol) contract and remove the v2 `VRFV2WrapperConsumerBase` import.

1. Add a `VRFV2PlusWrapperConsumerBase` constructor, passing in the VRF wrapper address for the network you're using. Unlike V2, you don't have to pass the LINK token address to the constructor.
Expand Down Expand Up @@ -397,16 +387,6 @@ Open the full example `DirectFundingConsumer` contract:

<CodeSample src="samples/VRF/v2-5/DirectFundingConsumer.sol" showButtonOnly />

<Aside type="caution" title="Outdated V2.5 direct funding interface and wrapper in chainlink 1.1.0 package">
The [`chainlink/contracts` 1.1.0 package](https://www.npmjs.com/package/@chainlink/contracts/v/1.1.0) currently has an outdated interface and wrapper for V2.5 direct funding. If you deploy contracts for direct funding with these outdated interfaces, your `requestRandomness` function will revert.

Use this interface and wrapper:

- `VRFV2PlusWrapperConsumerBase.sol`: https://github.com/smartcontractkit/chainlink/blob/develop/contracts/src/v0.8/vrf/dev/VRFV2PlusWrapperConsumerBase.sol
- `IVRFV2PlusWrapper.sol`: https://github.com/smartcontractkit/chainlink/blob/develop/contracts/src/v0.8/vrf/dev/interfaces/IVRFV2PlusWrapper.sol

</Aside>

Compare the major changes between V2.5 and V2:

{/* prettier-ignore */}
Expand Down