Skip to content

Merge audited changes#26

Merged
EvanWang-TKSpring merged 23 commits into
mainfrom
dev
Apr 14, 2026
Merged

Merge audited changes#26
EvanWang-TKSpring merged 23 commits into
mainfrom
dev

Conversation

@EvanWang-TKSpring
Copy link
Copy Markdown
Collaborator

No description provided.

…d update factories to utilize access manager roles
…p permission consistency issues in gt implementation
Changelog
TermMaxOrderV2
Replace fixed maturity with configurable orderExpiryTimestamp, allowing order makers to set custom expiry before market maturity
Add setExpiryTimestamp() for owner to update order expiry
Introduce transient storage (EIP-1153) to cache treasurer and maturity during swaps, reducing redundant cross-contract calls
Refactor _daysToMaturity() to read maturity from transient cache with fallback to market config
TermMaxMarketV2
Fix front-running vulnerability: deterministic clone salt now includes full OrderInitialParams instead of partial fields (maker, pool, swapTrigger)
Allow custom maturity in _initalizeOrder() — only defaults to market maturity when params.maturity == 0
Access Control
Extract role constants into centralized Roles contract
Add WithAccessManagerRole abstract contract for delegating role checks to AccessManager via immutable reference
Add WithWhitelistCheck abstract contract for immutable whitelist verification
WhitelistManager.batchSetWhitelist permission changed from onlyOwner to hasRole(WHITELIST_ROLE)
Add STABLE_ERC4626_BUFFER_ROLE and STABLE_ERC4626_INCOME_WITHDRAW_ROLE to AccessManagerV2
Add updateBufferConfigAndAddReserves() and withdrawIncomeAssets() to AccessManagerV2
TermMaxRouterV2
Migrate whitelist check from storage-based whitelistManager to immutable WithWhitelistCheck
Add onlyWhitelisted(address(market)) modifier to all user-facing functions (leverage, borrowTokenFromCollateralAndXt, flashRepayFromCollateral, flashRepayToGetCollateral, rolloverGt, swapAndRepay)
Add inline _checkWhitelisted(address(market)) inside rollover callback for decoded market address
rolloverGt and swapAndRepay now take ITermMaxMarket instead of IGearingToken as parameter, deriving GT from market
Move FlashRepayOptions.ROLLOVER branch inside the else block that reads/clears T_CALLER
TermMaxVaultV2
Add WithWhitelistCheck for market and pool whitelist verification
submitMarket() validates market against whitelist before submission
submitPool() validates pool against whitelist; setting pool to address(0) bypasses timelock
acceptMarket() re-validates market whitelist at acceptance time
_setPool() validates pool whitelist before activation
TermMax4626Factory
Refactor from immutable implementation addresses to dynamic mapping(bytes32 => address) with setImplementation() / getImplementations()
Add WithAccessManagerRole and WithWhitelistCheck
Add support for StableERC4626ForVenus and StableERC4626ForCustomize pool types
Add generic createTermMax4626() for deploying pools by string key
Auto-register created pools to whitelist via _registerAddress()
TermMaxFactoryV2 / TermMaxVaultFactoryV2
Add WithAccessManagerRole and WithWhitelistCheck
Replace onlyOwner with role-based access (MARKET_ROLE, VAULT_DEPLOYER_ROLE, TERMMAX_MARKET_FACTORY_ROLE)
Auto-register created markets/vaults to whitelist
@immunefi-magnus
Copy link
Copy Markdown

🛡️ Immunefi PR Reviews

We noticed that your project isn't set up for automatic code reviews. If you'd like this PR reviewed by the Immunefi team, you can request it manually using the link below:

🔗 Send this PR in for review

Once submitted, we'll take care of assigning a reviewer and follow up here.

@EvanWang-TKSpring EvanWang-TKSpring merged commit 64bd47b into main Apr 14, 2026
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant