Maple
Search…
Liquidator

Constructor

1
constructor(
2
address owner_,
3
address collateralAsset_,
4
address fundsAsset_,
5
address auctioneer_,
6
address destination_,
7
address globals_
8
);
Copied!

Parameters:

Index
Name
Type
Internal Type
Description
0
owner_
address
address
The address of an account that will have administrative privileges on this contract.
1
collateralAsset_
address
address
The address of the collateral asset being liquidated.
2
fundsAsset_
address
address
The address of the funds asset.
3
auctioneer_
address
address
The address of an Auctioneer.
4
destination_
address
address
The address to send funds asset after liquidation.
5
globals_
address
address
The address of a Maple Globals contract.

Functions

auctioneer [state variable]

Getter function that returns `auctioneer`.
1
function auctioneer()
2
view
3
returns (
4
address auctioneer_
5
);
Copied!

Return Values:

Index
Name
Type
Internal Type
Description
0
auctioneer_
address
address

collateralAsset [state variable]

Getter function that returns `collateralAsset`.
1
function collateralAsset()
2
view
3
returns (
4
address collateralAsset_
5
);
Copied!

Return Values:

Index
Name
Type
Internal Type
Description
0
collateralAsset_
address
address

destination [state variable]

Getter function that returns `destination` - address that liquidated funds are sent to.
1
function destination()
2
view
3
returns (
4
address destination_
5
);
Copied!

Return Values:

Index
Name
Type
Internal Type
Description
0
destination_
address
address

fundsAsset [state variable]

Getter function that returns `fundsAsset`.
1
function fundsAsset()
2
view
3
returns (
4
address fundsAsset_
5
);
Copied!

Return Values:

Index
Name
Type
Internal Type
Description
0
fundsAsset_
address
address

getExpectedAmount

Returns the expected amount to be returned from a flash loan given a certain amount of `collateralAsset`.
1
function getExpectedAmount(
2
uint256 swapAmount_
3
)
4
nonpayable
5
returns (
6
uint256 expectedAmount_
7
);
Copied!

Parameters:

Index
Name
Type
Internal Type
Description
0
swapAmount_
uint256
uint256
Amount of `collateralAsset` to be flash-borrowed.

Return Values:

Index
Name
Type
Internal Type
Description
0
expectedAmount_
uint256
uint256
Amount of `fundsAsset` that must be returned in the same transaction.

globals [state variable]

Getter function that returns `globals`.
1
function globals()
2
view
3
returns (
4
address
5
);
Copied!

Return Values:

Index
Name
Type
Internal Type
Description
0
address
address

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.
1
function liquidatePortion(
2
uint256 swapAmount_,
3
uint256 maxReturnAmount_,
4
bytes data_
5
)
6
nonpayable;
Copied!

Parameters:

Index
Name
Type
Internal Type
Description
0
swapAmount_
uint256
uint256
Amount of `collateralAsset` that is to be borrowed in the flash loan.
1
maxReturnAmount_
uint256
uint256
Max amount of `fundsAsset` that can be returned to the liquidator contract.
2
data_
bytes
bytes
ABI-encoded arguments to be used in the low-level call to perform step 2.

owner [state variable]

Getter function that returns `owner`.
1
function owner()
2
view
3
returns (
4
address owner_
5
);
Copied!

Return Values:

Index
Name
Type
Internal Type
Description
0
owner_
address
address

pullFunds

Pulls a specified amount of ERC-20 tokens from the contract. Can only be called by `owner`.
1
function pullFunds(
2
address token_,
3
address destination_,
4
uint256 amount_
5
)
6
nonpayable;
Copied!

Parameters:

Index
Name
Type
Internal Type
Description
0
token_
address
address
The ERC-20 token contract address.
1
destination_
address
address
The destination of the transfer.
2
amount_
uint256
uint256
The amount to transfer.

setAuctioneer

Set the auctioneer contract address, which is used to pull the `getExpectedAmount`. Can only be set by `owner`.
1
function setAuctioneer(
2
address auctioneer_
3
)
4
nonpayable;
Copied!

Parameters:

Index
Name
Type
Internal Type
Description
0
auctioneer_
address
address
The auctioneer contract address.

Events

AuctioneerSet

Auctioneer was set.
1
event AuctioneerSet(
2
address auctioneer_
3
);
Copied!

Parameters:

Index
Name
Type
Internal Type
Description
0
auctioneer_
address
address
Address of the auctioneer.

FundsPulled

Funds were withdrawn from the liquidator.
1
event FundsPulled(
2
address token_,
3
address destination_,
4
uint256 amount_
5
);
Copied!

Parameters:

Index
Name
Type
Internal Type
Description
0
token_
address
address
Address of the token that was withdrawn.
1
destination_
address
address
Address of where tokens were sent.
2
amount_
uint256
uint256
Amount of tokens that were sent.

PortionLiquidated

Portion of collateral was liquidated.
1
event PortionLiquidated(
2
uint256 swapAmount_,
3
uint256 returnedAmount_
4
);
Copied!

Parameters:

Index
Name
Type
Internal Type
Description
0
swapAmount_
uint256
uint256
Amount of collateralAsset that was liquidated.
1
returnedAmount_
uint256
uint256
Amount of fundsAsset that was returned.
Last modified 24d ago