Cross-chain KLIMA DAO Staking
Last updated
Last updated
The KLIMA DAO Staking block is an example custom smart contract interaction to achieve a business specific goal, using the Etherspot BUIDLER Component.
🔗 Skip straight to Building your own block
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:
The user can select any asset they own on any chain, and the following process will take place:
From the flow above, the following business logic is performed:
The user selects a blockchain
The owned assets from the selected blockchain are loaded
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
This information is passed to the Etherspot SDK for crosschain offers, and a list of possible crosschain swapping routes are returned
The business logic of the KLIMA block is programmed to select the best offer on behalf of the user
This crosschain swap transaction is added to the transaction batch
A new transaction is programmed to take the swap amount and asset and stake it into the KLIMA DAO staking contract
This contract staking action is added to the transaction batch
If the user has selected to receieve their staked KLIMA into a key wallet addess:
A new transaction is programmed to send the sKLIMA to the desired address and added to the batch.
The batch is executed.
Copy and paste the code below to see the KLIMA Staking Block in action.
Have a look at the open-source Etherspot BUIDLER Component repository here.
🔗 https://github.com/etherspot/etherspot-react-transaction-buidler
See how the KLIMA Staking Block is built here: