Skip to content

Commit

Permalink
feat: add v6 selectors
Browse files Browse the repository at this point in the history
  • Loading branch information
KanievskyiDanylo committed Oct 16, 2024
1 parent 521b4d9 commit 7130dd7
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
12 changes: 11 additions & 1 deletion packages/contract-helpers/src/commons/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit 7130dd7

Please sign in to comment.