# Day 2 Homework

**Submit your public GitHub repo for the exercise below via** [**this form**](https://chainlinkcommunity.typeform.com/to/Cni3oWCC)

Using chainlink-local write a test for the <https://github.com/smartcontractkit/ccip-cross-chain-name-service> project. You can use <https://cll-devrel.gitbook.io/chainlink-local-documentation> for help.

{% hint style="warning" %}
During the Exercise #3 we used Chainlink Local's Forked Mode with Foundry.\
For this homework you should use Chainlink Local's **Local Mode** with **Hardhat**.
{% endhint %}

In the test you must:

* Create an instance of `CCIPLocalSimulator.sol` smart contract.
* Call the `configuration()` function to get Router contract address.
* Create instances of `CrossChainNameServiceRegister.sol`, `CrossChainNameServiceReceiver.sol` and `CrossChainNameServiceLookup.sol` smart contracts and call the `enableChain()` function where needed.
* Call the `setCrossChainNameServiceAddress` function of the `CrossChainNameServiceLookup.sol` smart contract "source" instance and provide the address of the `CrossChainNameServiceRegister.sol` smart contract instance. Repeat the process for the `CrossChainNameServiceLookup.sol` smart contract "receiver" instance and provide the address of the `CrossChainNameServiceReceiver.sol` smart contract instance.&#x20;
* Call the `register()` function and provide “alice.ccns” and Alice’s EOA address as function arguments.
* Call the `lookup()` function and provide “alice.ccns” as a function argument. Assert that the returned address is Alice’s EOA address.
* Send a url pointing to the public Github repository.

{% hint style="danger" %}
DO NOT PROVIDE PRIVATE KEY OR TESTNET RPC DETAILS, USE HARDHAT NETWORK ONLY!\
\
**npx hardhat test --network hardhat**
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cll-devrel.gitbook.io/ccip-bootcamp/day-2/day-2-homework.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
