diff --git a/packages/contract-helpers/src/commons/utils.ts b/packages/contract-helpers/src/commons/utils.ts index 04c16bba..7355195d 100644 --- a/packages/contract-helpers/src/commons/utils.ts +++ b/packages/contract-helpers/src/commons/utils.ts @@ -207,8 +207,18 @@ export const augustusToAmountOffsetFromCalldata = ( case '0xb66bcbac': // Augustus V5 buy (old) case '0x35326910': // Augustus V5 buy return 164; // 4 + 5 * 32 - case '0x87a63926': // directUniV3Buy + case '0x87a63926': // Augustus V5 directUniV3Buy return 68; // 4 + 2 * 32 + case '0x7f457675': // Augustus V6 swapExactAmountOut + return 132; // 4 + 4 * 32 + case '0xd6ed22e6': // Augustus V6 swapExactAmountOutOnBalancerV2 + return 36; // 4 + 1 * 32 + case '0xa76f4eb6': // Augustus V6 swapExactAmountOutOnUniswapV2 + return 196; // 4 + 6 * 32 + case '0x5e94e28d': // Augustus V6 swapExactAmountOutOnUniswapV3 + return 196; // 4 + 6 * 32 + case '0x987e7d8e': // Augustus V6 swapExactAmountInOutOnMakerPSM + return 100; // 4 + 3 * 32 default: throw new Error('Unrecognized function selector for Augustus'); } diff --git a/packages/contract-helpers/src/paraswap-liquiditySwapAdapter-contract/index.ts b/packages/contract-helpers/src/paraswap-liquiditySwapAdapter-contract/index.ts index 60e4d120..7e792f48 100644 --- a/packages/contract-helpers/src/paraswap-liquiditySwapAdapter-contract/index.ts +++ b/packages/contract-helpers/src/paraswap-liquiditySwapAdapter-contract/index.ts @@ -40,15 +40,29 @@ export function augustusFromAmountOffsetFromCalldata(calldata: string): number { return 68; // 4 + 2 * 32 case '0x46c67b6d': // Augustus V5 megaSwap return 68; // 4 + 2 * 32 - case '0xb22f4db8': // directBalancerV2GivenInSwap + case '0xb22f4db8': // Augustus V5 directBalancerV2GivenInSwap return 68; // 4 + 2 * 32 - case '0x19fc5be0': // directBalancerV2GivenOutSwap + case '0x19fc5be0': // Augustus V5 directBalancerV2GivenOutSwap return 68; // 4 + 2 * 32 - case '0x3865bde6': // directCurveV1Swap + case '0x3865bde6': // Augustus V5 directCurveV1Swap return 68; // 4 + 2 * 32 - case '0x58f15100': // directCurveV2Swap + case '0x58f15100': // Augustus V5 directCurveV2Swap return 68; // 4 + 2 * 32 - case '0xa6866da9': // directUniV3Swap + case '0xa6866da9': // Augustus V5 directUniV3Swap + return 68; // 4 + 2 * 32 + case '0xe3ead59e': // Augustus V6 swapExactAmountIn + return 100; // 4 + 3 * 32 + case '0xd85ca173': // Augustus V6 swapExactAmountInOnBalancerV2 + return 4; // 4 + 0 * 32 + case '0x1a01c532': // Augustus V6 swapExactAmountInOnCurveV1 + return 132; // 4 + 4 * 32 + case '0xe37ed256': // Augustus V6 swapExactAmountInOnCurveV2 + return 196; // 4 + 6 * 32 + case '0xe8bb3b6c': // Augustus V6 swapExactAmountInOnUniswapV2 + return 164; // 4 + 4 * 32 + case '0x876a02f6': // Augustus V6 swapExactAmountInOnUniswapV3 + return 164; // 4 + 4 * 32 + case '0x987e7d8e': // Augustus V6 swapExactAmountInOutOnMakerPSM return 68; // 4 + 2 * 32 default: throw new Error('Unrecognized function selector for Augustus');