Fix issues and add new features#24
Conversation
…deployment scripts
…e deployment scripts and tests
… via accessmanger)
…d update factories to utilize access manager roles
🛡️ Immunefi PR ReviewsWe’ve assigned 1 code reviewer(s) to this PR. They’ll begin the review shortly and leave feedback directly in the pull request. This review is based on the current state of your pull request. If you make changes after the review starts, they won’t be reflected here. To ensure the review includes your latest updates, you’ll need to open a new pull request. |
…p permission consistency issues in gt implementation
There was a problem hiding this comment.
PR reviewed. The bug fixes are well implemented and all code changes appear solid overall. Whitelisting is consistently enforced across all external (user-facing) entry points, with no bypass paths. The front-running/collision risks are also adequately mitigated. No security issues were Found. Only A single gas optimization finding was noted. Details here:
https://docs.google.com/document/d/14l__KYbhqiSwjLqsuMh7w7oV5FiwwhscxLdYUpaxtgw/edit?tab=t.vcy0ihj9qhug
- abdul_rehman
Changelog
TermMaxOrderV2
maturitywith configurableorderExpiryTimestamp, allowing order makers to set custom expiry before market maturitysetExpiryTimestamp()for owner to update order expirytreasurerandmaturityduring swaps, reducing redundant cross-contract calls_daysToMaturity()to read maturity from transient cache with fallback to market configTermMaxMarketV2
OrderInitialParamsinstead of partial fields (maker,pool,swapTrigger)_initalizeOrder()— only defaults to market maturity whenparams.maturity == 0Access Control
RolescontractWithAccessManagerRoleabstract contract for delegating role checks to AccessManager via immutable referenceWithWhitelistCheckabstract contract for immutable whitelist verificationWhitelistManager.batchSetWhitelistpermission changed fromonlyOwnertohasRole(WHITELIST_ROLE)STABLE_ERC4626_BUFFER_ROLEandSTABLE_ERC4626_INCOME_WITHDRAW_ROLEto AccessManagerV2updateBufferConfigAndAddReserves()andwithdrawIncomeAssets()to AccessManagerV2TermMaxRouterV2
whitelistManagerto immutableWithWhitelistCheckonlyWhitelisted(address(market))modifier to all user-facing functions (leverage,borrowTokenFromCollateralAndXt,flashRepayFromCollateral,flashRepayToGetCollateral,rolloverGt,swapAndRepay)_checkWhitelisted(address(market))inside rollover callback for decoded market addressrolloverGtandswapAndRepaynow takeITermMaxMarketinstead ofIGearingTokenas parameter, deriving GT from marketFlashRepayOptions.ROLLOVERbranch inside theelseblock that reads/clearsT_CALLERTermMaxVaultV2
WithWhitelistCheckfor market and pool whitelist verificationsubmitMarket()validates market against whitelist before submissionsubmitPool()validates pool against whitelist; setting pool toaddress(0)bypasses timelockacceptMarket()re-validates market whitelist at acceptance time_setPool()validates pool whitelist before activationTermMax4626Factory
mapping(bytes32 => address)withsetImplementation()/getImplementations()WithAccessManagerRoleandWithWhitelistCheckStableERC4626ForVenusandStableERC4626ForCustomizepool typescreateTermMax4626()for deploying pools by string key_registerAddress()TermMaxFactoryV2 / TermMaxVaultFactoryV2
WithAccessManagerRoleandWithWhitelistCheckonlyOwnerwith role-based access (MARKET_ROLE,VAULT_DEPLOYER_ROLE,TERMMAX_MARKET_FACTORY_ROLE)