fix presentation
This commit is contained in:
parent
bcec691bbb
commit
7ac6b33850
3 changed files with 37 additions and 9 deletions
|
|
@ -44,6 +44,36 @@ This directory contains the core smart contracts for the KRAIKEN protocol.
|
|||
- **Price Validation**: 5-minute TWAP with 50-tick deviation tolerance
|
||||
- **VWAP Compression**: Maximum 1000x compression factor
|
||||
|
||||
### Optimizer Parameters
|
||||
|
||||
All optimizers must return four key parameters that control the LiquidityManager's three-position strategy:
|
||||
|
||||
1. **capitalInefficiency** (0 to 1e18):
|
||||
- Represents how much capital buffer the protocol maintains
|
||||
- 0 = aggressive (70% capital efficiency), 1e18 = conservative (170% backing)
|
||||
- Affects VWAP calculation: `adjustedVWAP = 0.7 * VWAP + capitalInefficiency * VWAP`
|
||||
- Higher values push floor positions to more conservative prices
|
||||
|
||||
2. **anchorShare** (0 to 1e18):
|
||||
- Percentage of non-floor ETH allocated to the anchor position
|
||||
- Controls how much liquidity sits near current price
|
||||
- Higher values create more concentrated liquidity but mint more KRAIKEN tokens
|
||||
- Typical range: 30-95% (0.3e18 to 0.95e18)
|
||||
|
||||
3. **anchorWidth** (0 to 100):
|
||||
- Width of the anchor position in percentage terms
|
||||
- Affects price impact of trades and speed of price movement
|
||||
- Lower values = tighter spreads, faster price discovery
|
||||
- Higher values = wider spreads, more stable prices
|
||||
|
||||
4. **discoveryDepth** (0 to 1e18):
|
||||
- Controls the discovery position's liquidity density relative to anchor
|
||||
- Maps to internal multiplier range of 2x to 10x
|
||||
- At 0: discovery has 2x liquidity per tick vs anchor (minimal)
|
||||
- At 1e18: discovery has 10x liquidity per tick vs anchor (maximum)
|
||||
- Discovery amount formula: `pulledHarb * DISCOVERY_SPACING * (200 + 800 * discoveryDepth/1e18) / anchorSpacing / 100`
|
||||
- Higher values provide stronger anti-arbitrage protection but consume more minted tokens
|
||||
|
||||
## Development Commands
|
||||
|
||||
```bash
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@ contract FuzzingAnalysis is Test, CSVManager {
|
|||
rand = uint256(keccak256(abi.encodePacked(rand, i)));
|
||||
uint256 action = rand % 100;
|
||||
|
||||
if (action < 40) { // 40% chance buy
|
||||
if (action < 25) { // 25% chance buy
|
||||
uint256 wethBal = weth.balanceOf(account);
|
||||
if (wethBal > 0) {
|
||||
uint256 buyPercent = 1 + (rand % 1000); // 0.1% to 100%
|
||||
|
|
@ -209,7 +209,7 @@ contract FuzzingAnalysis is Test, CSVManager {
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (action < 80) { // 40% chance sell
|
||||
} else if (action < 50) { // 25% chance sell
|
||||
uint256 harbBal = harberg.balanceOf(account);
|
||||
if (harbBal > 0) {
|
||||
uint256 sellPercent = 1 + (rand % 1000); // 0.1% to 100%
|
||||
|
|
@ -221,7 +221,7 @@ contract FuzzingAnalysis is Test, CSVManager {
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (action < 95) { // 15% chance recenter
|
||||
} else { // 50% chance recenter
|
||||
uint256 waitTime = 1 minutes + (rand % 10 hours);
|
||||
vm.warp(block.timestamp + waitTime);
|
||||
vm.prank(feeDestination);
|
||||
|
|
@ -230,8 +230,6 @@ contract FuzzingAnalysis is Test, CSVManager {
|
|||
_recordPositionData(string.concat("Recenter_", vm.toString(i)));
|
||||
}
|
||||
} catch {}
|
||||
} else { // 5% chance wait
|
||||
vm.warp(block.timestamp + 1 minutes + (rand % 2 hours));
|
||||
}
|
||||
|
||||
// Skip trades at extreme ticks
|
||||
|
|
|
|||
|
|
@ -245,7 +245,7 @@
|
|||
function simulateCSVData(data) {
|
||||
let previousRow = null;
|
||||
|
||||
data.forEach(row => {
|
||||
data.forEach((row, index) => {
|
||||
const precedingAction = row.precedingAction;
|
||||
const currentTick = parseFloat(row.currentTick);
|
||||
const token0isWeth = row.token0isWeth === 'true' || row.token0isWeth === true;
|
||||
|
|
@ -289,9 +289,9 @@
|
|||
}
|
||||
}
|
||||
|
||||
const ethFormatted = (floorEth + anchorEth + discoveryEth).toFixed(6);
|
||||
const kraikenFormatted = (floorKraiken + anchorKraiken + discoveryKraiken).toFixed(6);
|
||||
const headline = `${precedingAction} ${additionalInfo} | Total ETH: ${ethFormatted}, Total KRAIKEN: ${kraikenFormatted}`;
|
||||
// Calculate CSV line number (index + 2 to account for header line)
|
||||
const lineNumber = index + 2;
|
||||
const headline = `Line ${lineNumber}: ${precedingAction} ${additionalInfo}`;
|
||||
|
||||
simulateEnhanced(headline, currentTick,
|
||||
floorTickLower, floorTickUpper, floorEth, floorKraiken,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue