Integrating with Tangle Restaking
To integrate with Tangle Restaking for the purposes of building a DApp or interacting with the restake functionality, you can use the Tangle MultiAssetDelegation and Services precompiles. These contracts provide logic to build new liquid restaking token pools and UIs over Tangle Restaking.
Tangle MultiAssetDelegation data provides information about the current state of the Tangle network restake functionality. If you are looking to use this restake data in your project or build your DAPP, you can use the tangle-restake-precompile library to interact with the restake functionality.
A precompiled contract is native Substrate code that has an Ethereum-style address and can be called using the Ethereum API, like any other smart contract. The precompiles allow you to call the Substrate runtime directly which is not normally accessible from the Ethereum side of Tangle.
How to use the precompile
The precompile can be used like any other Solidity interface.
You can import the precompile in your Solidity project like this:
import "MultiAssetDelegationPrecompile.sol";
To then deposit tokens into the precompile, you can use the deposit
function:
function deposit(uint256 amount, address to) external;
This function will deposit the specified amount of tokens into the precompile and assign the corresponding amount of tokens to the to
address.
More information about the precompile can be found here.