mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-22 21:59:44 +03:00
fix: fix bug with curve calldata generation while in crossfactory
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@orionprotocol/sdk",
|
"name": "@orionprotocol/sdk",
|
||||||
"version": "0.20.25",
|
"version": "0.20.25-rc0",
|
||||||
"description": "Orion Protocol SDK",
|
"description": "Orion Protocol SDK",
|
||||||
"main": "./lib/index.cjs",
|
"main": "./lib/index.cjs",
|
||||||
"module": "./lib/index.js",
|
"module": "./lib/index.js",
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import {
|
|||||||
ERC20__factory,
|
ERC20__factory,
|
||||||
} from "@orionprotocol/contracts/lib/ethers-v6/index.js";
|
} from "@orionprotocol/contracts/lib/ethers-v6/index.js";
|
||||||
import { MaxUint256, type BigNumberish, type JsonRpcProvider } from "ethers";
|
import { MaxUint256, type BigNumberish, type JsonRpcProvider } from "ethers";
|
||||||
import { addCallParams } from "./utils.js";
|
import { addCallParams, pathCallWithBalance } from "./utils.js";
|
||||||
import type { SingleSwap } from "../../../types.js";
|
import type { SingleSwap } from "../../../types.js";
|
||||||
import { generateApproveCall } from "./erc20.js";
|
import { generateApproveCall } from "./erc20.js";
|
||||||
import type { BytesLike } from "ethers";
|
import type { BytesLike } from "ethers";
|
||||||
@@ -15,7 +15,8 @@ export async function generateCurveStableSwapCall(
|
|||||||
swap: SingleSwap,
|
swap: SingleSwap,
|
||||||
provider: JsonRpcProvider,
|
provider: JsonRpcProvider,
|
||||||
swapExecutorContractAddress: string,
|
swapExecutorContractAddress: string,
|
||||||
curveRegistry: string
|
curveRegistry: string,
|
||||||
|
pathWithBalance = false
|
||||||
) {
|
) {
|
||||||
const executorInterface = SwapExecutor__factory.createInterface();
|
const executorInterface = SwapExecutor__factory.createInterface();
|
||||||
const registry = CurveRegistry__factory.connect(curveRegistry, provider);
|
const registry = CurveRegistry__factory.connect(curveRegistry, provider);
|
||||||
@@ -38,7 +39,11 @@ export async function generateCurveStableSwapCall(
|
|||||||
"curveSwapStableAmountIn",
|
"curveSwapStableAmountIn",
|
||||||
[pool, assetOut, i, j, to, amount]
|
[pool, assetOut, i, j, to, amount]
|
||||||
);
|
);
|
||||||
calls.push(addCallParams(calldata))
|
calldata = addCallParams(calldata)
|
||||||
|
if (pathWithBalance) {
|
||||||
|
calldata = pathCallWithBalance(calldata, swap.assetIn)
|
||||||
|
}
|
||||||
|
calls.push(calldata)
|
||||||
|
|
||||||
return calls
|
return calls
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -251,13 +251,14 @@ async function processMultiFactorySwaps(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'Curve': {
|
case 'Curve': {
|
||||||
const curveCalls = await generateCurveStableSwapCall(
|
let curveCalls = await generateCurveStableSwapCall(
|
||||||
amount,
|
amount,
|
||||||
swapExecutorContractAddress,
|
swapExecutorContractAddress,
|
||||||
swap,
|
swap,
|
||||||
provider,
|
provider,
|
||||||
swapExecutorContractAddress,
|
swapExecutorContractAddress,
|
||||||
curveRegistryAddress
|
curveRegistryAddress,
|
||||||
|
true
|
||||||
);
|
);
|
||||||
calls.push(...curveCalls);
|
calls.push(...curveCalls);
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user