CollateralAuctionHouseFactory
Inherits: Authorizable, Modifiable, Disableable, ICollateralAuctionHouseFactory
This contract is used to deploy CollateralAuctionHouse contracts
The deployed contracts are CollateralAuctionHouseChild instances
State Variables
safeEngine
Address of the SAFEEngine contract
address public safeEngine;
liquidationEngine
Address of the LiquidationEngine contract
address public liquidationEngine;
oracleRelayer
Address of the OracleRelayer contract
address public oracleRelayer;
collateralAuctionHouses
Getter for the address of the CollateralAuctionHouse contract associated with a collateral type
mapping(bytes32 _cType => address) public collateralAuctionHouses;
_collateralList
The enumerable set of collateral types
EnumerableSet.Bytes32Set internal _collateralList;
Functions
cParams
Getter for the collateral parameters struct
function cParams(bytes32 _cType)
external
view
returns (ICollateralAuctionHouse.CollateralAuctionHouseParams memory _cahParams);
Parameters
Name | Type | Description |
---|---|---|
_cType | bytes32 | Bytes32 representation of the collateral type |
Returns
Name | Type | Description |
---|---|---|
_cahParams | ICollateralAuctionHouse.CollateralAuctionHouseParams | CollateralAuctionHouse parameters struct |
_cParams
Getter for the unpacked collateral parameters struct
function _cParams(bytes32 _cType)
external
view
returns (uint256 _minimumBid, uint256 _minDiscount, uint256 _maxDiscount, uint256 _perSecondDiscountUpdateRate);
Parameters
Name | Type | Description |
---|---|---|
_cType | bytes32 | Bytes32 representation of the collateral type |
Returns
Name | Type | Description |
---|---|---|
_minimumBid | uint256 | Minimum bid for the collateral auctions [wad] |
_minDiscount | uint256 | Minimum discount for the collateral auctions [wad %] |
_maxDiscount | uint256 | Maximum discount for the collateral auctions [wad %] |
_perSecondDiscountUpdateRate | uint256 | Per second rate at which the discount is updated [ray] |
constructor
Adds authorization to the LiquidationEngine (extended to all child contracts)
constructor(
address _safeEngine,
address _liquidationEngine,
address _oracleRelayer
) Authorizable(msg.sender) validParams;
Parameters
Name | Type | Description |
---|---|---|
_safeEngine | address | Address of the SAFEEngine contract |
_liquidationEngine | address | Address of the LiquidationEngine contract |
_oracleRelayer | address | Address of the OracleRelayer contract |
deployCollateralAuctionHouse
Deploys a CollateralAuctionHouse contract
function deployCollateralAuctionHouse(
bytes32 _cType,
ICollateralAuctionHouse.CollateralAuctionHouseParams memory _cahParams
) external isAuthorized whenEnabled returns (ICollateralAuctionHouse _collateralAuctionHouse);
Parameters
Name | Type | Description |
---|---|---|
_cType | bytes32 | Bytes32 representation of the collateral type |
_cahParams | ICollateralAuctionHouse.CollateralAuctionHouseParams | Initial valid CollateralAuctionHouse parameters |
Returns
Name | Type | Description |
---|---|---|
_collateralAuctionHouse | ICollateralAuctionHouse | Address of the deployed CollateralAuctionHouse contract |
collateralList
Getter for the list of collateral types
function collateralList() external view returns (bytes32[] memory __collateralList);
Returns
Name | Type | Description |
---|---|---|
__collateralList | bytes32[] | List of collateral types |
collateralAuctionHousesList
Getter for the list of CollateralAuctionHouse contracts
function collateralAuctionHousesList() external view returns (address[] memory _collateralAuctionHousesList);
Returns
Name | Type | Description |
---|---|---|
_collateralAuctionHousesList | address[] | _collateralAuctionHouses List of CollateralAuctionHouse contracts |
_modifyParameters
Internal function to be overriden with custom logic to modify parameters
This function is set to revert if not overriden
function _modifyParameters(bytes32 _param, bytes memory _data) internal override;
_modifyParameters
Internal function to be overriden with custom logic to modify parameters
Overriding method routes the parameter modification to the child contracts
function _modifyParameters(bytes32 _cType, bytes32 _param, bytes memory _data) internal override;
Parameters
Name | Type | Description |
---|---|---|
_cType | bytes32 | Bytes32 representation of the collateral type |
_param | bytes32 | Bytes32 representation of the parameter |
_data | bytes | Bytes representation of the parameter data |
_setLiquidationEngine
Sets the LiquidationEngine contract address, revoking the previous, and granting the new one authorization
function _setLiquidationEngine(address _newLiquidationEngine) internal;
_validateParameters
Internal function to be overriden with custom logic to validate parameters
function _validateParameters() internal view override;