IBasicActions

Git Source

Inherits: ICommonActions

Functions

openSAFE

Opens a brand new SAFE

function openSAFE(address _manager, bytes32 _cType, address _usr) external returns (uint256 _safeId);

Parameters

NameTypeDescription
_manageraddressAddress of the HaiSafeManager contract
_cTypebytes32Bytes32 representing the collateral type
_usraddressAddress of the SAFE owner

Returns

NameTypeDescription
_safeIduint256Id of the created SAFE

generateDebt

Generates debt and sends COIN amount to msg.sender

function generateDebt(
  address _manager,
  address _taxCollector,
  address _coinJoin,
  uint256 _safeId,
  uint256 _deltaWad
) external;

Parameters

NameTypeDescription
_manageraddressAddress of the HaiSafeManager contract
_taxCollectoraddressAddress of the TaxCollector contract
_coinJoinaddressAddress of the CoinJoin contract
_safeIduint256Id of the SAFE
_deltaWaduint256Amount of COIN to generate [wad]

repayDebt

Repays an amount of debt

function repayDebt(
  address _manager,
  address _taxCollector,
  address _coinJoin,
  uint256 _safeId,
  uint256 _deltaWad
) external;

Parameters

NameTypeDescription
_manageraddressAddress of the HaiSafeManager contract
_taxCollectoraddressAddress of the TaxCollector contract
_coinJoinaddressAddress of the CoinJoin contract
_safeIduint256Id of the SAFE
_deltaWaduint256Amount of COIN to repay [wad]

lockTokenCollateral

Locks a collateral token amount in the SAFE

function lockTokenCollateral(address _manager, address _collateralJoin, uint256 _safeId, uint256 _deltaWad) external;

Parameters

NameTypeDescription
_manageraddressAddress of the HaiSafeManager contract
_collateralJoinaddressAddress of the CollateralJoin contract
_safeIduint256Id of the SAFE
_deltaWaduint256Amount of collateral to collateralize [wad]

freeTokenCollateral

Unlocks a collateral token amount from the SAFE, and transfers the ERC20 collateral to the user's address

function freeTokenCollateral(address _manager, address _collateralJoin, uint256 _safeId, uint256 _deltaWad) external;

Parameters

NameTypeDescription
_manageraddressAddress of the HaiSafeManager contract
_collateralJoinaddressAddress of the CollateralJoin contract
_safeIduint256Id of the SAFE
_deltaWaduint256Amount of collateral to free [wad]

repayAllDebt

Repays the total amount of debt of a SAFE

This method is used to close a SAFE's debt, when the amount of debt is increasing due to stability fees

function repayAllDebt(address _manager, address _taxCollector, address _coinJoin, uint256 _safeId) external;

Parameters

NameTypeDescription
_manageraddressAddress of the HaiSafeManager contract
_taxCollectoraddressAddress of the TaxCollector contract
_coinJoinaddressAddress of the CoinJoin contract
_safeIduint256Id of the SAFE

lockTokenCollateralAndGenerateDebt

Locks a collateral token amount in the SAFE and generates debt

function lockTokenCollateralAndGenerateDebt(
  address _manager,
  address _taxCollector,
  address _collateralJoin,
  address _coinJoin,
  uint256 _safe,
  uint256 _collateralAmount,
  uint256 _deltaWad
) external;

Parameters

NameTypeDescription
_manageraddressAddress of the HaiSafeManager contract
_taxCollectoraddressAddress of the TaxCollector contract
_collateralJoinaddressAddress of the CollateralJoin contract
_coinJoinaddressAddress of the CoinJoin contract
_safeuint256Id of the SAFE
_collateralAmountuint256Amount of collateral to collateralize [wad]
_deltaWaduint256Amount of COIN to generate [wad]

openLockTokenCollateralAndGenerateDebt

Creates a SAFE, locks a collateral token amount in it and generates debt

function openLockTokenCollateralAndGenerateDebt(
  address _manager,
  address _taxCollector,
  address _collateralJoin,
  address _coinJoin,
  bytes32 _cType,
  uint256 _collateralAmount,
  uint256 _deltaWad
) external returns (uint256 _safe);

Parameters

NameTypeDescription
_manageraddressAddress of the HaiSafeManager contract
_taxCollectoraddressAddress of the TaxCollector contract
_collateralJoinaddressAddress of the CollateralJoin contract
_coinJoinaddressAddress of the CoinJoin contract
_cTypebytes32Bytes32 representing the collateral type
_collateralAmountuint256Amount of collateral to collateralize [wad]
_deltaWaduint256Amount of COIN to generate [wad]

Returns

NameTypeDescription
_safeuint256Id of the created SAFE

repayDebtAndFreeTokenCollateral

Repays debt and unlocks a collateral token amount from the SAFE

function repayDebtAndFreeTokenCollateral(
  address _manager,
  address _taxCollector,
  address _collateralJoin,
  address _coinJoin,
  uint256 _safeId,
  uint256 _collateralWad,
  uint256 _debtWad
) external;

Parameters

NameTypeDescription
_manageraddressAddress of the HaiSafeManager contract
_taxCollectoraddressAddress of the TaxCollector contract
_collateralJoinaddressAddress of the CollateralJoin contract
_coinJoinaddressAddress of the CoinJoin contract
_safeIduint256Id of the SAFE
_collateralWaduint256Amount of collateral to free [wad]
_debtWaduint256Amount of COIN to repay [wad]

repayAllDebtAndFreeTokenCollateral

Repays all debt and unlocks collateral from the SAFE

function repayAllDebtAndFreeTokenCollateral(
  address _manager,
  address _taxCollector,
  address _collateralJoin,
  address _coinJoin,
  uint256 _safeId,
  uint256 _collateralWad
) external;

Parameters

NameTypeDescription
_manageraddressAddress of the HaiSafeManager contract
_taxCollectoraddressAddress of the TaxCollector contract
_collateralJoinaddressAddress of the CollateralJoin contract
_coinJoinaddressAddress of the CoinJoin contract
_safeIduint256Id of the SAFE
_collateralWaduint256Amount of collateral to free [wad]

collectTokenCollateral

Collects a collateral token amount from the SAFE handler, and transfers the ERC20 collateral to the user's address

function collectTokenCollateral(address _manager, address _collateralJoin, uint256 _safeId, uint256 _deltaWad) external;

Parameters

NameTypeDescription
_manageraddressAddress of the HaiSafeManager contract
_collateralJoinaddressAddress of the CollateralJoin contract
_safeIduint256Id of the SAFE
_deltaWaduint256Amount of collateral to collect [wad]