0
0
Blockchain / Solidityprogramming~10 mins

Oracle integration (Chainlink) in Blockchain / Solidity - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to import the Chainlink client interface.

Blockchain / Solidity
import [1] from '@chainlink/contracts/src/v0.8/ChainlinkClient.sol';
Drag options to blanks, or click blank then click option'
AChainlinkOracle
BChainlinkClient
COracleClient
DChainlinkInterface
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect interface names like ChainlinkOracle or OracleClient.
Misspelling the import path or interface name.
2fill in blank
medium

Complete the code to set the Chainlink oracle address in the constructor.

Blockchain / Solidity
constructor() {
    setChainlinkOracle([1]);
}
Drag options to blanks, or click blank then click option'
A0x0000000000000000000000000000000000000000
Bmsg.sender
Caddress(0)
DoracleAddress
Attempts:
3 left
💡 Hint
Common Mistakes
Passing zero address or msg.sender instead of the oracle address variable.
Forgetting to set the oracle address.
3fill in blank
hard

Fix the error in the request function to correctly build the Chainlink request.

Blockchain / Solidity
function requestData() public returns (bytes32 requestId) {
    Chainlink.Request memory req = buildChainlinkRequest([1], address(this), this.fulfill.selector);
    return sendChainlinkRequest(req, fee);
}
Drag options to blanks, or click blank then click option'
AjobId
Boracle
Cfulfill
DrequestId
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the oracle address instead of the job ID.
Using the wrong function selector.
4fill in blank
hard

Fill both blanks to add a URL and a path to the Chainlink request.

Blockchain / Solidity
req.add([1], [2]);
Drag options to blanks, or click blank then click option'
A"get"
B"https://api.example.com/data"
C"path"
D"data,results,0,value"
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping the key and value arguments.
Using 'path' instead of 'get' for the first argument.
5fill in blank
hard

Fill all three blanks to add the path and multiply the result in the Chainlink request.

Blockchain / Solidity
req.add([1], [2]);
req.addInt([3], 100);
Drag options to blanks, or click blank then click option'
A"path"
B"data,results,0,value"
C"times"
D"multiply"
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect keys like 'multiply' instead of 'times'.
Mixing up the order of arguments.