Swift protocol for defi
Discover and trade yield-bearing assets with just two simple functions
The OneTx protocol makes it incredibly easy to discover and trade yield-bearing assets. With just two functions, you can browse all available products and execute trades that automatically earn yield for you. All in one transaction.
The AdapterRegistry contract is deployed at 0x7425AAa97230f6D575193667cfd402b0B89C47f2
on the Base Sepolia testnet.
Discover all available yield-bearing assets. Returns a list of all registered adapters with their details.
function getAllRegisteredAdapters() external view returns (AdapterInfo[] memory)
| Name | Type | Description |
|---|---|---|
| adapters | AdapterInfo[] | Array of all registered adapters |
AdapterInfo structure:
Execute a trade and automatically receive yield-bearing tokens. The swap deposits your output tokens into the lending protocol and returns yield-bearing tokens to you.
function swap( PoolKey calldata key, IPoolManager.SwapParams calldata params, bytes calldata hookData ) external returns (BalanceDelta)
| Name | Type | Description |
|---|---|---|
| key | PoolKey | The pool to swap against |
| params | SwapParams | The swap parameters (amount, limits) |
| hookData | bytes | Encoded adapterId and recipient address |
| Name | Type | Description |
|---|---|---|
| delta | BalanceDelta | The balance changes from the swap |
Here's how simple it is to discover and trade yield-bearing assets:
import { createPublicClient, createWalletClient, http, encodeAbiParameters } from 'viem';
import { baseSepolia } from 'viem/chains';
// Step 1: Discover all available products
const products = await publicClient.readContract({
address: '0x7425AAa97230f6D575193667cfd402b0B89C47f2',
abi: registryABI,
functionName: 'getAllRegisteredAdapters'
});
// Step 2: Trade and earn yield automatically
const hookData = encodeAbiParameters(
[{ type: 'string' }, { type: 'string' }],
[products[0].adapterId, myAddress]
);
await walletClient.writeContract({
address: SWAP_ROUTER_ADDRESS,
abi: swapRouterABI,
functionName: 'swap',
args: [poolKey, swapParams, hookData]
});
// Done! You now hold yield-bearing tokensThat's it!
One function to discover products, one function to trade. The protocol handles everything else: depositing to lending protocols, minting yield-bearing tokens, and sending them to you.
Base Sepolia testnet:
0x1d16EAde6bE2D9037f458D53d0B0fD216FC740C40x7Da1D65F8B249183667cdE74C5CBD46dD38AA8290x6F0b25e2abca0b60109549b7823392e3312f505c0x6a546f500b9BDaF1d08acA6DF955e8919886604a