V2.1.1 — F-04 follow-up: multi-hop swap path#3
Merged
Conversation
V2.1.0 의 single-hop UniV3 swap 이 COMP / MORPHO 같은 reward 토큰의 direct
USDC pool 유동성 부족으로 mainnet revert 되는 issue 발견 (Compound fork
probe). prod 진입 전에 multi-hop path 지원으로 fix.
BaseStrategy._swapAndReinvest
(rewardToken, uint24 poolFee, amountIn, minOut)
→ (rewardToken, bytes calldata swapPath, amountIn, minOut)
내부: dexRouter.exactInputSingle → dexRouter.exactInput(path)
_validateSwapPath helper
- length 검사 (20 + N*23, ≥ 43)
- 첫 20 바이트 == rewardToken
- 마지막 20 바이트 == address(underlyingAsset) (= USDC)
→ 악의적 Keeper 의 endpoint 우회 차단
ISwapRouter
+ exactInput(ExactInputParams) — path bytes 형식 multi-hop
Errors
+ InvalidPath (V2.1.1)
5 strategy 시그니쳐 변경 (poolFee → swapPath)
AaveV3Strategy / CompoundV3Strategy / VenusStrategy
(bytes swapPath, uint256 minOut)
MorphoStrategy
(address rewardToken, uint256 claimable, bytes32[] proof,
bytes swapPath, uint256 minOut)
FluidStrategy
(uint256 cumulativeAmount, uint8 positionType, bytes32 positionId,
uint256 cycle, bytes32[] merkleProof, bytes metadata,
bytes swapPath, uint256 minOut)
mocks/MockRewardDistributors.sol
+ MockRewardToken / MockCometRewards / MockVenusComptroller /
MockAaveRewardsController / MockUniversalRewardsDistributor /
MockFluidMerkleDistributor / MockSwapRouter
Unit test distributor stand-in.
hardhat.config.ts
viaIR: false → true. FluidStrategy.claimAndCompound 의 deeper local-variable
count (swapPath 추가 + 6 distributor 인자) 에 stack-too-deep 회피.
V2.1.0 으로 배포된 vault 는 함수 시그니쳐 변경으로 호출 불가 → 폐기.
v2.1.1 새 배포 사이클 별도.
Refs: Soken APY-2026-06-001 §F-04 follow-up
…04 evidence
Strategy.claim.fork.spec.ts (Ethereum fork)
- test_compound_claimAndCompound_revertsWhenNotKeeper
- test_compound_claimAndCompound_zeroBeforeYieldAccrues
- test_compound_claimAndCompound_claimsSwapsAndReinvests
multi-hop COMP → WETH → USDC (UniV3 SwapRouter02) e2e.
Fresh-fork distributor 가 dry 인 경우 whale 으로 top-up.
Strategy.claim.spec.ts (mock distributor unit)
Compound (3 — claim, NotKeeper, InvalidPath)
Venus (2)
Aave (2)
Morpho (2 — mock URD)
Fluid (2 — mock distributor with msg.sender check)
Strategy.claim.bsc.fork.spec.ts (skipped on chain mismatch)
hardhat 의 chain-56 hardfork-history 매칭 issue 로 BSC fork 미사용.
Compound real fork 가 BaseStrategy._swapAndReinvest 의 multi-hop path 를
공유 검증 + 4 mock 이 distributor 호출 path 검증.
Test
npx hardhat test # 103 passing
FORK=true npx hardhat test test/v2/Strategy.claim.fork.spec.ts # 3 passing
Refs: Soken APY-2026-06-001 §F-04 follow-up evidence
V2.1.0 의 F-04 fix 가 single-hop UniV3 swap (exactInputSingle) 만 지원해서
COMP / MORPHO 같은 reward 토큰의 direct USDC pool 유동성 부족으로 mainnet
revert 되는 issue 를 V2.1.1 multi-hop path 로 fix 한 follow-up 섹션 추가.
§F-04 아래 새 subsection: "F-04 follow-up — multi-hop swap path (V2.1.1)"
- rationale (mainnet probe 결과)
- 코드 변경 4 항목 (_swapAndReinvest 시그니쳐, _validateSwapPath, 5
strategy claimAndCompound, viaIR)
- test coverage (Compound real fork 3 + mock 11 = 14 cases)
- coverage rationale (BaseStrategy shared path → Compound 가 representative
e2e witness)
Refs: Soken APY-2026-06-001 §F-04 follow-up
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
V2.1.0 의 F-04 fix (reward claim + auto-compound) 가 single-hop UniV3 swap 만 지원해서 COMP / MORPHO 같은 reward 토큰의 direct USDC pool 유동성 부족으로 mainnet revert 되는 issue 를 V2.1.1 multi-hop path 지원으로 해결합니다.
Compound mainnet fork probe (2026-06-25) 에서 발견. prod 진입 전에 fix.
Commits
1efafbbfeat(v2.1.1): contracts — multi-hop swap path21736a7docs(v2.1.1): SOKEN_AUDIT.md F-04 follow-upKey changes
BaseStrategy._swapAndReinvest시그니쳐:(rewardToken, uint24 poolFee, ...)→(rewardToken, bytes calldata swapPath, ...). UniV3exactInput(path)호출._validateSwapPathhelper: path 의 length / endpoint 강제 (rewardToken → USDC).Errors.InvalidPath추가.claimAndCompound시그니쳐 변경.hardhat.config.tsviaIR: true(FluidStrategy stack 회피).Test plan
npx hardhat compile— 47 files OKnpx hardhat test— 103 passing (10 신규: 11 mock + 3 fork-pending without FORK)FORK=true npx hardhat test test/v2/Strategy.claim.fork.spec.ts— 3 passingdocs/SOKEN_AUDIT.mdF-04 follow-up subsection 검토After merge
v2.1.1tag + release