Continuous Clearing Auction instances are deployed via the ContinuousClearingAuctionFactory deployed to each supported chain.
The Factory contract can be deployed via the DeployContinuousAuctionFactoryScript.
PROTOCOL_FEE_CONTROLLER=<protocol_fee_controller_address> forge script script/deploy/DeployContinuousAuctionFactory.s.sol:DeployContinuousAuctionFactoryScript --rpc-url <rpc_url> --broadcast --private-key <private_key>The Factory contract has a simple interface (from IContinuousClearingAuctionFactory.sol):
/// From IContinuousClearingAuctionFactory.sol
{
function initializeDistribution(address token, uint256 amount, bytes calldata configData, bytes32 salt)
external
returns (IDistributionContract distributionContract);
function getAuctionAddress(address token, uint256 amount, bytes calldata configData, bytes32 salt, address sender)
external
view
returns (address);
}Call initializeDistribution to deploy a new auction instance, providing the token, amount, configData, and salt parameters.
tokenis the address of the token to be sold.amountis the amount of tokens to sell in the auctionconfigDatais the abi-encoded AuctionParameters structsaltis an optional bytes32 value for vanity address mining
The function will return the address of the new auction instance.
Alternatively, you can deploy the auction instance directly via the constructor.
/// From ContinuousClearingAuction.sol
{
constructor(address token, uint128 amount, AuctionParameters memory parameters) {
// ...
}
}The parameters are the same but the constructor does not require a salt parameter.
Integrating contracts should call IDistributionContract.onTokensReceived to notify the auction that the tokens have been received. If deploying from an EOA, this can be done by calling the function directly on the auction instance.
This is a required pre-requisite before the auction can begin accepting bids.
Newly deployed auctions may require manual verification on block explorers. The easiest way to do this is to run the following shell script which will write the standard json input to a new file:
forge verify-contract <address> src/ContinuousClearingAuction.sol:ContinuousClearingAuction --rpc-url <rpc_url> --show-standard-json-input > standard-json-input.jsonMost block explorers will support uploading this file to verify the contract.