Skip to main content

BALwithAllowlist

Git Source

Inherits: BaselineAxisLaunch

Allowlist version of the Baseline Axis Launch callback.

This version allows for a merkle tree to be used to determine which addresses are allowed to participate. However, the amount of quote tokens they can spend is not limited.

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;

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

NameTypeDescription
<none>uint96
<none>address
<none>address
<none>address
<none>uint256
<none>bool
allowlistData_bytesabi-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

NameTypeDescription
lotId_uint96
bidId_uint64
buyer_address
amount_uint256
callbackData_bytesabi-encoded data: (bytes32[]) representing the merkle proof

__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

NameTypeDescription
lotId_uint96The ID of the lot
bidId_uint64The ID of the bid
buyer_addressThe address of the buyer
amount_uint256The amount of quote tokens
callbackData_bytesThe callback data

_canParticipate

function _canParticipate(address buyer_, bytes calldata callbackData_) internal view;

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

NameTypeDescription
merkleRoot_bytes32The new merkle root

Events

MerkleRootSet

Emitted when the merkle root is set

event MerkleRootSet(bytes32 merkleRoot);

Errors

Callback_InvalidState

Error message when the callback state does not support the action

error Callback_InvalidState();