Curation
There are three elements to auction curation:
- The owner of the AuctionHouse sets a maximum curator fee for an auction module
- The curator sets their fee for an auction module
- Requires the maximum curator fee to be set
- The curator accepts a curation request for a lot
- Requires the curator's fee to be set
This guide will cover all three elements.
Maximum Curator Fee
The maximum curator fee sets a ceiling for the fee that all curators can set on a particular auction module (which corresponds to an auction format, such as Fixed Price Sale).
To set it, we first obtain the address of an AuctionHouse:
// Define the FeeManager (AuctionHouse)
IFeeManager auctionHouse = IFeeManager(_atomicAuctionHouse);
We then obtain the module keycode (e.g. FPS
) from an environment variable:
// Get the module keycode from the environment variable
bytes memory keycodeRaw = vm.envBytes("MODULE_KEYCODE");
Keycode keycode = toKeycode(bytes5(keycodeRaw));
The fee is also obtained from an environment variable:
// Get the fee from the environment variable
uint256 feeRaw = vm.envUint("FEE");
if (feeRaw > type(uint48).max) {
revert("Fee is greater than uint48 max");
}
uint48 fee = uint48(feeRaw);
For logging purposes, the current fee is printed:
// Get the curator max fee
(,, uint48 maxCuratorFee) = auctionHouse.getFees(keycode);
console2.log("Current max curator fee: {}", maxCuratorFee);
Lastly, the fee is set. This must be run as the owner of the AuctionHouse.
// Set the curator max fee
// Must be performed as the AuctionHouse owner
vm.prank(_OWNER);
auctionHouse.setFee(keycode, IFeeManager.FeeType.MaxCurator, fee);
console2.log("Set max curator fee to: {}", fee);
Curator Fee
Once the maximum curator fee has been set for an auction module, individual curators can set their fee for that auction module.
It is important to note that the curator fee is recorded at the time of auction creation. Thus, curators must set their auction fee prior to being listed as the curator for an auction lot.
For the curator to set their fee, we first obtain the address of the AuctionHouse:
// Define the FeeManager (AuctionHouse)
IFeeManager auctionHouse = IFeeManager(_atomicAuctionHouse);
We then obtain the module keycode (e.g. FPS
) from an environment variable:
// Get the module keycode from the environment variable
bytes memory keycodeRaw = vm.envBytes("MODULE_KEYCODE");
Keycode keycode = toKeycode(bytes5(keycodeRaw));
The fee is also obtained from an environment variable:
// Get the fee from the environment variable
uint256 feeRaw = vm.envUint("FEE");
if (feeRaw > type(uint48).max) {
revert("Fee is greater than uint48 max");
}
uint48 fee = uint48(feeRaw);
For logging purposes, the current fee is printed:
// Get the curator fee
uint48 curatorFee = auctionHouse.getCuratorFee(keycode, _CURATOR);
console2.log("Current curator fee: {}", curatorFee);
Lastly, the curator fee is set for the specific module keycode. Note that the call must be performed by the curator.
// Set the curator fee
// Must be performed as the curator
vm.prank(_CURATOR);
auctionHouse.setCuratorFee(keycode, fee);
console2.log("Set curator fee to: {}", fee);
Accepting Curation Request
After a curator has set their fee and the curator has been listed as the curator of an auction, the curator must accept the curation request in order to receive payouts.
This requires the AuctionHouse:
// Define the AuctionHouse
IAuctionHouse auctionHouse = IAuctionHouse(_atomicAuctionHouse);
It also requires the lot ID, which can be loaded from an environment variable:
// Get the lot ID from the environment variable
uint256 lotIdRaw = vm.envUint("LOT_ID");
if (lotIdRaw > type(uint96).max) {
revert("Lot ID is greater than uint96 max");
}
uint96 lotId = uint96(lotIdRaw);
Lastly, it requires calling the curate()
function as the curator:
// Callback data is unused in this example
bytes memory callbackData = abi.encode("");
// Curate the lot
// Must be performed as the curator
vm.prank(_CURATOR);
auctionHouse.curate(lotId, callbackData);
console2.log("Curated lot: {}", lotId);
Source Code
The source code for the guide is located in the curation.s.sol file.