@guru-fund/sdk 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +226 -0
- package/dist/GuruProtocol.d.ts +44 -0
- package/dist/GuruProtocol.js +75 -0
- package/dist/addresses.d.ts +40 -0
- package/dist/addresses.js +111 -0
- package/dist/constants.d.ts +22 -0
- package/dist/constants.js +23 -0
- package/dist/helpers/FundDataFetcher.d.ts +24 -0
- package/dist/helpers/FundDataFetcher.js +66 -0
- package/dist/helpers/ReceiptParser.d.ts +23 -0
- package/dist/helpers/ReceiptParser.js +59 -0
- package/dist/helpers/Token.d.ts +18 -0
- package/dist/helpers/Token.js +43 -0
- package/dist/helpers/compareAddresses.d.ts +1 -0
- package/dist/helpers/compareAddresses.js +15 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +3 -0
- package/dist/quotes/quoteDeposit.d.ts +41 -0
- package/dist/quotes/quoteDeposit.js +186 -0
- package/dist/quotes/quoteHarvest.d.ts +34 -0
- package/dist/quotes/quoteHarvest.js +105 -0
- package/dist/quotes/quoteRebalance.d.ts +51 -0
- package/dist/quotes/quoteRebalance.js +201 -0
- package/dist/quotes/quoteTrade.d.ts +18 -0
- package/dist/quotes/quoteTrade.js +51 -0
- package/dist/quotes/quoteWithdrawal.d.ts +41 -0
- package/dist/quotes/quoteWithdrawal.js +113 -0
- package/dist/router/constants.d.ts +18 -0
- package/dist/router/constants.js +25 -0
- package/dist/router/finalizeRoute.d.ts +16 -0
- package/dist/router/finalizeRoute.js +29 -0
- package/dist/router/getFallbackRoutes.d.ts +10 -0
- package/dist/router/getFallbackRoutes.js +91 -0
- package/dist/router/getUniswapV4Route.d.ts +42 -0
- package/dist/router/getUniswapV4Route.js +324 -0
- package/dist/router/getVeloraRoute.d.ts +10 -0
- package/dist/router/getVeloraRoute.js +68 -0
- package/dist/router/helpers.d.ts +11 -0
- package/dist/router/helpers.js +30 -0
- package/dist/router/index.d.ts +22 -0
- package/dist/router/index.js +135 -0
- package/dist/router/pathCache.d.ts +16 -0
- package/dist/router/pathCache.js +116 -0
- package/dist/router/poolHelper.d.ts +126 -0
- package/dist/router/poolHelper.js +807 -0
- package/dist/router/quoteWethTrade.d.ts +14 -0
- package/dist/router/quoteWethTrade.js +125 -0
- package/dist/router/simulation.d.ts +43 -0
- package/dist/router/simulation.js +70 -0
- package/dist/router/types.d.ts +149 -0
- package/dist/router/types.js +1 -0
- package/dist/router/v4PoolDiscovery.d.ts +30 -0
- package/dist/router/v4PoolDiscovery.js +147 -0
- package/dist/router/velora.d.ts +42 -0
- package/dist/router/velora.js +279 -0
- package/dist/schemas/index.d.ts +6 -0
- package/dist/schemas/index.js +6 -0
- package/dist/schemas/primitives.d.ts +3 -0
- package/dist/schemas/primitives.js +9 -0
- package/dist/schemas/quoteDeposit.d.ts +23 -0
- package/dist/schemas/quoteDeposit.js +10 -0
- package/dist/schemas/quoteHarvest.d.ts +17 -0
- package/dist/schemas/quoteHarvest.js +8 -0
- package/dist/schemas/quoteRebalance.d.ts +29 -0
- package/dist/schemas/quoteRebalance.js +10 -0
- package/dist/schemas/quoteTrade.d.ts +20 -0
- package/dist/schemas/quoteTrade.js +9 -0
- package/dist/schemas/quoteWithdrawal.d.ts +23 -0
- package/dist/schemas/quoteWithdrawal.js +10 -0
- package/dist/txBuilders/buildDepositTx.d.ts +17 -0
- package/dist/txBuilders/buildDepositTx.js +18 -0
- package/dist/txBuilders/buildHarvestTx.d.ts +16 -0
- package/dist/txBuilders/buildHarvestTx.js +17 -0
- package/dist/txBuilders/buildTradeTx.d.ts +9 -0
- package/dist/txBuilders/buildTradeTx.js +9 -0
- package/dist/txBuilders/buildWithdrawTx.d.ts +16 -0
- package/dist/txBuilders/buildWithdrawTx.js +17 -0
- package/dist/txBuilders/index.d.ts +8 -0
- package/dist/txBuilders/index.js +4 -0
- package/dist/typechain/common.d.ts +50 -0
- package/dist/typechain/common.js +1 -0
- package/dist/typechain/factories/include/IPancakeQuoterV2__factory.d.ts +225 -0
- package/dist/typechain/factories/include/IPancakeQuoterV2__factory.js +295 -0
- package/dist/typechain/factories/include/ISwapRouter02__factory.d.ts +826 -0
- package/dist/typechain/factories/include/ISwapRouter02__factory.js +1073 -0
- package/dist/typechain/factories/include/index.d.ts +2 -0
- package/dist/typechain/factories/include/index.js +2 -0
- package/dist/typechain/factories/index.d.ts +2 -0
- package/dist/typechain/factories/index.js +2 -0
- package/dist/typechain/factories/out/Adapter__factory.d.ts +31 -0
- package/dist/typechain/factories/out/Adapter__factory.js +43 -0
- package/dist/typechain/factories/out/AerodromeV2Adapter__factory.d.ts +179 -0
- package/dist/typechain/factories/out/AerodromeV2Adapter__factory.js +237 -0
- package/dist/typechain/factories/out/AerodromeV3Adapter__factory.d.ts +162 -0
- package/dist/typechain/factories/out/AerodromeV3Adapter__factory.js +215 -0
- package/dist/typechain/factories/out/AssetManager.sol/LedgerAssetManager__factory.d.ts +1032 -0
- package/dist/typechain/factories/out/AssetManager.sol/LedgerAssetManager__factory.js +1357 -0
- package/dist/typechain/factories/out/AssetManager.sol/index.d.ts +1 -0
- package/dist/typechain/factories/out/AssetManager.sol/index.js +1 -0
- package/dist/typechain/factories/out/Bookkeeper.sol/LedgerBookkeeper__factory.d.ts +950 -0
- package/dist/typechain/factories/out/Bookkeeper.sol/LedgerBookkeeper__factory.js +1250 -0
- package/dist/typechain/factories/out/Bookkeeper.sol/index.d.ts +1 -0
- package/dist/typechain/factories/out/Bookkeeper.sol/index.js +1 -0
- package/dist/typechain/factories/out/Checkpoint.sol/CheckpointController__factory.d.ts +33 -0
- package/dist/typechain/factories/out/Checkpoint.sol/CheckpointController__factory.js +47 -0
- package/dist/typechain/factories/out/Checkpoint.sol/index.d.ts +1 -0
- package/dist/typechain/factories/out/Checkpoint.sol/index.js +1 -0
- package/dist/typechain/factories/out/Closure.sol/ClosureController__factory.d.ts +459 -0
- package/dist/typechain/factories/out/Closure.sol/ClosureController__factory.js +603 -0
- package/dist/typechain/factories/out/Closure.sol/index.d.ts +1 -0
- package/dist/typechain/factories/out/Closure.sol/index.js +1 -0
- package/dist/typechain/factories/out/ContextBuilder__factory.d.ts +671 -0
- package/dist/typechain/factories/out/ContextBuilder__factory.js +870 -0
- package/dist/typechain/factories/out/Control.sol/Controllable__factory.d.ts +107 -0
- package/dist/typechain/factories/out/Control.sol/Controllable__factory.js +141 -0
- package/dist/typechain/factories/out/Control.sol/Controller__factory.d.ts +21 -0
- package/dist/typechain/factories/out/Control.sol/Controller__factory.js +30 -0
- package/dist/typechain/factories/out/Control.sol/index.d.ts +2 -0
- package/dist/typechain/factories/out/Control.sol/index.js +2 -0
- package/dist/typechain/factories/out/Controller.sol/ClosureDelegate__factory.d.ts +57 -0
- package/dist/typechain/factories/out/Controller.sol/ClosureDelegate__factory.js +77 -0
- package/dist/typechain/factories/out/Controller.sol/CreationDelegate__factory.d.ts +58 -0
- package/dist/typechain/factories/out/Controller.sol/CreationDelegate__factory.js +77 -0
- package/dist/typechain/factories/out/Controller.sol/DepositDelegate__factory.d.ts +55 -0
- package/dist/typechain/factories/out/Controller.sol/DepositDelegate__factory.js +74 -0
- package/dist/typechain/factories/out/Controller.sol/FundController__factory.d.ts +703 -0
- package/dist/typechain/factories/out/Controller.sol/FundController__factory.js +911 -0
- package/dist/typechain/factories/out/Controller.sol/HarvestDelegate__factory.d.ts +234 -0
- package/dist/typechain/factories/out/Controller.sol/HarvestDelegate__factory.js +303 -0
- package/dist/typechain/factories/out/Controller.sol/TradeDelegate__factory.d.ts +61 -0
- package/dist/typechain/factories/out/Controller.sol/TradeDelegate__factory.js +81 -0
- package/dist/typechain/factories/out/Controller.sol/TransferDelegate__factory.d.ts +29 -0
- package/dist/typechain/factories/out/Controller.sol/TransferDelegate__factory.js +40 -0
- package/dist/typechain/factories/out/Controller.sol/WithdrawalDelegate__factory.d.ts +51 -0
- package/dist/typechain/factories/out/Controller.sol/WithdrawalDelegate__factory.js +69 -0
- package/dist/typechain/factories/out/Controller.sol/index.d.ts +8 -0
- package/dist/typechain/factories/out/Controller.sol/index.js +8 -0
- package/dist/typechain/factories/out/Cooldown.sol/LedgerCooldown__factory.d.ts +747 -0
- package/dist/typechain/factories/out/Cooldown.sol/LedgerCooldown__factory.js +982 -0
- package/dist/typechain/factories/out/Cooldown.sol/index.d.ts +1 -0
- package/dist/typechain/factories/out/Cooldown.sol/index.js +1 -0
- package/dist/typechain/factories/out/Creation.sol/CreationController__factory.d.ts +172 -0
- package/dist/typechain/factories/out/Creation.sol/CreationController__factory.js +225 -0
- package/dist/typechain/factories/out/Creation.sol/index.d.ts +1 -0
- package/dist/typechain/factories/out/Creation.sol/index.js +1 -0
- package/dist/typechain/factories/out/Deposit.sol/DepositController__factory.d.ts +162 -0
- package/dist/typechain/factories/out/Deposit.sol/DepositController__factory.js +223 -0
- package/dist/typechain/factories/out/Deposit.sol/index.d.ts +1 -0
- package/dist/typechain/factories/out/Deposit.sol/index.js +1 -0
- package/dist/typechain/factories/out/Error__factory.d.ts +318 -0
- package/dist/typechain/factories/out/Error__factory.js +423 -0
- package/dist/typechain/factories/out/Harvest.sol/HarvestController__factory.d.ts +401 -0
- package/dist/typechain/factories/out/Harvest.sol/HarvestController__factory.js +527 -0
- package/dist/typechain/factories/out/Harvest.sol/index.d.ts +1 -0
- package/dist/typechain/factories/out/Harvest.sol/index.js +1 -0
- package/dist/typechain/factories/out/IAerodromeRouter__factory.d.ts +85 -0
- package/dist/typechain/factories/out/IAerodromeRouter__factory.js +113 -0
- package/dist/typechain/factories/out/IAerodromeSwapRouter__factory.d.ts +89 -0
- package/dist/typechain/factories/out/IAerodromeSwapRouter__factory.js +119 -0
- package/dist/typechain/factories/out/IUniswapV4.sol/IPermit2__factory.d.ts +29 -0
- package/dist/typechain/factories/out/IUniswapV4.sol/IPermit2__factory.js +40 -0
- package/dist/typechain/factories/out/IUniswapV4.sol/IUniversalRouter__factory.d.ts +25 -0
- package/dist/typechain/factories/out/IUniswapV4.sol/IUniversalRouter__factory.js +35 -0
- package/dist/typechain/factories/out/IUniswapV4.sol/index.d.ts +2 -0
- package/dist/typechain/factories/out/IUniswapV4.sol/index.js +2 -0
- package/dist/typechain/factories/out/IV0Fund__factory.d.ts +129 -0
- package/dist/typechain/factories/out/IV0Fund__factory.js +173 -0
- package/dist/typechain/factories/out/IV3SwapRouter__factory.d.ts +38 -0
- package/dist/typechain/factories/out/IV3SwapRouter__factory.js +53 -0
- package/dist/typechain/factories/out/Initializer.sol/LedgerInitializer__factory.d.ts +655 -0
- package/dist/typechain/factories/out/Initializer.sol/LedgerInitializer__factory.js +859 -0
- package/dist/typechain/factories/out/Initializer.sol/VaultInitializer__factory.d.ts +141 -0
- package/dist/typechain/factories/out/Initializer.sol/VaultInitializer__factory.js +185 -0
- package/dist/typechain/factories/out/Initializer.sol/index.d.ts +2 -0
- package/dist/typechain/factories/out/Initializer.sol/index.js +2 -0
- package/dist/typechain/factories/out/Ledger.sol/FundLedger__factory.d.ts +1502 -0
- package/dist/typechain/factories/out/Ledger.sol/FundLedger__factory.js +1959 -0
- package/dist/typechain/factories/out/Ledger.sol/index.d.ts +1 -0
- package/dist/typechain/factories/out/Ledger.sol/index.js +1 -0
- package/dist/typechain/factories/out/LotusP2P__factory.d.ts +847 -0
- package/dist/typechain/factories/out/LotusP2P__factory.js +1095 -0
- package/dist/typechain/factories/out/MulticallStatic__factory.d.ts +29 -0
- package/dist/typechain/factories/out/MulticallStatic__factory.js +42 -0
- package/dist/typechain/factories/out/Operator.sol/VaultOperator__factory.d.ts +235 -0
- package/dist/typechain/factories/out/Operator.sol/VaultOperator__factory.js +308 -0
- package/dist/typechain/factories/out/Operator.sol/index.d.ts +1 -0
- package/dist/typechain/factories/out/Operator.sol/index.js +1 -0
- package/dist/typechain/factories/out/P2PAdapter__factory.d.ts +216 -0
- package/dist/typechain/factories/out/P2PAdapter__factory.js +287 -0
- package/dist/typechain/factories/out/ProtocolMigrationExtension__factory.d.ts +1084 -0
- package/dist/typechain/factories/out/ProtocolMigrationExtension__factory.js +1409 -0
- package/dist/typechain/factories/out/ProtocolProvider__factory.d.ts +21 -0
- package/dist/typechain/factories/out/ProtocolProvider__factory.js +30 -0
- package/dist/typechain/factories/out/Protocol__factory.d.ts +1095 -0
- package/dist/typechain/factories/out/Protocol__factory.js +1424 -0
- package/dist/typechain/factories/out/Registrar.sol/LedgerRegistrar__factory.d.ts +1375 -0
- package/dist/typechain/factories/out/Registrar.sol/LedgerRegistrar__factory.js +1791 -0
- package/dist/typechain/factories/out/Registrar.sol/index.d.ts +1 -0
- package/dist/typechain/factories/out/Registrar.sol/index.js +1 -0
- package/dist/typechain/factories/out/Settings.sol/SettingsController__factory.d.ts +143 -0
- package/dist/typechain/factories/out/Settings.sol/SettingsController__factory.js +188 -0
- package/dist/typechain/factories/out/Settings.sol/index.d.ts +1 -0
- package/dist/typechain/factories/out/Settings.sol/index.js +1 -0
- package/dist/typechain/factories/out/Shares.sol/ICheckpointController__factory.d.ts +21 -0
- package/dist/typechain/factories/out/Shares.sol/ICheckpointController__factory.js +31 -0
- package/dist/typechain/factories/out/Shares.sol/ITransferController__factory.d.ts +25 -0
- package/dist/typechain/factories/out/Shares.sol/ITransferController__factory.js +35 -0
- package/dist/typechain/factories/out/Shares.sol/LedgerShares__factory.d.ts +829 -0
- package/dist/typechain/factories/out/Shares.sol/LedgerShares__factory.js +1089 -0
- package/dist/typechain/factories/out/Shares.sol/index.d.ts +3 -0
- package/dist/typechain/factories/out/Shares.sol/index.js +3 -0
- package/dist/typechain/factories/out/SignatureVerifier__factory.d.ts +171 -0
- package/dist/typechain/factories/out/SignatureVerifier__factory.js +224 -0
- package/dist/typechain/factories/out/Storage.sol/LedgerStorage__factory.d.ts +527 -0
- package/dist/typechain/factories/out/Storage.sol/LedgerStorage__factory.js +695 -0
- package/dist/typechain/factories/out/Storage.sol/index.d.ts +1 -0
- package/dist/typechain/factories/out/Storage.sol/index.js +1 -0
- package/dist/typechain/factories/out/Trade.sol/TradeController__factory.d.ts +200 -0
- package/dist/typechain/factories/out/Trade.sol/TradeController__factory.js +262 -0
- package/dist/typechain/factories/out/Trade.sol/index.d.ts +1 -0
- package/dist/typechain/factories/out/Trade.sol/index.js +1 -0
- package/dist/typechain/factories/out/Transfer.sol/TransferController__factory.d.ts +100 -0
- package/dist/typechain/factories/out/Transfer.sol/TransferController__factory.js +141 -0
- package/dist/typechain/factories/out/Transfer.sol/index.d.ts +1 -0
- package/dist/typechain/factories/out/Transfer.sol/index.js +1 -0
- package/dist/typechain/factories/out/UniswapV2Adapter__factory.d.ts +162 -0
- package/dist/typechain/factories/out/UniswapV2Adapter__factory.js +215 -0
- package/dist/typechain/factories/out/UniswapV3Adapter__factory.d.ts +162 -0
- package/dist/typechain/factories/out/UniswapV3Adapter__factory.js +215 -0
- package/dist/typechain/factories/out/UniswapV3SwapRouter02Adapter__factory.d.ts +162 -0
- package/dist/typechain/factories/out/UniswapV3SwapRouter02Adapter__factory.js +215 -0
- package/dist/typechain/factories/out/UniswapV4Adapter__factory.d.ts +203 -0
- package/dist/typechain/factories/out/UniswapV4Adapter__factory.js +268 -0
- package/dist/typechain/factories/out/V0ToLotusMigrator__factory.d.ts +216 -0
- package/dist/typechain/factories/out/V0ToLotusMigrator__factory.js +284 -0
- package/dist/typechain/factories/out/Vault.sol/FundVault__factory.d.ts +258 -0
- package/dist/typechain/factories/out/Vault.sol/FundVault__factory.js +339 -0
- package/dist/typechain/factories/out/Vault.sol/index.d.ts +1 -0
- package/dist/typechain/factories/out/Vault.sol/index.js +1 -0
- package/dist/typechain/factories/out/Withdrawal.sol/WithdrawalController__factory.d.ts +285 -0
- package/dist/typechain/factories/out/Withdrawal.sol/WithdrawalController__factory.js +377 -0
- package/dist/typechain/factories/out/Withdrawal.sol/index.d.ts +1 -0
- package/dist/typechain/factories/out/Withdrawal.sol/index.js +1 -0
- package/dist/typechain/factories/out/index.d.ts +43 -0
- package/dist/typechain/factories/out/index.js +43 -0
- package/dist/typechain/include/IPancakeQuoterV2.d.ts +223 -0
- package/dist/typechain/include/IPancakeQuoterV2.js +1 -0
- package/dist/typechain/include/ISwapRouter02.d.ts +682 -0
- package/dist/typechain/include/ISwapRouter02.js +1 -0
- package/dist/typechain/include/index.d.ts +2 -0
- package/dist/typechain/include/index.js +1 -0
- package/dist/typechain/index.d.ts +119 -0
- package/dist/typechain/index.js +58 -0
- package/dist/typechain/out/Adapter.d.ts +29 -0
- package/dist/typechain/out/Adapter.js +1 -0
- package/dist/typechain/out/AerodromeV2Adapter.d.ts +106 -0
- package/dist/typechain/out/AerodromeV2Adapter.js +1 -0
- package/dist/typechain/out/AerodromeV3Adapter.d.ts +87 -0
- package/dist/typechain/out/AerodromeV3Adapter.js +1 -0
- package/dist/typechain/out/AssetManager.sol/LedgerAssetManager.d.ts +604 -0
- package/dist/typechain/out/AssetManager.sol/LedgerAssetManager.js +1 -0
- package/dist/typechain/out/AssetManager.sol/index.d.ts +1 -0
- package/dist/typechain/out/AssetManager.sol/index.js +1 -0
- package/dist/typechain/out/Bookkeeper.sol/LedgerBookkeeper.d.ts +548 -0
- package/dist/typechain/out/Bookkeeper.sol/LedgerBookkeeper.js +1 -0
- package/dist/typechain/out/Bookkeeper.sol/index.d.ts +1 -0
- package/dist/typechain/out/Bookkeeper.sol/index.js +1 -0
- package/dist/typechain/out/Checkpoint.sol/CheckpointController.d.ts +29 -0
- package/dist/typechain/out/Checkpoint.sol/CheckpointController.js +1 -0
- package/dist/typechain/out/Checkpoint.sol/index.d.ts +1 -0
- package/dist/typechain/out/Checkpoint.sol/index.js +1 -0
- package/dist/typechain/out/Closure.sol/ClosureController.d.ts +273 -0
- package/dist/typechain/out/Closure.sol/ClosureController.js +1 -0
- package/dist/typechain/out/Closure.sol/index.d.ts +1 -0
- package/dist/typechain/out/Closure.sol/index.js +1 -0
- package/dist/typechain/out/ContextBuilder.d.ts +403 -0
- package/dist/typechain/out/ContextBuilder.js +1 -0
- package/dist/typechain/out/Control.sol/Controllable.d.ts +97 -0
- package/dist/typechain/out/Control.sol/Controllable.js +1 -0
- package/dist/typechain/out/Control.sol/Controller.d.ts +25 -0
- package/dist/typechain/out/Control.sol/Controller.js +1 -0
- package/dist/typechain/out/Control.sol/index.d.ts +2 -0
- package/dist/typechain/out/Control.sol/index.js +1 -0
- package/dist/typechain/out/Controller.sol/ClosureDelegate.d.ts +61 -0
- package/dist/typechain/out/Controller.sol/ClosureDelegate.js +1 -0
- package/dist/typechain/out/Controller.sol/CreationDelegate.d.ts +61 -0
- package/dist/typechain/out/Controller.sol/CreationDelegate.js +1 -0
- package/dist/typechain/out/Controller.sol/DepositDelegate.d.ts +56 -0
- package/dist/typechain/out/Controller.sol/DepositDelegate.js +1 -0
- package/dist/typechain/out/Controller.sol/FundController.d.ts +464 -0
- package/dist/typechain/out/Controller.sol/FundController.js +1 -0
- package/dist/typechain/out/Controller.sol/HarvestDelegate.d.ts +163 -0
- package/dist/typechain/out/Controller.sol/HarvestDelegate.js +1 -0
- package/dist/typechain/out/Controller.sol/TradeDelegate.d.ts +67 -0
- package/dist/typechain/out/Controller.sol/TradeDelegate.js +1 -0
- package/dist/typechain/out/Controller.sol/TransferDelegate.d.ts +37 -0
- package/dist/typechain/out/Controller.sol/TransferDelegate.js +1 -0
- package/dist/typechain/out/Controller.sol/WithdrawalDelegate.d.ts +53 -0
- package/dist/typechain/out/Controller.sol/WithdrawalDelegate.js +1 -0
- package/dist/typechain/out/Controller.sol/index.d.ts +8 -0
- package/dist/typechain/out/Controller.sol/index.js +1 -0
- package/dist/typechain/out/Cooldown.sol/LedgerCooldown.d.ts +446 -0
- package/dist/typechain/out/Cooldown.sol/LedgerCooldown.js +1 -0
- package/dist/typechain/out/Cooldown.sol/index.d.ts +1 -0
- package/dist/typechain/out/Cooldown.sol/index.js +1 -0
- package/dist/typechain/out/Creation.sol/CreationController.d.ts +102 -0
- package/dist/typechain/out/Creation.sol/CreationController.js +1 -0
- package/dist/typechain/out/Creation.sol/index.d.ts +1 -0
- package/dist/typechain/out/Creation.sol/index.js +1 -0
- package/dist/typechain/out/Deposit.sol/DepositController.d.ts +68 -0
- package/dist/typechain/out/Deposit.sol/DepositController.js +1 -0
- package/dist/typechain/out/Deposit.sol/index.d.ts +1 -0
- package/dist/typechain/out/Deposit.sol/index.js +1 -0
- package/dist/typechain/out/Error.d.ts +20 -0
- package/dist/typechain/out/Error.js +1 -0
- package/dist/typechain/out/Harvest.sol/HarvestController.d.ts +241 -0
- package/dist/typechain/out/Harvest.sol/HarvestController.js +1 -0
- package/dist/typechain/out/Harvest.sol/index.d.ts +1 -0
- package/dist/typechain/out/Harvest.sol/index.js +1 -0
- package/dist/typechain/out/IAerodromeRouter.d.ts +80 -0
- package/dist/typechain/out/IAerodromeRouter.js +1 -0
- package/dist/typechain/out/IAerodromeSwapRouter.d.ts +96 -0
- package/dist/typechain/out/IAerodromeSwapRouter.js +1 -0
- package/dist/typechain/out/IUniswapV4.sol/IPermit2.d.ts +39 -0
- package/dist/typechain/out/IUniswapV4.sol/IPermit2.js +1 -0
- package/dist/typechain/out/IUniswapV4.sol/IUniversalRouter.d.ts +37 -0
- package/dist/typechain/out/IUniswapV4.sol/IUniversalRouter.js +1 -0
- package/dist/typechain/out/IUniswapV4.sol/index.d.ts +2 -0
- package/dist/typechain/out/IUniswapV4.sol/index.js +1 -0
- package/dist/typechain/out/IV0Fund.d.ts +69 -0
- package/dist/typechain/out/IV0Fund.js +1 -0
- package/dist/typechain/out/IV3SwapRouter.d.ts +52 -0
- package/dist/typechain/out/IV3SwapRouter.js +1 -0
- package/dist/typechain/out/Initializer.sol/LedgerInitializer.d.ts +379 -0
- package/dist/typechain/out/Initializer.sol/LedgerInitializer.js +1 -0
- package/dist/typechain/out/Initializer.sol/VaultInitializer.d.ts +129 -0
- package/dist/typechain/out/Initializer.sol/VaultInitializer.js +1 -0
- package/dist/typechain/out/Initializer.sol/index.d.ts +2 -0
- package/dist/typechain/out/Initializer.sol/index.js +1 -0
- package/dist/typechain/out/Ledger.sol/FundLedger.d.ts +926 -0
- package/dist/typechain/out/Ledger.sol/FundLedger.js +1 -0
- package/dist/typechain/out/Ledger.sol/index.d.ts +1 -0
- package/dist/typechain/out/Ledger.sol/index.js +1 -0
- package/dist/typechain/out/LotusP2P.d.ts +610 -0
- package/dist/typechain/out/LotusP2P.js +1 -0
- package/dist/typechain/out/MulticallStatic.d.ts +25 -0
- package/dist/typechain/out/MulticallStatic.js +1 -0
- package/dist/typechain/out/Operator.sol/VaultOperator.d.ts +197 -0
- package/dist/typechain/out/Operator.sol/VaultOperator.js +1 -0
- package/dist/typechain/out/Operator.sol/index.d.ts +1 -0
- package/dist/typechain/out/Operator.sol/index.js +1 -0
- package/dist/typechain/out/P2PAdapter.d.ts +100 -0
- package/dist/typechain/out/P2PAdapter.js +1 -0
- package/dist/typechain/out/Protocol.d.ts +815 -0
- package/dist/typechain/out/Protocol.js +1 -0
- package/dist/typechain/out/ProtocolMigrationExtension.d.ts +806 -0
- package/dist/typechain/out/ProtocolMigrationExtension.js +1 -0
- package/dist/typechain/out/ProtocolProvider.d.ts +25 -0
- package/dist/typechain/out/ProtocolProvider.js +1 -0
- package/dist/typechain/out/Registrar.sol/LedgerRegistrar.d.ts +866 -0
- package/dist/typechain/out/Registrar.sol/LedgerRegistrar.js +1 -0
- package/dist/typechain/out/Registrar.sol/index.d.ts +1 -0
- package/dist/typechain/out/Registrar.sol/index.js +1 -0
- package/dist/typechain/out/Settings.sol/SettingsController.d.ts +97 -0
- package/dist/typechain/out/Settings.sol/SettingsController.js +1 -0
- package/dist/typechain/out/Settings.sol/index.d.ts +1 -0
- package/dist/typechain/out/Settings.sol/index.js +1 -0
- package/dist/typechain/out/Shares.sol/ICheckpointController.d.ts +29 -0
- package/dist/typechain/out/Shares.sol/ICheckpointController.js +1 -0
- package/dist/typechain/out/Shares.sol/ITransferController.d.ts +37 -0
- package/dist/typechain/out/Shares.sol/ITransferController.js +1 -0
- package/dist/typechain/out/Shares.sol/LedgerShares.d.ts +494 -0
- package/dist/typechain/out/Shares.sol/LedgerShares.js +1 -0
- package/dist/typechain/out/Shares.sol/index.d.ts +3 -0
- package/dist/typechain/out/Shares.sol/index.js +1 -0
- package/dist/typechain/out/SignatureVerifier.d.ts +139 -0
- package/dist/typechain/out/SignatureVerifier.js +1 -0
- package/dist/typechain/out/Storage.sol/LedgerStorage.d.ts +281 -0
- package/dist/typechain/out/Storage.sol/LedgerStorage.js +1 -0
- package/dist/typechain/out/Storage.sol/index.d.ts +1 -0
- package/dist/typechain/out/Storage.sol/index.js +1 -0
- package/dist/typechain/out/Trade.sol/TradeController.d.ts +137 -0
- package/dist/typechain/out/Trade.sol/TradeController.js +1 -0
- package/dist/typechain/out/Trade.sol/index.d.ts +1 -0
- package/dist/typechain/out/Trade.sol/index.js +1 -0
- package/dist/typechain/out/Transfer.sol/TransferController.d.ts +49 -0
- package/dist/typechain/out/Transfer.sol/TransferController.js +1 -0
- package/dist/typechain/out/Transfer.sol/index.d.ts +1 -0
- package/dist/typechain/out/Transfer.sol/index.js +1 -0
- package/dist/typechain/out/UniswapV2Adapter.d.ts +87 -0
- package/dist/typechain/out/UniswapV2Adapter.js +1 -0
- package/dist/typechain/out/UniswapV3Adapter.d.ts +87 -0
- package/dist/typechain/out/UniswapV3Adapter.js +1 -0
- package/dist/typechain/out/UniswapV3SwapRouter02Adapter.d.ts +87 -0
- package/dist/typechain/out/UniswapV3SwapRouter02Adapter.js +1 -0
- package/dist/typechain/out/UniswapV4Adapter.d.ts +110 -0
- package/dist/typechain/out/UniswapV4Adapter.js +1 -0
- package/dist/typechain/out/V0ToLotusMigrator.d.ts +94 -0
- package/dist/typechain/out/V0ToLotusMigrator.js +1 -0
- package/dist/typechain/out/Vault.sol/FundVault.d.ts +197 -0
- package/dist/typechain/out/Vault.sol/FundVault.js +1 -0
- package/dist/typechain/out/Vault.sol/index.d.ts +1 -0
- package/dist/typechain/out/Vault.sol/index.js +1 -0
- package/dist/typechain/out/Withdrawal.sol/WithdrawalController.d.ts +152 -0
- package/dist/typechain/out/Withdrawal.sol/WithdrawalController.js +1 -0
- package/dist/typechain/out/Withdrawal.sol/index.d.ts +1 -0
- package/dist/typechain/out/Withdrawal.sol/index.js +1 -0
- package/dist/typechain/out/index.d.ts +65 -0
- package/dist/typechain/out/index.js +1 -0
- package/dist/types/Fund.d.ts +27 -0
- package/dist/types/Fund.js +1 -0
- package/package.json +67 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import compareAddresses from '../helpers/compareAddresses.js';
|
|
2
|
+
import { VELORA_ENDPOINT, VELORA_NEGATIVE_CACHE_TTL, VELORA_PATH_CACHE_TTL, VELORA_VERSION_BY_DEX, } from './constants.js';
|
|
3
|
+
export function extractPathFromResponse(dex, response) {
|
|
4
|
+
if (dex === 'UniswapV4') {
|
|
5
|
+
return extractV4Path(response);
|
|
6
|
+
}
|
|
7
|
+
if (dex === 'UniswapV2' || dex === 'PancakeSwapV2') {
|
|
8
|
+
const v2Response = response;
|
|
9
|
+
const path = v2Response.priceRoute.bestRoute[0].swaps[0].swapExchanges[0]
|
|
10
|
+
.data.path;
|
|
11
|
+
return { type: 'v2', path, hops: path.length - 1 };
|
|
12
|
+
}
|
|
13
|
+
const v3Response = response;
|
|
14
|
+
const swaps = v3Response.priceRoute.bestRoute[0].swaps;
|
|
15
|
+
const combinedPath = [];
|
|
16
|
+
for (const swap of swaps) {
|
|
17
|
+
const swapPath = swap.swapExchanges[0].data.path;
|
|
18
|
+
if (!Array.isArray(swapPath) ||
|
|
19
|
+
typeof swapPath[0]?.tokenIn !== 'string' ||
|
|
20
|
+
typeof swapPath[0]?.fee !== 'string') {
|
|
21
|
+
throw new Error('Unexpected V3 path structure');
|
|
22
|
+
}
|
|
23
|
+
combinedPath.push(...swapPath);
|
|
24
|
+
}
|
|
25
|
+
return { type: 'v3', path: combinedPath, hops: combinedPath.length };
|
|
26
|
+
}
|
|
27
|
+
function toV4PathHop(hop) {
|
|
28
|
+
return {
|
|
29
|
+
tokenIn: hop.tokenIn,
|
|
30
|
+
tokenOut: hop.tokenOut,
|
|
31
|
+
fee: Number(hop.pool.key.fee),
|
|
32
|
+
tickSpacing: hop.pool.key.tickSpacing,
|
|
33
|
+
hooks: hop.pool.key.hooks,
|
|
34
|
+
hookData: '0x',
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export function extractV4Path(response) {
|
|
38
|
+
const swaps = response.priceRoute.bestRoute[0].swaps;
|
|
39
|
+
const legs = swaps.map((swap) => [...swap.swapExchanges].sort((a, b) => b.percent - a.percent));
|
|
40
|
+
const combinedPath = [];
|
|
41
|
+
const tryLeg = (index, previousOut) => {
|
|
42
|
+
if (index === legs.length)
|
|
43
|
+
return true;
|
|
44
|
+
for (const exchange of legs[index]) {
|
|
45
|
+
const hops = exchange.data.path;
|
|
46
|
+
if (!Array.isArray(hops) || hops.length === 0)
|
|
47
|
+
continue;
|
|
48
|
+
if (typeof hops[0]?.tokenIn !== 'string' || !hops[0]?.pool?.key) {
|
|
49
|
+
throw new Error('Unexpected V4 path structure');
|
|
50
|
+
}
|
|
51
|
+
if (previousOut !== null &&
|
|
52
|
+
!compareAddresses(hops[0].tokenIn, previousOut)) {
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
combinedPath.push(...hops.map(toV4PathHop));
|
|
56
|
+
if (tryLeg(index + 1, hops[hops.length - 1].tokenOut))
|
|
57
|
+
return true;
|
|
58
|
+
combinedPath.length -= hops.length;
|
|
59
|
+
}
|
|
60
|
+
return false;
|
|
61
|
+
};
|
|
62
|
+
if (!tryLeg(0, null)) {
|
|
63
|
+
throw new Error('Unexpected V4 path structure');
|
|
64
|
+
}
|
|
65
|
+
const first = combinedPath[0];
|
|
66
|
+
const last = combinedPath[combinedPath.length - 1];
|
|
67
|
+
if (!compareAddresses(first.tokenIn, response.priceRoute.srcToken) ||
|
|
68
|
+
!compareAddresses(last.tokenOut, response.priceRoute.destToken)) {
|
|
69
|
+
throw new Error('Unexpected V4 path structure');
|
|
70
|
+
}
|
|
71
|
+
return { type: 'v4', path: combinedPath, hops: combinedPath.length };
|
|
72
|
+
}
|
|
73
|
+
const pathCache = new Map();
|
|
74
|
+
export async function getPath({ chainId, dex, tokenIn, tokenOut, srcDecimals, destDecimals, vault, }, endpoint = VELORA_ENDPOINT) {
|
|
75
|
+
const cacheKey = `${chainId}:${dex}:${tokenIn}:${tokenOut}`;
|
|
76
|
+
const cache = pathCache.get(cacheKey);
|
|
77
|
+
const ttl = cache?.path
|
|
78
|
+
? VELORA_PATH_CACHE_TTL
|
|
79
|
+
: VELORA_NEGATIVE_CACHE_TTL;
|
|
80
|
+
const cacheExpired = cache && Date.now() - cache.timestamp > ttl;
|
|
81
|
+
if (cache && !cacheExpired)
|
|
82
|
+
return cache.path;
|
|
83
|
+
const url = new URL(endpoint);
|
|
84
|
+
url.searchParams.set('network', String(chainId));
|
|
85
|
+
url.searchParams.set('userAddress', vault);
|
|
86
|
+
url.searchParams.set('srcToken', tokenIn);
|
|
87
|
+
url.searchParams.set('srcDecimals', srcDecimals.toString());
|
|
88
|
+
url.searchParams.set('destToken', tokenOut);
|
|
89
|
+
url.searchParams.set('destDecimals', destDecimals.toString());
|
|
90
|
+
url.searchParams.set('amount', (10 ** srcDecimals).toString());
|
|
91
|
+
url.searchParams.set('side', 'SELL');
|
|
92
|
+
url.searchParams.set('slippage', '100');
|
|
93
|
+
url.searchParams.set('includeDEXS', dex);
|
|
94
|
+
const version = VELORA_VERSION_BY_DEX[dex];
|
|
95
|
+
if (version)
|
|
96
|
+
url.searchParams.set('version', version);
|
|
97
|
+
let response = await fetch(url.toString());
|
|
98
|
+
if (!response.ok && (response.status === 429 || response.status >= 500)) {
|
|
99
|
+
await new Promise((r) => setTimeout(r, 300));
|
|
100
|
+
response = await fetch(url.toString());
|
|
101
|
+
}
|
|
102
|
+
if (!response.ok) {
|
|
103
|
+
pathCache.set(cacheKey, { path: false, timestamp: Date.now() });
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
const veloraResponse = (await response.json());
|
|
107
|
+
const extractedPath = extractPathFromResponse(dex, veloraResponse);
|
|
108
|
+
pathCache.set(cacheKey, {
|
|
109
|
+
path: extractedPath,
|
|
110
|
+
timestamp: Date.now(),
|
|
111
|
+
});
|
|
112
|
+
return extractedPath;
|
|
113
|
+
}
|
|
114
|
+
export function _clearPathCache() {
|
|
115
|
+
pathCache.clear();
|
|
116
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { BytesLike, type Provider } from 'ethers';
|
|
2
|
+
import { type GuruProtocolAddresses, type GuruProtocolChainId } from '../addresses';
|
|
3
|
+
import type { SwapAeroV2Struct } from '../typechain/out/AerodromeV2Adapter';
|
|
4
|
+
import type { SwapV2Struct } from '../typechain/out/UniswapV2Adapter';
|
|
5
|
+
import type { SwapV3Struct } from '../typechain/out/UniswapV3Adapter';
|
|
6
|
+
import type { PrefixTx, SwapSimulator } from './simulation';
|
|
7
|
+
export declare const SwapType: Readonly<{
|
|
8
|
+
EXACT_INPUT: 0n;
|
|
9
|
+
EXACT_OUTPUT: 1n;
|
|
10
|
+
}>;
|
|
11
|
+
export type SwapType = (typeof SwapType)[keyof typeof SwapType];
|
|
12
|
+
export type FeeTier = 0 | 1 | 50 | 100 | 200 | 500 | 2500 | 3000 | 10000;
|
|
13
|
+
export type AeroRoute = {
|
|
14
|
+
from: string;
|
|
15
|
+
to: string;
|
|
16
|
+
stable: boolean;
|
|
17
|
+
factory: string;
|
|
18
|
+
};
|
|
19
|
+
type V2DexData = {
|
|
20
|
+
type: 'v2';
|
|
21
|
+
router: string;
|
|
22
|
+
kind: 'uniswap' | 'aerodrome';
|
|
23
|
+
swappable: boolean;
|
|
24
|
+
};
|
|
25
|
+
type V3DexData = {
|
|
26
|
+
type: 'v3';
|
|
27
|
+
router?: string;
|
|
28
|
+
quoter: string;
|
|
29
|
+
feeTiers: number[];
|
|
30
|
+
kind: 'uniswap' | 'aerodrome';
|
|
31
|
+
swappable: boolean;
|
|
32
|
+
};
|
|
33
|
+
type DexData = V2DexData | V3DexData;
|
|
34
|
+
export type Pool = {
|
|
35
|
+
address: string;
|
|
36
|
+
feeTier: FeeTier;
|
|
37
|
+
exchangeFactory: string;
|
|
38
|
+
wethBalance: bigint;
|
|
39
|
+
};
|
|
40
|
+
type Quote = {
|
|
41
|
+
feeTier: FeeTier;
|
|
42
|
+
amount: bigint;
|
|
43
|
+
swapFee: bigint;
|
|
44
|
+
router: string;
|
|
45
|
+
exchangeFactory: string;
|
|
46
|
+
poolAddress?: string;
|
|
47
|
+
tickSpacing?: bigint;
|
|
48
|
+
};
|
|
49
|
+
export type QuoteRequest = {
|
|
50
|
+
swapType?: SwapType;
|
|
51
|
+
tokenAmount: bigint;
|
|
52
|
+
slippage?: bigint;
|
|
53
|
+
path: [string, string];
|
|
54
|
+
requireSwappable?: boolean;
|
|
55
|
+
};
|
|
56
|
+
type VersionSpecificQuoteRequest = Omit<QuoteRequest, 'path' | 'slippage'> & {
|
|
57
|
+
exchangeFactory: string;
|
|
58
|
+
feeTier: FeeTier;
|
|
59
|
+
path: [string, string];
|
|
60
|
+
slippage: bigint;
|
|
61
|
+
poolAddress?: string;
|
|
62
|
+
};
|
|
63
|
+
export type StableQuoteRequest = {
|
|
64
|
+
path: [string, string, string];
|
|
65
|
+
inputAmount: bigint;
|
|
66
|
+
slippage: bigint;
|
|
67
|
+
exchangeFactory: string;
|
|
68
|
+
finalization?: PoolRouteFinalizationContext;
|
|
69
|
+
};
|
|
70
|
+
export type StableQuoteResult = {
|
|
71
|
+
adapter: string;
|
|
72
|
+
data: SwapV2Struct | SwapV3Struct | SwapAeroV2Struct;
|
|
73
|
+
callData: BytesLike;
|
|
74
|
+
toll: {
|
|
75
|
+
currency: string;
|
|
76
|
+
amount: bigint;
|
|
77
|
+
};
|
|
78
|
+
effectiveSlippageBps?: string;
|
|
79
|
+
};
|
|
80
|
+
export interface PoolRouteFinalizationContext {
|
|
81
|
+
blockNumber: number;
|
|
82
|
+
controller: string;
|
|
83
|
+
vault: string;
|
|
84
|
+
account: string;
|
|
85
|
+
simulator: SwapSimulator;
|
|
86
|
+
prefixTxs?: PrefixTx[];
|
|
87
|
+
maxSlippageE3?: bigint;
|
|
88
|
+
}
|
|
89
|
+
export default class PoolHelper {
|
|
90
|
+
readonly chainId: GuruProtocolChainId;
|
|
91
|
+
readonly addresses: GuruProtocolAddresses;
|
|
92
|
+
protected readonly provider: Provider;
|
|
93
|
+
private readonly getSwapFeePercentage;
|
|
94
|
+
private readonly dexTable;
|
|
95
|
+
private readonly poolsCache;
|
|
96
|
+
constructor(config: {
|
|
97
|
+
chainId: number;
|
|
98
|
+
provider: Provider;
|
|
99
|
+
getSwapFeePercentage: () => Promise<bigint>;
|
|
100
|
+
});
|
|
101
|
+
private _finalizeExecutableQuote;
|
|
102
|
+
getDexData(exchangeFactory: string): DexData;
|
|
103
|
+
isAerodrome(exchangeFactory: string): boolean;
|
|
104
|
+
getPoolFeeTier(poolAddress: string): Promise<FeeTier>;
|
|
105
|
+
private _getPoolsFromOnChainQuery;
|
|
106
|
+
getUniswapCompatibleTokenPools(token: string, options?: {
|
|
107
|
+
type?: 'v2' | 'v3';
|
|
108
|
+
exchangeFactory?: string;
|
|
109
|
+
swappableOnly?: boolean;
|
|
110
|
+
}): Promise<Pool[]>;
|
|
111
|
+
getUniswapCompatibleTokenPool(token: string, options?: {
|
|
112
|
+
type?: 'v2' | 'v3';
|
|
113
|
+
exchangeFactory?: string;
|
|
114
|
+
swappableOnly?: boolean;
|
|
115
|
+
}): Promise<Pool>;
|
|
116
|
+
getBestQuote({ swapType, tokenAmount, slippage, path, requireSwappable, }: QuoteRequest): Promise<Quote>;
|
|
117
|
+
getV2Quote({ swapType, tokenAmount, exchangeFactory, path, feeTier, slippage, }: VersionSpecificQuoteRequest): Promise<Quote>;
|
|
118
|
+
getV3Quote({ swapType, tokenAmount, exchangeFactory, path, feeTier, slippage, poolAddress, }: VersionSpecificQuoteRequest): Promise<Quote>;
|
|
119
|
+
getStableForTokenQuote({ path, inputAmount, slippage, exchangeFactory, finalization, }: StableQuoteRequest): Promise<StableQuoteResult>;
|
|
120
|
+
private _quoteV3MultiHop;
|
|
121
|
+
getTokensForStableQuote({ path, inputAmount, slippage, exchangeFactory, finalization, }: StableQuoteRequest): Promise<StableQuoteResult>;
|
|
122
|
+
getLotusAdapter(exchangeFactory: string): string;
|
|
123
|
+
private _adjustTokenAmountForSwapFee;
|
|
124
|
+
private _adjustQuoteForSwapFeeAndSlippage;
|
|
125
|
+
}
|
|
126
|
+
export {};
|