ContinuousClearingAuctionFactory
0x000000001f26a0044baa66024e7b6599c61963f8
Verification
Verified
v0.8.26+commit.8a97fa7a
Type
Contract
24,214 bytes
ABI entries
6
2 read · 1 write
License
none
Contract information
- Address
- 0x000000001f26a0044baa66024e7b6599c61963f8
- Chain
- Robinhood Chain (4663)
- Compiler
- v0.8.26+commit.8a97fa7a
- Optimization
- Enabled
- Creator
- 0x4e59b44847…26c0B4956C
- Creation tx
- 0x1b48332002…fa1d31d263
Token
Not a token
This contract does not expose ERC-20 metadata.
Read contract (2)
getAddress(address, uint256, bytes, bytes32, address) → address
protocolFeeController() → address
Events (1)
AuctionCreated
ABI
[
{
"inputs": [
{
"internalType": "address",
"name": "_protocolFeeController",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "InvalidTokenAmount",
"type": "error"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "auction",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "token",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"indexed": false,
"internalType": "bytes",
"name": "configData",
"type": "bytes"
}
],
"name": "AuctionCreated",
"type": "event"
},
{
"inputs": [
{
"internalType": "address",
"name": "token",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "configData",
"type": "bytes"
},
{
"internalType": "bytes32",
"name": "salt",
"type": "bytes32"
}
],
"name": "create",
"outputs": [
{
"internalType": "contract IDistributor",
"name": "distributor",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "token",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "configData",
"type": "bytes"
},
{
"internalType": "bytes32",
"name": "salt",
"type": "bytes32"
},
{
"internalType": "address",
"name": "sender",
"type": "address"
}
],
"name": "getAddress",
"outputs": [
{
"internalType": "contract IDistributor",
"name": "distributor",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "protocolFeeController",
"outputs": [
{
"internalType": "contract IProtocolFeeController",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
}
]Source code
// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;
import {ContinuousClearingAuction} from './ContinuousClearingAuction.sol';
import {AuctionParameters} from './interfaces/IContinuousClearingAuction.sol';
import {IContinuousClearingAuctionFactory} from './interfaces/IContinuousClearingAuctionFactory.sol';
import {Create2} from '@openzeppelin/contracts/utils/Create2.sol';
import {IDistributor} from 'liquidity-launcher/src/interfaces/IDistributor.sol';
import {IDistributorFactory} from 'liquidity-launcher/src/interfaces/IDistributorFactory.sol';
import {IProtocolFeeController} from 'liquidity-launcher/src/interfaces/IProtocolFeeController.sol';
import {ActionConstants} from 'v4-periphery/src/libraries/ActionConstants.sol';
/// @title ContinuousClearingAuctionFactory
/// @notice Deploy a new factory to use a different protocol fee controller for newly created auctions.
/// @custom:security-contact security@uniswap.org
contract ContinuousClearingAuctionFactory is IContinuousClearingAuctionFactory {
/// @notice The protocol fee controller to use for all created auctions
IProtocolFeeController internal immutable PROTOCOL_FEE_CONTROLLER;
constructor(address _protocolFeeController) {
PROTOCOL_FEE_CONTROLLER = IProtocolFeeController(_protocolFeeController);
}
/// @inheritdoc IDistributorFactory
function create(address token, uint256 amount, bytes calldata configData, bytes32 salt)
external
returns (IDistributor distributor)
{
if (amount > type(uint128).max) revert InvalidTokenAmount(amount);
AuctionParameters memory parameters = abi.decode(configData, (AuctionParameters));
// If the tokensRecipient is address(1), set it to the msg.sender
if (parameters.tokensRecipient == ActionConstants.MSG_SENDER) parameters.tokensRecipient = msg.sender;
// If the fundsRecipient is address(1), set it to the msg.sender
if (parameters.fundsRecipient == ActionConstants.MSG_SENDER) parameters.fundsRecipient = msg.sender;
distributor = IDistributor(
address(
new ContinuousClearingAuction{salt: keccak256(abi.encode(msg.sender, salt))}(
token, uint128(amount), parameters, address(PROTOCOL_FEE_CONTROLLER)
)
)
);
emit AuctionCreated(address(distributor), token, uint128(amount), abi.encode(parameters));
}
/// @inheritdoc IDistributorFactory
function getAddress(address token, uint256 amount, bytes calldata configData, bytes32 salt, address sender)
external
view
returns (IDistributor distributor)
{
if (amount > type(uint128).max) revert InvalidTokenAmount(amount);
AuctionParameters memory parameters = abi.decode(configData, (AuctionParameters));
// If the tokensRecipient is address(1), set it to the sender
if (parameters.tokensRecipient == ActionConstants.MSG_SENDER) parameters.tokensRecipient = sender;
// If the fundsRecipient is address(1), set it to the sender
if (parameters.fundsRecipient == ActionConstants.MSG_SENDER) parameters.fundsRecipient = sender;
bytes32 initCodeHash = keccak256(
abi.encodePacked(
type(ContinuousClearingAuction).creationCode,
abi.encode(token, uint128(amount), parameters, address(PROTOCOL_FEE_CONTROLLER))
)
);
distributor =
IDistributor(Create2.computeAddress(keccak256(abi.encode(sender, salt)), initCodeHash, address(this)));
}
/// @inheritdoc IContinuousClearingAuctionFactory
function protocolFeeController() external view returns (IProtocolFeeController) {
return PROTOCOL_FEE_CONTROLLER;
}
}
Chain explorer2836msChain node88ms