> For the complete documentation index, see [llms.txt](https://clu3-1.gitbook.io/clu3/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://clu3-1.gitbook.io/clu3/customized-clu3/smart-contract.md).

# Smart Contract

If you are here, you already made it! So congrats for that 🎉.

In your Solidity contract, you will need to import clu3 contract, that can be found [here](https://github.com/clu3-project/clu3-contracts).

```
import 'clu3.sol';
```

Then on your smart contract, you will use the function called **useclu3** on the function that you want to protect! ⚔️

```solidity
// useclu3 function has two parameters. (uint256 _timestamp, bytes memory signature)
function useclu3(uint256 _timestamp, bytes memory signature) public returns(bool) {
        bytes32 message = keccak256(abi.encodePacked(msg.sender, _timestamp, cluID));
        if(recoverSigner(message, signature) == publicKey) {
            if(checkStorage(Strings.toString(_timestamp))){
                return true;
            } else {
                revert("timestamp + cluID already used");
            }
        }
        revert("Invalid signature");
```

This function is going to build the message on chain, and see if the signature is valid. If it is valid we will proceed to check if the timestamp was already used. If not, we return <mark style="color:green;">true</mark> and continue with the function, else with revert.

### Deploying the smart contract

To deploy the smart contract to the blockchain you will need to add to the clu3 function two parameters.

```
address _publicKey = //You need to put the public key of the wallet that you used the private key in the backend
uint256 _cluID = // To avoid cross usage when same sign is multi-used
```

Once the contract is deployed, you are done. Thanks for using clu3!

If you have any questions about how to implement clu3 in your own, don't hesitate in contacting us


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://clu3-1.gitbook.io/clu3/customized-clu3/smart-contract.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
