Axis-Fi / axis-core

Axis Protocol
https://axis.finance
Other
6 stars 1 forks source link

The getPartialFill function can return the partial fill state when the auction is concluded, rather than settled #202

Closed etherSky111 closed 3 months ago

etherSky111 commented 4 months ago

At this point, the getPartialFill function reverts when the auction is not settled, as in the EMP.

function getPartialFill(uint96 lotId_)
    external
    view
    returns (bool hasPartialFill, PartialFill memory partialFill)
{
    _revertIfLotInvalid(lotId_);
    _revertIfLotNotSettled(lotId_);  // here

    partialFill = _lotPartialFill[lotId_];
    hasPartialFill = partialFill.bidId != 0;

    return (hasPartialFill, partialFill);
}

However, in EMP, the partial fill state was determined when the auction is settled, while in FPB, the partial fill state can be determined when the total capacity is covered by bids.

function _bid(
    uint96 lotId_,
    address bidder_,
    address referrer_,
    uint256 amount_,
    bytes calldata
) internal override returns (uint64) {
    data.totalBidAmount += amount_;
   uint256 baseScale = 10 ** lotData[lotId_].baseTokenDecimals;
    uint256 newFilledCapacity = Math.fullMulDiv(data.totalBidAmount, baseScale, data.price);
    if (newFilledCapacity < lotCapacity) {
        return bidId;
    }

    if (newFilledCapacity > lotCapacity) {
        _lotPartialFill[lotId_] = _calculatePartialFill(
            bidId, lotCapacity, newFilledCapacity, amount96, baseScale, data.price
        );

        data.totalBidAmount -= _lotPartialFill[lotId_].refund;
    }

    lotData[lotId_].conclusion = uint48(block.timestamp);

    return bidId;
}

Anyway, this is a minor issue.