BALwithAllocatedAllowlist
Inherits: BaselineAxisLaunch
Allocated allowlist version of the Baseline Axis Launch callback for batch auctions.
This version allows for each address in the Merkle tree to have a per-address amount of quote tokens they can spend.
The merkle tree is expected to have both an address and an amount of quote tokens they can spend in each leaf.
State Variables
merkleRoot
The root of the merkle tree that represents the allowlist
The merkle tree should adhere to the format specified in the OpenZeppelin MerkleProof library at https://github.com/OpenZeppelin/merkle-tree
In particular, leaf values (such as (address)
or (address,uint256)
) should be double-hashed.
bytes32 public merkleRoot;
buyerSpent
Tracks the cumulative amount spent by a buyer
mapping(address => uint256) public buyerSpent;
Functions
constructor
constructor(
address auctionHouse_,
address baselineKernel_,
address reserve_,
address owner_
) BaselineAxisLaunch(auctionHouse_, baselineKernel_, reserve_, owner_);
__onCreate
Override this function to implement allowlist functionality
This function reverts if:
allowlistData_
is not of the correct length
function __onCreate(
uint96,
address,
address,
address,
uint256,
bool,
bytes memory allowlistData_
) internal virtual override;
Parameters
Name | Type | Description |
---|---|---|
<none> | uint96 | |
<none> | address | |
<none> | address | |
<none> | address | |
<none> | uint256 | |
<none> | bool | |
allowlistData_ | bytes | abi-encoded data: (bytes32) representing the merkle root |
_onBid
No logic is needed for this function here, but it can be overridden by a lower-level contract to provide allowlist functionality
function _onBid(
uint96 lotId_,
uint64 bidId_,
address buyer_,
uint256 amount_,
bytes calldata callbackData_
) internal virtual override;
Parameters
Name | Type | Description |
---|---|---|
lotId_ | uint96 | |
bidId_ | uint64 | |
buyer_ | address | |
amount_ | uint256 | |
callbackData_ | bytes | abi-encoded data: (bytes32[], uint256) representing the merkle proof and allocated amount |
__onBid
Override this function to implement additional functionality for the onBid
callback
function __onBid(
uint96 lotId_,
uint64 bidId_,
address buyer_,
uint256 amount_,
bytes calldata callbackData_
) internal virtual;
Parameters
Name | Type | Description |
---|---|---|
lotId_ | uint96 | The ID of the lot |
bidId_ | uint64 | The ID of the bid |
buyer_ | address | The address of the buyer |
amount_ | uint256 | The amount of quote tokens |
callbackData_ | bytes | The callback data |
_canParticipate
The buyer must provide the proof and their total allocated amount in the callback data for this to succeed.
function _canParticipate(
address buyer_,
bytes calldata callbackData_
) internal view returns (uint256);
_canBuy
function _canBuy(address buyer_, uint256 amount_, uint256 allocatedAmount_) internal;
setMerkleRoot
Sets the merkle root for the allowlist
This function can be called by the owner to update the merkle root after onCreate()
.
This function performs the following:
- Performs validation
- Sets the merkle root
- Emits a MerkleRootSet event
This function reverts if:
- The caller is not the owner
- The auction has not been registered
- The auction has been completed
function setMerkleRoot(bytes32 merkleRoot_) external onlyOwner;
Parameters
Name | Type | Description |
---|---|---|
merkleRoot_ | bytes32 | The new merkle root |
Events
MerkleRootSet
Emitted when the merkle root is set
event MerkleRootSet(bytes32 merkleRoot);
Errors
Callback_ExceedsLimit
Error message when the bid amount exceeds the limit assigned to a buyer
error Callback_ExceedsLimit();
Callback_InvalidState
Error message when the callback state does not support the action
error Callback_InvalidState();