/** * Tests for AbiManager * * Verifies ABI resolution logic for all supported protocols */ describe('AbiManager', () => { it('should have AbiManager class available', () => { const fs = require('fs') const path = require('path') const abiManagerPath = path.join(__dirname, '../../src/helpers/AbiManager.ts') expect(fs.existsSync(abiManagerPath)).toBe(true) }) it('should be exported from helpers index', () => { const fs = require('fs') const path = require('path') const indexPath = path.join(__dirname, '../../src/helpers/index.ts') const indexContent = fs.readFileSync(indexPath, 'utf-8') expect(indexContent).toContain('AbiManager') }) describe('AbiManager structure', () => { it('should have all required methods', () => { const fs = require('fs') const path = require('path') const abiManagerPath = path.join(__dirname, '../../src/helpers/AbiManager.ts') const content = fs.readFileSync(abiManagerPath, 'utf-8') // Verify all required methods exist expect(content).toContain('getPoolAbi') expect(content).toContain('getFactoryAbi') expect(content).toContain('getQuoterV2Abi') expect(content).toContain('getVaultAbi') expect(content).toContain('getSteerPeripheryAbi') }) it('should import from organized ABI structure', () => { const fs = require('fs') const path = require('path') const abiManagerPath = path.join(__dirname, '../../src/helpers/AbiManager.ts') const content = fs.readFileSync(abiManagerPath, 'utf-8') // Verify imports from organized structure expect(content).toContain('../abis/pools') expect(content).toContain('../abis/factories') expect(content).toContain('../abis/quoters') expect(content).toContain('../abis/vaults') expect(content).toContain('../abis/steer') }) it('should use ProtocolDetector', () => { const fs = require('fs') const path = require('path') const abiManagerPath = path.join(__dirname, '../../src/helpers/AbiManager.ts') const content = fs.readFileSync(abiManagerPath, 'utf-8') expect(content).toContain('ProtocolDetector') expect(content).toContain('protocolDetector') }) }) describe('getPoolAbi method', () => { it('should handle all protocol cases', () => { const fs = require('fs') const path = require('path') const abiManagerPath = path.join(__dirname, '../../src/helpers/AbiManager.ts') const content = fs.readFileSync(abiManagerPath, 'utf-8') // Verify all pool ABI cases are handled expect(content).toContain('AlgebraIntegralPool') expect(content).toContain('IQuickSwapV3Pool') expect(content).toContain('AlgebraV3UniDirectionalPool') expect(content).toContain('LimitPool') expect(content).toContain('MachineXV3Pool') expect(content).toContain('AerodromV3Pool') expect(content).toContain('IUniswapV3Pool') }) }) describe('getFactoryAbi method', () => { it('should handle all protocol cases', () => { const fs = require('fs') const path = require('path') const abiManagerPath = path.join(__dirname, '../../src/helpers/AbiManager.ts') const content = fs.readFileSync(abiManagerPath, 'utf-8') // Verify all factory ABI cases are handled expect(content).toContain('AlgebraIntegralFactory') expect(content).toContain('QuickSwapFactory') expect(content).toContain('LimitPoolFactory') expect(content).toContain('UniswapV3Factory') }) }) describe('getQuoterV2Abi method', () => { it('should handle all protocol cases', () => { const fs = require('fs') const path = require('path') const abiManagerPath = path.join(__dirname, '../../src/helpers/AbiManager.ts') const content = fs.readFileSync(abiManagerPath, 'utf-8') // Verify all quoter ABI cases are handled expect(content).toContain('QuoterV2AlgebraIntegral19') expect(content).toContain('QuoterV2Shadow') expect(content).toContain('AlgebraIntegralCustomRouter') expect(content).toContain('QuoterV2Lynex') expect(content).toContain('QuickSwapQuoterV2') expect(content).toContain('QuoterV2Thick') expect(content).toContain('QuoterV2Aerodrom') expect(content).toContain('QuoterV2') }) it('should handle array and object ABI formats', () => { const fs = require('fs') const path = require('path') const abiManagerPath = path.join(__dirname, '../../src/helpers/AbiManager.ts') const content = fs.readFileSync(abiManagerPath, 'utf-8') // Verify handling of both array and object formats expect(content).toContain('Array.isArray') }) }) describe('getVaultAbi method', () => { it('should handle multi-position and single-position vaults', () => { const fs = require('fs') const path = require('path') const abiManagerPath = path.join(__dirname, '../../src/helpers/AbiManager.ts') const content = fs.readFileSync(abiManagerPath, 'utf-8') // Verify vault ABI cases are handled expect(content).toContain('MultiPositionLiquidityManager') expect(content).toContain('SinglePositionLiquidityManager') expect(content).toContain('MultiPositionLiquidityManagerOld') expect(content).toContain('SinglePostionVaultOld') }) it('should handle isUpgraded parameter', () => { const fs = require('fs') const path = require('path') const abiManagerPath = path.join(__dirname, '../../src/helpers/AbiManager.ts') const content = fs.readFileSync(abiManagerPath, 'utf-8') expect(content).toContain('isUpgraded') }) it('should detect multi-position from beacon name', () => { const fs = require('fs') const path = require('path') const abiManagerPath = path.join(__dirname, '../../src/helpers/AbiManager.ts') const content = fs.readFileSync(abiManagerPath, 'utf-8') expect(content).toContain('toLowerCase') expect(content).toContain('multi') expect(content).toContain('aerodrome') }) }) describe('getSteerPeripheryAbi method', () => { it('should return SteerPeriphery ABI', () => { const fs = require('fs') const path = require('path') const abiManagerPath = path.join(__dirname, '../../src/helpers/AbiManager.ts') const content = fs.readFileSync(abiManagerPath, 'utf-8') expect(content).toContain('SteerPeriphery') }) }) describe('Integration with ABIs', () => { it('should import all required ABI categories', () => { const fs = require('fs') const path = require('path') const abiManagerPath = path.join(__dirname, '../../src/helpers/AbiManager.ts') const content = fs.readFileSync(abiManagerPath, 'utf-8') // Verify all ABI category imports expect(content).toContain('import * as Pools') expect(content).toContain('import * as Factories') expect(content).toContain('import * as Quoters') expect(content).toContain('import * as Vaults') expect(content).toContain('import * as Steer') }) }) })