Skip to main content

CappedMerkleAllowlist

Git Source

Inherits: MerkleAllowlist

This contract extends the MerkleAllowlist contract to implement a merkle tree-based allowlist for buyers to participate in an auction. In this implementation, each buyer has a purchase limit that is set for all buyers in an auction lot.

State Variables

lotBuyerLimit

Stores the purchase limit for each lot

mapping(uint96 => uint256) public lotBuyerLimit;

lotBuyerSpent

Tracks the cumulative amount spent by a buyer on a lot

mapping(uint96 => mapping(address => uint256)) public lotBuyerSpent;

Functions

constructor

constructor(
address auctionHouse_,
Callbacks.Permissions memory permissions_
) MerkleAllowlist(auctionHouse_, permissions_);

_onCreate

function _onCreate(
uint96 lotId_,
address,
address,
address,
uint256,
bool,
bytes calldata callbackData_
) internal override;

Parameters

NameTypeDescription
lotId_uint96
<none>address
<none>address
<none>address
<none>uint256
<none>bool
callbackData_bytesabi-encoded data: (bytes32, uint256) representing the merkle root and buyer limit

__onPurchase

Additional implementation-specific logic for the purchase callback

This function can be overridden by an inheriting contract to implement additional logic

function __onPurchase(
uint96 lotId_,
address buyer_,
uint256 amount_,
uint256,
bool,
bytes calldata
) internal override;

Parameters

NameTypeDescription
lotId_uint96The id of the lot
buyer_addressThe address of the buyer
amount_uint256The amount of quote tokens sent
<none>uint256
<none>bool
<none>bytes

__onBid

Additional implementation-specific logic for the bid callback

This function can be overridden by an inheriting contract to implement additional logic

function __onBid(
uint96 lotId_,
uint64,
address buyer_,
uint256 amount_,
bytes calldata
) internal override;

_canBuy

function _canBuy(uint96 lotId_, address buyer_, uint256 amount_) internal;

Errors

Callback_ExceedsLimit

Error message when the bid amount exceeds the limit assigned to a buyer

error Callback_ExceedsLimit();