Omniscia vfat Audit
RamsesGaugeConnector Code Style Findings
RamsesGaugeConnector Code Style Findings
RGC-01C: Redundant Code Duplication
Type | Severity | Location |
---|---|---|
Gas Optimization | ![]() | RamsesGaugeConnector.sol:L15-L23, L33-L43 |
Description:
The RamsesGaugeConnector
implementation is identical to the VelodromeGaugeConnector
with the main difference being the RamsesGaugeConnector::claim
and RamsesGaugeConnector::deposit
functions; the former containing an additional IRamsesGauge::claimFees
call and the latter containing a new argument to the IRamsesGauge::deposit
call.
Example:
15function deposit(16 Farm calldata farm,17 address token,18 bytes memory // _extraData19) external payable override {20 uint256 amount = IERC20(token).balanceOf(address(this));21 SafeTransferLib.safeApprove(token, farm.stakingContract, amount);22 IRamsesGauge(farm.stakingContract).deposit(amount, 0);23}24
25function withdraw(26 Farm calldata farm,27 uint256 amount,28 bytes memory // _extraData29) external override {30 IRamsesGauge(farm.stakingContract).withdraw(amount);31}32
33function claim(34 Farm calldata farm,35 bytes memory _extraData36) external override {37 RamsesClaimExtraData memory extraData =38 abi.decode(_extraData, (RamsesClaimExtraData));39 IRamsesGauge(farm.stakingContract).claimFees();40 IRamsesGauge(farm.stakingContract).getReward(41 address(this), extraData.rewardTokens42 );43}
Recommendation:
We advise the contract to inherit from the VelodromeGaugeConnector
and to override
the VelodromeGaugeConnector::claim
and VelodromeGaugeConnector::deposit
functions; in the former case by invoking the superlative function (i.e. super.claim(farm, _extraData)
) and then proceeding with the additional INuriGauge::claimFees
call whilst in the latter by re-implementing the deposit flow.
Alleviation (6ab7af3bb495b817ffec469255ea679b1813eecb):
The vfat team evaluated the level of duplication outlined by this exhibit and opted to retain it as they consider it to be acceptable so as to avoid requiring to move through several dependencies to deduce how a contract operates.