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: 19/72
Findings: 1
Award: $315.23
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: adriro
Also found by: 0xRobocop, 0xnacho, HHK, SpicyMeatball, max10afternoon, rbserver
315.2306 USDC - $315.23
If the amount of token returned by swapping is greater than by minting and the _minReturnedTokens
value is greater than 0, then the jbEthPaymentTerminal.pay
call always fails.
This behaviour can be observed by adding the following test to the existing suite:
function test_swapIfQuoteBetterMinReturnedTokens(uint256 _weight) public { // Reconfigure with a weight smaller than the quote, slippage included _weight = bound(_weight, 0, amountOutForOneEth - (amountOutForOneEth * 500 / 10000) - 1); _reconfigure(1, address(delegate), _weight, 5000); // Build the metadata using the quote at that block bytes memory _metadata = abi.encode( bytes32(0), bytes32(0), amountOutForOneEth, //quote 500 //slippage 500/10000 = 5% ); vm.expectRevert(); // Pay the project jbEthPaymentTerminal.pay{value: 1 ether}( 1, 1 ether, address(0), address(123), /* _minReturnedTokens */ // ---> any value greater than 0 1, /* _preferClaimedTokens */ true, /* _memo */ 'Take my money!', /* _delegateMetadata */ _metadata ); }
Error
#0 - c4-pre-sort
2023-05-25T13:06:51Z
dmvt marked the issue as duplicate of #36
#1 - c4-judge
2023-06-02T14:23:16Z
dmvt marked the issue as partial-50