import type { AddressLike } from '@enzymefinance/ethers' ; import type { SignerWithAddress } from '@enzymefinance/hardhat' ; import type { ComptrollerLib , IntegrationManager , ParaSwapV4Adapter , ParaSwapV4Path , StandardToken , } from '@enzymefinance/protocol' ; import { callOnIntegrationArgs , IntegrationManagerActionId , paraSwapV4TakeOrderArgs , takeOrderSelector , } from '@enzymefinance/protocol' ; import type { BigNumberish } from 'ethers' ; import { utils } from 'ethers' ; export function paraSwapV4GenerateDummyPaths ( { toTokens } ) { return toTokens . map ( ( toToken ) => { return { routes : [ ] , to : toToken , totalNetworkFee : 0 , } ; } ) ; } export async function paraSwapV4TakeOrder ( { comptrollerProxy , integrationManager , fundOwner , paraSwapV4Adapter , outgoingAsset , outgoingAssetAmount = utils . parseEther ( '1' ) , minIncomingAssetAmount = 1 , expectedIncomingAssetAmount = minIncomingAssetAmount , paths , } ) { const takeOrderArgs = paraSwapV4TakeOrderArgs ( { expectedIncomingAssetAmount , minIncomingAssetAmount , outgoingAsset , outgoingAssetAmount , paths , } ) ; const callArgs = callOnIntegrationArgs ( { adapter : paraSwapV4Adapter , encodedCallArgs : takeOrderArgs , selector : takeOrderSelector , } ) ; return comptrollerProxy . connect ( fundOwner ) . callOnExtension ( integrationManager , IntegrationManagerActionId . CallOnIntegration , callArgs ) ; }