# Cross-chain KLIMA DAO Staking

## Introduction

The KLIMA DAO Staking block is an example custom smart contract interaction to achieve a business specific goal, using the Etherspot BUIDLER Component.

:link: Skip straight to [#building-your-own-block](#building-your-own-block "mention")

In this case, this block allows users to stake directly into sKLIMA from any token on any blockchain. This is achieved by using the built-in functionality that Etherspot provides to fetch crosschain swap routes and execute transactions.

When selecting a new transaction, the user can select the KLIMA Staking block:

![](/files/aJLI4j7KoCvwagCoOS0C)

The user can select any asset they own on any chain, and the following process will take place:

<figure><img src="/files/nmp9iigbqkyNfcjxFgPj" alt=""><figcaption></figcaption></figure>

From the flow above, the following business logic is performed:

1. The user selects a blockchain
2. The owned assets from the selected blockchain are loaded
3. The user selects an amount of their token on their selected blockchain that they would like to use to stake into the KLIMA DAO contract
4. This information is passed to the Etherspot SDK for crosschain offers, and a list of possible crosschain swapping routes are returned
5. The business logic of the KLIMA block is programmed to select the best offer on behalf of the user
6. This crosschain swap transaction is added to the transaction batch
7. A new transaction is programmed to take the swap amount and asset and stake it into the KLIMA DAO staking contract
8. This contract staking action is added to the transaction batch
9. If the user has selected to receieve their staked KLIMA into a key wallet addess:
   1. A new transaction is programmed to send the sKLIMA to the desired address and added to the batch.
10. The batch is executed.

### Implementation

Copy and paste the code below to see the KLIMA Staking Block in action.

```jsx
import {
  Etherspot,
  TRANSACTION_BLOCK_TYPE,
} from "@etherspot/react-transaction-buidler";

// ...

return (
  <Etherspot
    defaultTransactionBlocks={[{ type: TRANSACTION_BLOCK_TYPE.KLIMA_STAKE }]}
  />
);
```

### Building your own block

Have a look at the open-source Etherspot BUIDLER Component repository here.

:link: <https://github.com/etherspot/etherspot-react-transaction-buidler>

See how the KLIMA Staking Block is built here:

:link: <https://github.com/etherspot/etherspot-react-transaction-buidler/blob/develop/src/components/TransactionBlock/KlimaStakingTransactionBlock.tsx>


---

# 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://v1.etherspot.io/buidler-react-component/build-your-own-block/cross-chain-klima-dao-staking.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.
