CollateralAuctionHouseFactory

Git Source

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

NameTypeDescription
_cTypebytes32Bytes32 representation of the collateral type

Returns

NameTypeDescription
_cahParamsICollateralAuctionHouse.CollateralAuctionHouseParamsCollateralAuctionHouse 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

NameTypeDescription
_cTypebytes32Bytes32 representation of the collateral type

Returns

NameTypeDescription
_minimumBiduint256Minimum bid for the collateral auctions [wad]
_minDiscountuint256Minimum discount for the collateral auctions [wad %]
_maxDiscountuint256Maximum discount for the collateral auctions [wad %]
_perSecondDiscountUpdateRateuint256Per 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

NameTypeDescription
_safeEngineaddressAddress of the SAFEEngine contract
_liquidationEngineaddressAddress of the LiquidationEngine contract
_oracleRelayeraddressAddress of the OracleRelayer contract

deployCollateralAuctionHouse

Deploys a CollateralAuctionHouse contract

function deployCollateralAuctionHouse(
  bytes32 _cType,
  ICollateralAuctionHouse.CollateralAuctionHouseParams memory _cahParams
) external isAuthorized whenEnabled returns (ICollateralAuctionHouse _collateralAuctionHouse);

Parameters

NameTypeDescription
_cTypebytes32Bytes32 representation of the collateral type
_cahParamsICollateralAuctionHouse.CollateralAuctionHouseParamsInitial valid CollateralAuctionHouse parameters

Returns

NameTypeDescription
_collateralAuctionHouseICollateralAuctionHouseAddress of the deployed CollateralAuctionHouse contract

collateralList

Getter for the list of collateral types

function collateralList() external view returns (bytes32[] memory __collateralList);

Returns

NameTypeDescription
__collateralListbytes32[]List of collateral types

collateralAuctionHousesList

Getter for the list of CollateralAuctionHouse contracts

function collateralAuctionHousesList() external view returns (address[] memory _collateralAuctionHousesList);

Returns

NameTypeDescription
_collateralAuctionHousesListaddress[]_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

NameTypeDescription
_cTypebytes32Bytes32 representation of the collateral type
_parambytes32Bytes32 representation of the parameter
_databytesBytes 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;