NavImpactLib
Last updated
Provides percentage-based NAV impact validation for cross-chain transfers
Used by both AIntents (source) and ECrosschain (destination) for consistent validation
error EffectiveSupplyTooLow()error NavImpactTooHigh()Thrown when transfer amount exceeds maximum allowed NAV impact
Impact is calculated as (transferValue * 10000) / totalAssetsValue in basis points
uint256 MINIMUM_SUPPLY_RATIOMinimum ratio of effective supply to total supply (1/20 = 5%)
When virtual supply is negative, effective supply must be at least totalSupply / MINIMUM_SUPPLY_RATIO
Validates that transfer amount doesn't exceed NAV impact tolerance
Calculates percentage impact: (transferValue * 10000) / totalAssetsValue vs toleranceBps
token
address
Token being transferred
amount
uint256
Amount being transferred
toleranceBps
uint256
Maximum allowed NAV impact in basis points (e.g., 1000 = 10%)
Validates that effective supply meets minimum threshold when virtual supply is negative
Last updated
function validateNavImpact(address token, uint256 amount, uint256 toleranceBps) internal viewfunction validateSupply(uint256 totalSupply, int256 virtualSupply) internal pure