Integrations
Integrations are libraries that can easily be integrated into modules to simplify the developer experience for common use cases. The ModuleKit currently has integrations for:
- ERC-20 Tokens
- ERC-721 Tokens
- ERC-4626 Vaults
- Uniswap
- Interfaces for the most popular DeFi protocols such as Aave, Compound, Yearn, etc
... and more to come! View all integrations here (opens in a new tab).
To use an integration, simply import it into your module and call the functions that you need.
...
import {UniswapV3Integration} from "modulekit/integrations/uniswap/v3/Uniswap.sol";
contract SwapModule is ERC7579ExecutorBase {
/*//////////////////////////////////////////////////////////////////////////
CONFIG
//////////////////////////////////////////////////////////////////////////*/
...
/*//////////////////////////////////////////////////////////////////////////
MODULE LOGIC
//////////////////////////////////////////////////////////////////////////*/
function swapToken(
address tokenIn,
address tokenOut,
uint256 amountIn,
uint160 sqrtPriceLimitX96
)
external
{
...
Execution[] memory executions = UniswapV3Integration.approveAndSwap({
smartAccount: msg.sender,
tokenIn: IERC20(tokenIn),
tokenOut: IERC20(tokenOut),
amountIn: amountIn,
sqrtPriceLimitX96: sqrtPriceLimitX96
});
IERC7579Account(msg.sender).executeFromExecutor(
ModeLib.encodeSimpleBatch(), ExecutionLib.encodeBatch(executions)
);
...
}
/*//////////////////////////////////////////////////////////////////////////
METADATA
//////////////////////////////////////////////////////////////////////////*/
...
}