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

Chainlink Contracts v1 update #1762

Merged
merged 27 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
2aef069
Update docs for contracts NPM 1-0-0
dwightjl Jan 15, 2024
07061d8
Update URLs update imports and update function names
dwightjl Feb 13, 2024
0c986b1
Functions: correct links
aelmanaa Feb 13, 2024
0e4baac
pin versions to solidity files at the end of the build (#1763)
aelmanaa Feb 14, 2024
fd2b0d7
Merge remote-tracking branch 'origin/main' into npm-v1-update
dwightjl Mar 1, 2024
de68c95
Update package-lock.json
dwightjl Mar 1, 2024
20fd4cd
Re-update paths
dwightjl Mar 1, 2024
c1047c4
Update Automation example import
dwightjl Mar 1, 2024
e50732a
Remove outdated Functions example
dwightjl Mar 1, 2024
8c739f7
Use OwnerIsCreator to align with project's OZ version
khadni Mar 4, 2024
6deb3e8
Remove outdated Functions example
dwightjl Mar 13, 2024
2681a79
Update other packages
dwightjl Mar 13, 2024
0a51cd9
Fix imports for new Data Streams contracts
dwightjl Mar 13, 2024
8c2023c
Update contracts to beta.1
dwightjl Mar 18, 2024
364a0e7
Update other packages
dwightjl Mar 19, 2024
71d5c75
Restore LinkToken.json import
dwightjl Mar 19, 2024
0475ea4
Resolve compile issue?
dwightjl Mar 19, 2024
b73afab
StreamsUpkeep update
khadni Mar 19, 2024
6be65af
StreamsUpkeep update
khadni Mar 19, 2024
cbac7e2
Merge branch 'main' into npm-v1-update
dwightjl Mar 19, 2024
a1d073f
General package updates
dwightjl Mar 20, 2024
ab56d64
Merge remote-tracking branch 'origin/main' into npm-v1-update
dwightjl Mar 20, 2024
787f44b
Merge branch 'main' into npm-v1-update
khadni Mar 21, 2024
834841c
Update Streams for beta.1 contracts (#1829)
khadni Mar 21, 2024
71c3112
Update @chainlink/contracts to 1.0.0 latest version
dwightjl Mar 25, 2024
f86f1e6
Update all
dwightjl Mar 25, 2024
565d273
Merge remote-tracking branch 'origin/main' into npm-v1-update
dwightjl Mar 25, 2024
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
45 changes: 34 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"@astrojs/react": "^3.0.4",
"@astrojs/sitemap": "^3.0.3",
"@chainlink/components": "^0.4.5",
"@chainlink/contracts": "^0.8.0",
"@chainlink/contracts": "^1.0.0-beta.0",
"@chainlink/contracts-ccip": "^1.2.1",
"@chainlink/design-system": "^0.1.50",
"@chainlink/solana-sdk": "^0.2.2",
Expand Down
16 changes: 8 additions & 8 deletions public/samples/APIRequests/APIConsumer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ contract APIConsumer is ChainlinkClient, ConfirmedOwner {
*
*/
constructor() ConfirmedOwner(msg.sender) {
setChainlinkToken(0x779877A7B0D9E8603169DdbD7836e478b4624789);
setChainlinkOracle(0x6090149792dAAeE9D1D568c9f9a6F6B46AA29eFD);
_setChainlinkToken(0x779877A7B0D9E8603169DdbD7836e478b4624789);
_setChainlinkOracle(0x6090149792dAAeE9D1D568c9f9a6F6B46AA29eFD);
jobId = "ca98366cc7314957b8c012c72f05aeeb";
fee = (1 * LINK_DIVISIBILITY) / 10; // 0,1 * 10**18 (Varies by network and job)
}
Expand All @@ -45,14 +45,14 @@ contract APIConsumer is ChainlinkClient, ConfirmedOwner {
* data, then multiply by 1000000000000000000 (to remove decimal places from data).
*/
function requestVolumeData() public returns (bytes32 requestId) {
Chainlink.Request memory req = buildChainlinkRequest(
Chainlink.Request memory req = _buildChainlinkRequest(
jobId,
address(this),
this.fulfill.selector
);

// Set the URL to perform the GET request on
req.add(
req._add(
"get",
"https://min-api.cryptocompare.com/data/pricemultifull?fsyms=ETH&tsyms=USD"
);
Expand All @@ -68,14 +68,14 @@ contract APIConsumer is ChainlinkClient, ConfirmedOwner {
// }
// }
// request.add("path", "RAW.ETH.USD.VOLUME24HOUR"); // Chainlink nodes prior to 1.0.0 support this format
req.add("path", "RAW,ETH,USD,VOLUME24HOUR"); // Chainlink nodes 1.0.0 and later support this format
req._add("path", "RAW,ETH,USD,VOLUME24HOUR"); // Chainlink nodes 1.0.0 and later support this format

// Multiply the result by 1000000000000000000 to remove decimals
int256 timesAmount = 10 ** 18;
req.addInt("times", timesAmount);
req._addInt("times", timesAmount);

// Sends the request
return sendChainlinkRequest(req, fee);
return _sendChainlinkRequest(req, fee);
}

/**
Expand All @@ -93,7 +93,7 @@ contract APIConsumer is ChainlinkClient, ConfirmedOwner {
* Allow withdraw of Link tokens from the contract
*/
function withdrawLink() public onlyOwner {
LinkTokenInterface link = LinkTokenInterface(chainlinkTokenAddress());
LinkTokenInterface link = LinkTokenInterface(_chainlinkTokenAddress());
require(
link.transfer(msg.sender, link.balanceOf(address(this))),
"Unable to transfer"
Expand Down
26 changes: 13 additions & 13 deletions public/samples/APIRequests/APIConsumerForwarder.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,25 @@ contract APIConsumerForwarder is ChainlinkClient, ConfirmedOwner {
* @dev Check https://docs.chain.link/docs/link-token-contracts/ for LINK address for the right network
*/
constructor() ConfirmedOwner(msg.sender) {
setChainlinkToken(0x779877A7B0D9E8603169DdbD7836e478b4624789);
_setChainlinkToken(0x779877A7B0D9E8603169DdbD7836e478b4624789);
}

function requestEthereumPrice(
address _oracle,
string memory _jobId
) public onlyOwner {
Chainlink.Request memory req = buildChainlinkRequest(
Chainlink.Request memory req = _buildChainlinkRequest(
stringToBytes32(_jobId),
address(this),
this.fulfillEthereumPrice.selector
);
req.add(
req._add(
"get",
"https://min-api.cryptocompare.com/data/price?fsym=ETH&tsyms=USD"
);
req.add("path", "USD");
req.addInt("times", 100);
sendChainlinkRequestTo(_oracle, req, ORACLE_PAYMENT);
req._add("path", "USD");
req._addInt("times", 100);
_sendChainlinkRequestTo(_oracle, req, ORACLE_PAYMENT);
}

/**
Expand All @@ -57,15 +57,15 @@ contract APIConsumerForwarder is ChainlinkClient, ConfirmedOwner {
address _oracle,
string memory _jobId
) public onlyOwner {
Chainlink.Request memory req = buildChainlinkRequest(
Chainlink.Request memory req = _buildChainlinkRequest(
stringToBytes32(_jobId),
address(this),
this.fulfillFirstId.selector
);

// Set the URL to perform the GET request on
// API docs: https://www.coingecko.com/en/api/documentation?
req.add(
req._add(
"get",
"https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&per_page=10"
);
Expand All @@ -80,9 +80,9 @@ contract APIConsumerForwarder is ChainlinkClient, ConfirmedOwner {
// ...
// .. }]
// request.add("path", "0.id"); // Chainlink nodes prior to 1.0.0 support this format
req.add("path", "0,id"); // Chainlink nodes 1.0.0 and later support this format
req._add("path", "0,id"); // Chainlink nodes 1.0.0 and later support this format
// Sends the request
sendChainlinkRequestTo(_oracle, req, ORACLE_PAYMENT);
_sendChainlinkRequestTo(_oracle, req, ORACLE_PAYMENT);
}

function fulfillEthereumPrice(
Expand All @@ -105,11 +105,11 @@ contract APIConsumerForwarder is ChainlinkClient, ConfirmedOwner {
}

function getChainlinkToken() public view returns (address) {
return chainlinkTokenAddress();
return _chainlinkTokenAddress();
}

function withdrawLink() public onlyOwner {
LinkTokenInterface link = LinkTokenInterface(chainlinkTokenAddress());
LinkTokenInterface link = LinkTokenInterface(_chainlinkTokenAddress());
require(
link.transfer(msg.sender, link.balanceOf(address(this))),
"Unable to transfer"
Expand All @@ -122,7 +122,7 @@ contract APIConsumerForwarder is ChainlinkClient, ConfirmedOwner {
bytes4 _callbackFunctionId,
uint256 _expiration
) public onlyOwner {
cancelChainlinkRequest(
_cancelChainlinkRequest(
_requestId,
_payment,
_callbackFunctionId,
Expand Down
18 changes: 9 additions & 9 deletions public/samples/APIRequests/ATestnetConsumer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,25 @@ contract ATestnetConsumer is ChainlinkClient, ConfirmedOwner {
* @dev Check https://docs.chain.link/docs/link-token-contracts/ for LINK address for the right network
*/
constructor() ConfirmedOwner(msg.sender) {
setChainlinkToken(0x779877A7B0D9E8603169DdbD7836e478b4624789);
_setChainlinkToken(0x779877A7B0D9E8603169DdbD7836e478b4624789);
}

function requestEthereumPrice(
address _oracle,
string memory _jobId
) public onlyOwner {
Chainlink.Request memory req = buildChainlinkRequest(
Chainlink.Request memory req = _buildChainlinkRequest(
stringToBytes32(_jobId),
address(this),
this.fulfillEthereumPrice.selector
);
req.add(
req._add(
"get",
"https://min-api.cryptocompare.com/data/price?fsym=ETH&tsyms=USD"
);
req.add("path", "USD");
req.addInt("times", 100);
sendChainlinkRequestTo(_oracle, req, ORACLE_PAYMENT);
req._add("path", "USD");
req._addInt("times", 100);
_sendChainlinkRequestTo(_oracle, req, ORACLE_PAYMENT);
}

function fulfillEthereumPrice(
Expand All @@ -56,11 +56,11 @@ contract ATestnetConsumer is ChainlinkClient, ConfirmedOwner {
}

function getChainlinkToken() public view returns (address) {
return chainlinkTokenAddress();
return _chainlinkTokenAddress();
}

function withdrawLink() public onlyOwner {
LinkTokenInterface link = LinkTokenInterface(chainlinkTokenAddress());
LinkTokenInterface link = LinkTokenInterface(_chainlinkTokenAddress());
require(
link.transfer(msg.sender, link.balanceOf(address(this))),
"Unable to transfer"
Expand All @@ -73,7 +73,7 @@ contract ATestnetConsumer is ChainlinkClient, ConfirmedOwner {
bytes4 _callbackFunctionId,
uint256 _expiration
) public onlyOwner {
cancelChainlinkRequest(
_cancelChainlinkRequest(
_requestId,
_payment,
_callbackFunctionId,
Expand Down
14 changes: 7 additions & 7 deletions public/samples/APIRequests/FetchFromArray.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ contract FetchFromArray is ChainlinkClient, ConfirmedOwner {
*
*/
constructor() ConfirmedOwner(msg.sender) {
setChainlinkToken(0x779877A7B0D9E8603169DdbD7836e478b4624789);
setChainlinkOracle(0x6090149792dAAeE9D1D568c9f9a6F6B46AA29eFD);
_setChainlinkToken(0x779877A7B0D9E8603169DdbD7836e478b4624789);
_setChainlinkOracle(0x6090149792dAAeE9D1D568c9f9a6F6B46AA29eFD);
jobId = "7d80a6386ef543a3abb52817f6707e3b";
fee = (1 * LINK_DIVISIBILITY) / 10; // 0,1 * 10**18 (Varies by network and job)
}
Expand All @@ -46,15 +46,15 @@ contract FetchFromArray is ChainlinkClient, ConfirmedOwner {
* data which is located in a list
*/
function requestFirstId() public returns (bytes32 requestId) {
Chainlink.Request memory req = buildChainlinkRequest(
Chainlink.Request memory req = _buildChainlinkRequest(
jobId,
address(this),
this.fulfill.selector
);

// Set the URL to perform the GET request on
// API docs: https://www.coingecko.com/en/api/documentation?
req.add(
req._add(
"get",
"https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&per_page=10"
);
Expand All @@ -69,9 +69,9 @@ contract FetchFromArray is ChainlinkClient, ConfirmedOwner {
// ...
// .. }]
// request.add("path", "0.id"); // Chainlink nodes prior to 1.0.0 support this format
req.add("path", "0,id"); // Chainlink nodes 1.0.0 and later support this format
req._add("path", "0,id"); // Chainlink nodes 1.0.0 and later support this format
// Sends the request
return sendChainlinkRequest(req, fee);
return _sendChainlinkRequest(req, fee);
}

/**
Expand All @@ -89,7 +89,7 @@ contract FetchFromArray is ChainlinkClient, ConfirmedOwner {
* Allow withdraw of Link tokens from the contract
*/
function withdrawLink() public onlyOwner {
LinkTokenInterface link = LinkTokenInterface(chainlinkTokenAddress());
LinkTokenInterface link = LinkTokenInterface(_chainlinkTokenAddress());
require(
link.transfer(msg.sender, link.balanceOf(address(this))),
"Unable to transfer"
Expand Down
14 changes: 7 additions & 7 deletions public/samples/APIRequests/GenericBigWord.sol
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ contract GenericLargeResponse is ChainlinkClient, ConfirmedOwner {
*
*/
constructor() ConfirmedOwner(msg.sender) {
setChainlinkToken(0x779877A7B0D9E8603169DdbD7836e478b4624789);
setChainlinkOracle(0x6090149792dAAeE9D1D568c9f9a6F6B46AA29eFD);
_setChainlinkToken(0x779877A7B0D9E8603169DdbD7836e478b4624789);
_setChainlinkOracle(0x6090149792dAAeE9D1D568c9f9a6F6B46AA29eFD);
jobId = "7da2702f37fd48e5b1b9a5715e3509b6";
fee = (1 * LINK_DIVISIBILITY) / 10; // 0,1 * 10**18 (Varies by network and job)
}
Expand All @@ -47,17 +47,17 @@ contract GenericLargeResponse is ChainlinkClient, ConfirmedOwner {
* @notice Request variable bytes from the oracle
*/
function requestBytes() public {
Chainlink.Request memory req = buildChainlinkRequest(
Chainlink.Request memory req = _buildChainlinkRequest(
jobId,
address(this),
this.fulfillBytes.selector
);
req.add(
req._add(
"get",
"https://ipfs.io/ipfs/QmZgsvrA1o1C8BGCrx6mHTqR1Ui1XqbCrtbMVrRLHtuPVD?filename=big-api-response.json"
);
req.add("path", "image");
sendChainlinkRequest(req, fee);
req._add("path", "image");
_sendChainlinkRequest(req, fee);
}

event RequestFulfilled(bytes32 indexed requestId, bytes indexed data);
Expand All @@ -79,7 +79,7 @@ contract GenericLargeResponse is ChainlinkClient, ConfirmedOwner {
* Allow withdraw of Link tokens from the contract
*/
function withdrawLink() public onlyOwner {
LinkTokenInterface link = LinkTokenInterface(chainlinkTokenAddress());
LinkTokenInterface link = LinkTokenInterface(_chainlinkTokenAddress());
require(
link.transfer(msg.sender, link.balanceOf(address(this))),
"Unable to transfer"
Expand Down
Loading
Loading