Comprehensive guide to Yield Delta's smart contracts deployed on SEI Network. Our contracts implement AI-powered yield optimization, automated rebalancing, and secure vault management.
AI-driven dynamic liquidity vault that automatically manages concentrated liquidity positions.
Interface: IStrategyVault
Testnet Address: 0xf6A791e4773A60083AA29aaCCDc3bA5E900974fE
Features:
Factory contract for creating new strategy vaults with different configurations.
Interface: IVaultFactory
Testnet Address: 0x1234567890123456789012345678901234567890
Features:
Oracle contract that provides AI-powered predictions for optimal rebalancing.
Interface: IAIOracle
Testnet Address: 0xABCDEF1234567890ABCDEF1234567890ABCDEF12
Features:
Manages and distributes rewards to vault participants.
Interface: IRewardsDistributor
Testnet Address: 0x9876543210987654321098765432109876543210
Features:
Core interface for interacting with strategy vaults.
interface IStrategyVault {
// Events
event Deposited(address indexed user, uint256 amount0, uint256 amount1, uint256 shares);
event Withdrawn(address indexed user, uint256 shares, uint256 amount0, uint256 amount1);
event Rebalanced(int24 newTickLower, int24 newTickUpper, uint256 timestamp);
event FeesCollected(uint256 fee0, uint256 fee1);
// View functions
function totalValueLocked() external view returns (uint256);
function getCurrentPosition() external view returns (
int24 tickLower,
int24 tickUpper,
uint128 liquidity
);
function getUserShares(address user) external view returns (uint256);
function getPerformanceMetrics() external view returns (
uint256 apy,
uint256 sharpeRatio,
uint256 maxDrawdown
);
// State-changing functions
function deposit(
uint256 amount0Desired,
uint256 amount1Desired,
uint256 amount0Min,
uint256 amount1Min,
address recipient,
uint256 deadline
) external returns (uint256 shares, uint256 amount0, uint256 amount1);
function withdraw(
uint256 shares,
uint256 amount0Min,
uint256 amount1Min,
address recipient,
uint256 deadline
) external returns (uint256 amount0, uint256 amount1);
function rebalance(
int24 newTickLower,
int24 newTickUpper,
uint256 deadline,
bytes calldata aiSignature
) external;
function collectFees() external returns (uint256 fee0, uint256 fee1);
function compound() external;
}Factory interface for creating and managing vaults.
interface IVaultFactory {
// Structs
struct VaultParams {
address token0;
address token1;
uint24 fee;
int24 tickSpacing;
string name;
string strategy;
address oracle;
uint256 rebalanceThreshold;
}
// Events
event VaultCreated(
address indexed vault,
address indexed creator,
address token0,
address token1,
string strategy
);
// Functions
function createVault(
VaultParams calldata params
) external payable returns (address vault);
function getVault(bytes32 salt) external view returns (address);
function getVaultByIndex(uint256 index) external view returns (address);
function allVaultsLength() external view returns (uint256);
function isVault(address vault) external view returns (bool);
function setVaultImplementation(address newImplementation) external;
function updateOracle(address vault, address newOracle) external;
}Oracle interface for AI-powered predictions.
interface IAIOracle {
// Structs
struct RebalanceSignal {
int24 newTickLower;
int24 newTickUpper;
uint256 confidence;
uint256 expectedAPY;
uint256 gasEstimate;
uint256 timestamp;
bytes signature;
}
struct MarketData {
uint256 price;
uint256 volume24h;
uint256 volatility;
uint256 liquidity;
}
// Events
event SignalGenerated(
address indexed vault,
int24 tickLower,
int24 tickUpper,
uint256 confidence
);
event ModelUpdated(string model, address signer);
// Functions
function requestRebalanceSignal(
address vault,
MarketData calldata data
) external returns (bytes32 requestId);
function getSignal(
bytes32 requestId
) external view returns (RebalanceSignal memory);
function validateSignature(
bytes32 requestId,
bytes calldata signature
) external view returns (bool);
function registerModel(
string calldata modelId,
address signer
) external;
function setConfidenceThreshold(uint256 threshold) external;
}Configure your Web3 provider to connect to SEI.
import { ethers } from 'ethers';
// Testnet configuration
const TESTNET_CONFIG = {
chainId: 1328,
name: 'SEI Testnet',
rpcUrl: 'https://evm-rpc-arctic-1.sei-apis.com',
explorer: 'https://seitrace.com',
nativeCurrency: {
name: 'SEI',
symbol: 'SEI',
decimals: 18
}
};
// Connect to SEI
const provider = new ethers.JsonRpcProvider(TESTNET_CONFIG.rpcUrl);
// Connect wallet
const signer = new ethers.Wallet(privateKey, provider);
// Or use MetaMask
if (window.ethereum) {
await window.ethereum.request({
method: 'wallet_addEthereumChain',
params: [{
chainId: '0x' + TESTNET_CONFIG.chainId.toString(16),
chainName: TESTNET_CONFIG.name,
rpcUrls: [TESTNET_CONFIG.rpcUrl],
blockExplorerUrls: [TESTNET_CONFIG.explorer],
nativeCurrency: TESTNET_CONFIG.nativeCurrency
}]
});
}Example of depositing into a strategy vault.
import { ethers } from 'ethers';
import VAULT_ABI from './abis/StrategyVault.json';
// Vault configuration
const VAULT_ADDRESS = '0xf6A791e4773A60083AA29aaCCDc3bA5E900974fE';
const TOKEN0_ADDRESS = '0x...'; // SEI
const TOKEN1_ADDRESS = '0x...'; // USDC
// Initialize contract
const vault = new ethers.Contract(VAULT_ADDRESS, VAULT_ABI, signer);
// Approve tokens first
const token0 = new ethers.Contract(TOKEN0_ADDRESS, ERC20_ABI, signer);
const token1 = new ethers.Contract(TOKEN1_ADDRESS, ERC20_ABI, signer);
const amount0 = ethers.parseEther('10'); // 10 SEI
const amount1 = ethers.parseUnits('100', 6); // 100 USDC
await token0.approve(VAULT_ADDRESS, amount0);
await token1.approve(VAULT_ADDRESS, amount1);
// Deposit into vault
const deadline = Math.floor(Date.now() / 1000) + 3600; // 1 hour
const tx = await vault.deposit(
amount0,
amount1,
0, // amount0Min - set slippage protection
0, // amount1Min - set slippage protection
signer.address,
deadline
);
const receipt = await tx.wait();
console.log('Deposit successful:', receipt.transactionHash);
// Check your shares
const shares = await vault.getUserShares(signer.address);
console.log('Your vault shares:', ethers.formatEther(shares));Track your vault positions and earnings.
// Get vault metrics
const tvl = await vault.totalValueLocked();
const metrics = await vault.getPerformanceMetrics();
console.log('Total Value Locked:', ethers.formatEther(tvl));
console.log('APY:', metrics.apy / 100, '%');
console.log('Sharpe Ratio:', metrics.sharpeRatio / 100);
console.log('Max Drawdown:', metrics.maxDrawdown / 100, '%');
// Get current position
const position = await vault.getCurrentPosition();
console.log('Current tick range:', position.tickLower, '-', position.tickUpper);
console.log('Liquidity:', position.liquidity.toString());
// Calculate your share value
const userShares = await vault.getUserShares(signer.address);
const totalShares = await vault.totalSupply();
const userValue = (tvl * userShares) / totalShares;
console.log('Your position value:', ethers.formatEther(userValue));
// Listen to vault events
vault.on('Rebalanced', (tickLower, tickUpper, timestamp) => {
console.log('Vault rebalanced:', {
newRange: [tickLower, tickUpper],
time: new Date(timestamp * 1000)
});
});
vault.on('FeesCollected', (fee0, fee1) => {
console.log('Fees collected:', {
token0: ethers.formatEther(fee0),
token1: ethers.formatUnits(fee1, 6)
});
});Deploy your own strategy vault using the factory.
import FACTORY_ABI from './abis/VaultFactory.json';
const FACTORY_ADDRESS = '0x1234567890123456789012345678901234567890';
const factory = new ethers.Contract(FACTORY_ADDRESS, FACTORY_ABI, signer);
// Define vault parameters
const vaultParams = {
token0: '0x...', // SEI address
token1: '0x...', // USDC address
fee: 3000, // 0.3% fee tier
tickSpacing: 60,
name: 'My Custom SEI-USDC Vault',
strategy: 'concentrated_liquidity',
oracle: '0xABCDEF1234567890ABCDEF1234567890ABCDEF12',
rebalanceThreshold: 500 // 5% threshold
};
// Create vault (requires deployment fee)
const deploymentFee = ethers.parseEther('0.1');
const tx = await factory.createVault(vaultParams, { value: deploymentFee });
const receipt = await tx.wait();
// Get vault address from events
const event = receipt.logs.find(
log => log.topics[0] === factory.interface.getEventTopic('VaultCreated')
);
const decodedEvent = factory.interface.decodeEventLog('VaultCreated', event.data, event.topics);
const vaultAddress = decodedEvent.vault;
console.log('New vault deployed at:', vaultAddress);CertiK Audit
Comprehensive security audit completed
Status: ✓ Passed
OpenZeppelin Audit
Smart contract security review
Status: ✓ Passed
Critical functions require multiple signatures
Major changes have mandatory delay periods
Built-in protection against price manipulation
Ability to halt operations in case of issues
Protection against reentrancy attacks
We maintain an active bug bounty program to ensure the security of our contracts.
Report vulnerabilities to: security@yielddelta.xyz
SEI Network provides significant gas optimizations compared to other EVM chains:
| Operation | Gas Used | Cost (SEI) | Cost (USD) |
|---|---|---|---|
| Deposit | ~150,000 | 0.0015 | $0.001 |
| Withdraw | ~120,000 | 0.0012 | $0.0008 |
| Rebalance | ~300,000 | 0.003 | $0.002 |
| Collect Fees | ~80,000 | 0.0008 | $0.0005 |
| Create Vault | ~500,000 | 0.005 | $0.003 |
| Contract | Address |
|---|---|
| StrategyVault (SEI-USDC) | 0xf6A791e4773A60083AA29aaCCDc3bA5E900974fE |
| VaultFactory | 0x1234567890123456789012345678901234567890 |
| AIOracle | 0xABCDEF1234567890ABCDEF1234567890ABCDEF12 |
| RewardsDistributor | 0x9876543210987654321098765432109876543210 |
| Governance | 0xFEDCBA9876543210FEDCBA9876543210FEDCBA98 |
Mainnet contracts will be deployed after final audit completion. Join our Discord for deployment updates.
Source code and documentation
Complete API documentation
View transactions on-chain
Get help and connect with developers
Need help? Join our Discord or check the documentation.