Platform: Code4rena
Start Date: 18/05/2023
Pot Size: $24,500 USDC
Total HM: 3
Participants: 72
Period: 4 days
Judge: LSDan
Id: 237
League: ETH
Rank: 3/72
Findings: 1
Award: $2,242.15
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: ABA
Also found by: RaymondFam, ktg
2242.1524 USDC - $2,242.15
The contract JBXBuybackDelegate
is a data source and according to the doc: A data source contract can be used to provide custom data to the JBPayoutRedemptionPaymentTerminal3_1.pay(...) transaction and/or the JBPayoutRedemptionPaymentTerminal3_1.redeemTokensOf(...) transaction.
Since JBXBuybackDelegate
implements interface IJBFundingCycleDataSource
, it must override function redeemParams
and the contract decides to leave it empty:
function redeemParams(JBRedeemParamsData calldata _data) external override returns (uint256 reclaimAmount, string memory memo, JBRedemptionDelegateAllocation[] memory delegateAllocations) {}
Because the function is empty, if JBXBuybackDelegate
is used as datasource for redeem, users would not be able to redeem their tokens, since the returned reclaimAmount
from redeemParams
is always 0.
Although this contract JBXBuybackDelegate
is meant to be used for pay only and not for redeem, the contract should also let function redeemParams return default value (to not interfere with redeem process) so that if a user use JBXBuybackDelegate
as datasource for redeem (it's perfectly possible since this contract implements IJBFundingCycleDataSource
interface), the contract would not make reclaimedAmount = 0
, as recommended in the doc: https://docs.juicebox.money/dev/build/treasury-extensions/data-source/#examples
// This is unused but needs to be included to fulfill IJBFundingCycleDataSource. function redeemParams(JBRedeemParamsData calldata _data) external pure override returns ( uint256 reclaimAmount, string memory memo, IJBRedemptionDelegate delegate ) { // Return the default values. return (_data.reclaimAmount.value, _data.memo, IJBRedemptionDelegate(address(0))); }
I recommend returning default values from redeemParams
function as the code above.
Library
#0 - c4-pre-sort
2023-05-25T12:54:17Z
dmvt marked the issue as duplicate of #79
#1 - c4-judge
2023-06-02T15:10:25Z
dmvt marked the issue as satisfactory