Tadle

Tadle
DeFiFoundry
27,750 USDC
View results
Submission Details
Severity: low
Valid

Market Makers via relisting protected offers cannot set their Maker Bonus

Summary

Based on information provided by the docs here, the Makers receiver bonuses for providing liquidity. However making a protected offer via PreMarkets::listOffer is missing this functionality because there's no way for the maker to specify their maker bonus

Vulnerability Details

As mentioned in the docs here, a Maker receives rewards(maker bonuses) for providing liquidity/collateral to the market. Makers are also allowed to dynamically set the percentage of fees they want to earn.

Also important to note here is that for protected offers each subsequent re-listing creates a new Maker as seen by the docs here(on Transaction #3) Bob is now a Maker.

However the PreMarkets::listOffer does not include this functionality for protected offers and as seen in the code here, the trade tax(which is the maker bonus) is set to 0.

Impact

MEDIUM - Market Makers via relisting protected offers cannot set their maker bonus

Tools Used

Manual Review

Recommendations

createTaker and listOffer should be modified as shown below

function listOffer(
address _stock,
uint256 _amount,
uint256 _collateralRate,
+ uint256 _tradeTax
) external payable {
//...ommited function body for brevity as it is irrelevant
/// @dev change abort offer status when offer settle type is turbo
if (makerInfo.offerSettleType == OfferSettleType.Turbo) {
address originOffer = makerInfo.originOffer;
OfferInfo memory originOfferInfo = offerInfoMap[originOffer];
if (_collateralRate != originOfferInfo.collateralRate) {
revert InvalidCollateralRate();
}
originOfferInfo.abortOfferStatus = AbortOfferStatus.SubOfferListed;
}
/// @dev transfer collateral when offer settle type is protected
if (makerInfo.offerSettleType == OfferSettleType.Protected) {
+ if (_tradeTax > Constants.EACH_TRADE_TAX_DECIMAL_SCALER) {
+ revert InvalidEachTradeTaxRate();
+ }
uint256 transferAmount = OfferLibraries.getDepositAmount(
offerInfo.offerType,
offerInfo.collateralRate,
_amount,
true,
Math.Rounding.Ceil
);
ITokenManager tokenManager = tadleFactory.getTokenManager();
tokenManager.tillIn{value: msg.value}(
_msgSender(),
makerInfo.tokenAddress,
transferAmount,
false
);
}
address offerAddr = GenerateAddress.generateOfferAddress(stockInfo.id);
if (offerInfoMap[offerAddr].authority != address(0x0)) {
revert OfferAlreadyExist();
}
/// @dev update offer info
offerInfoMap[offerAddr] = OfferInfo({
id: stockInfo.id,
authority: _msgSender(),
maker: offerInfo.maker,
offerStatus: OfferStatus.Virgin,
offerType: offerInfo.offerType,
abortOfferStatus: AbortOfferStatus.Initialized,
points: stockInfo.points,
amount: _amount,
collateralRate: _collateralRate,
usedPoints: 0,
- tradeTax: 0,
+ tradeTax: makerInfo.offerSettleType == OfferSettleType.Turbo ? 0 : _tradeTax,
settledPoints: 0,
settledPointTokenAmount: 0,
settledCollateralAmount: 0
});
stockInfo.offer = offerAddr;
emit ListOffer(
offerAddr,
_stock,
_msgSender(),
stockInfo.points,
_amount
);
}
function createTaker(address _offer, uint256 _points) external payable {
// ...ommiteed function body for brevity
/// @dev Transfer token from user to capital pool as collateral
uint256 depositAmount = _points.mulDiv(
offerInfo.amount,
offerInfo.points,
Math.Rounding.Ceil
);
uint256 platformFee = depositAmount.mulDiv(
platformFeeRate,
Constants.PLATFORM_FEE_DECIMAL_SCALER
);
uint256 tradeTax = depositAmount.mulDiv(
- makerInfo.eachTradeTax,
+ makerInfo.offerSettleType == OfferSettleType.Turbo ? makerInfo.eachTradeTax : offerInfo.tradeTax,
Constants.EACH_TRADE_TAX_DECIMAL_SCALER
);
//...ommited remaining function body as it is irrelevant
}
Updates

Lead Judging Commences

0xnevi Lead Judge
about 1 year ago
0xnevi Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Appeal created

honour Submitter
about 1 year ago
honour Submitter
about 1 year ago
honour Submitter
about 1 year ago
0xnevi Lead Judge
12 months ago
0xnevi Lead Judge 12 months ago
Submission Judgement Published
Validated
Assigned finding tags:

finding-PreMarkets-listOffer-lack-custom-tradeTax

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.