Liquidator

Functions

collateralAsset

Returns the address of the collateral asset.

    function collateralAsset()
        view
        returns (
            address
        );

Return Values:

collateralRemaining

Returns the amount of collateral yet to be liquidated.

    function collateralRemaining()
        view
        returns (
            uint256
        );

Return Values:

factory

The address of the proxy factory.

    function factory()
        view
        returns (
            address factory_
        );

Return Values:

fundsAsset

Returns the address of the funding asset.

    function fundsAsset()
        view
        returns (
            address
        );

Return Values:

getExpectedAmount

Returns the expected amount to be returned from a flash loan given a certain amount of `collateralAsset`.

    function getExpectedAmount(
        uint256 swapAmount_
    )
        view
        returns (
            uint256 expectedAmount_
        );

Parameters:

Return Values:

globals

    function globals()
        view
        returns (
            address globals_
        );

Return Values:

governor

    function governor()
        view
        returns (
            address governor_
        );

Return Values:

implementation

The address of the implementation contract being proxied.

    function implementation()
        view
        returns (
            address implementation_
        );

Return Values:

liquidatePortion

Flash loan function that: 1. Transfers a specified amount of `collateralAsset` to `msg.sender`. 2. Performs an arbitrary call to `msg.sender`, to trigger logic necessary to get `fundsAsset` (e.g., AMM swap). 3. Performs a `transferFrom`, taking the corresponding amount of `fundsAsset` from the user. If the required amount of `fundsAsset` is not returned in step 3, the entire transaction reverts.

    function liquidatePortion(
        uint256 collateralAmount_,
        uint256 maxReturnAmount_,
        bytes data_
    )
        nonpayable;

Parameters:

loanManager

Returns the address of the loan manager contract.

    function loanManager()
        view
        returns (
            address
        );

Return Values:

migrate

Modifies the proxy's storage by delegate-calling a migrator contract with some arguments. Access control logic critical since caller can force a selfdestruct via a malicious `migrator_` which is delegatecalled.

    function migrate(
        address migrator_,
        bytes arguments_
    )
        nonpayable;

Parameters:

poolDelegate

    function poolDelegate()
        view
        returns (
            address poolDelegate_
        );

Return Values:

pullFunds

Pulls a specified amount of ERC-20 tokens from the contract. Can only be called by `owner`.

    function pullFunds(
        address token_,
        address destination_,
        uint256 amount_
    )
        nonpayable;

Parameters:

setCollateralRemaining

Sets the initial amount of collateral to be liquidated.

    function setCollateralRemaining(
        uint256 collateralAmount_
    )
        nonpayable;

Parameters:

setImplementation

Modifies the proxy's implementation address.

    function setImplementation(
        address implementation_
    )
        nonpayable;

Parameters:

upgrade

Upgrades a contract implementation to a specific version. Access control logic critical since caller can force a selfdestruct via a malicious `migrator_` which is delegatecalled.

    function upgrade(
        uint256 version_,
        bytes arguments_
    )
        nonpayable;

Parameters:

Events

FundsPulled

Funds were withdrawn from the liquidator.

    event FundsPulled(
        address token_,
        address destination_,
        uint256 amount_
    );

Parameters:

PortionLiquidated

Portion of collateral was liquidated.

    event PortionLiquidated(
        uint256 swapAmount_,
        uint256 returnedAmount_
    );

Parameters:

Upgraded

The instance was upgraded.

    event Upgraded(
        uint256 toVersion_,
        bytes arguments_
    );

Parameters:

Last updated