Dev Docs
Australis Developers Documentation
Main point of interaction with an Australis protocol's market. Users can:
- Deposit
- Withdraw
- Borrow
- Repay
- Enable/disable their deposits as collateral
- Liquidate positions
- Execute Flash Loans
All admin functions are callable by the LendingPoolConfigurator contract defined also in the LendingPoolAddressesProvider.
Deposits an
amount
of underlying asset into the reserve, receiving in return overlying astTokens.- E.g. User deposits 100 DAI and gets in return 100 astDAI.
function deposit(
address asset,
uint256 amount,
address onBehalfOf,
uint16 referralCode)
Name | Type | Description |
---|---|---|
asset | address | The address of the underlying asset to deposit |
amount | uint256 | The amount to be deposited |
onBehalfOf | address | The address that will receive the astTokens, same as msg.sender if the user wants to receive them on their own wallet, or a different address if the beneficiary of astTokens is a different wallet |
referralCode | uint16 | Code used to register the integrator originating the operation, for potential rewards. 0 if the action is executed directly by the user, without any middle-man |
event Deposit(
address reserve,
address user,
address onBehalfOf,
uint256 amount,
uint16 referral)
Emitted on
deposit()
Name | Type | Description |
---|---|---|
reserve | address | The address of the underlying asset of the reserve |
user | address | The address initiating the deposit |
onBehalfOf | address | The beneficiary of the deposit, receiving the astTokens |
amount | uint256 | The amount deposited |
referral | uint16 | The referral code used |
function withdraw(
address asset,
uint256 amount,
address to) returns (uint256)
Withdraws an
amount
of underlying asset from the reserve, burning the equivalent astTokens owned E.g. User has 100 astUSDC, calls withdraw() and receives 100 USDC, burning the 100 astUSDCName | Type | Description |
---|---|---|
asset | address | The address of the underlying asset to withdraw |
amount | uint256 | The underlying amount to be withdrawn - Send the value type(uint256).max in order to withdraw the whole astToken balance |
to | address | Address that will receive the underlying, same as msg.sender if the user wants to receive it on his own wallet, or a different address if the beneficiary is a different wallet |
Name | Type | Description |
---|---|---|
[0] | uint256 | The final amount withdrawn |
event Withdraw(
address reserve,
address user,
address to,
uint256 amount)
Emitted on
withdraw()
Name | Type | Description |
---|---|---|
reserve | address | The address of the underlyng asset being withdrawn |
user | address | The address initiating the withdrawal, owner of astTokens |
to | address | Address that will receive the underlying |
amount | uint256 | The amount to be withdrawn |
function borrow(
address asset,
uint256 amount,
uint256 interestRateMode,
uint16 referralCode,
address onBehalfOf)
Allows users to borrow a specific
amount
of the reserve underlying asset, provided that the borrower already deposited enough collateral, or he was given enough allowance by a credit delegator on the corresponding debt token (StableDebtToken or VariableDebtToken)- E.g. User borrows 100 USDC passing as
onBehalfOf
his own address, receiving the 100 USDC in his wallet and 100 stable/variable debt tokens, depending on theinterestRateMode
.
Name | Type | Description |
---|---|---|
asset | address | The address of the underlying asset to borrow |
amount | uint256 | The amount to be borrowed |
interestRateMode | uint256 | The interest rate mode at which the user wants to borrow: 1 for Stable, 2 for Variable |
referralCode | uint16 | Code used to register the integrator originating the operation, for potential rewards. 0 if the action is executed directly by the user, without any middle-man |
onBehalfOf | address | Address of the user who will receive the debt. Should be the address of the borrower itself calling the function if he wants to borrow against his own collateral, or the address of the credit delegator if he has been given credit delegation allowance |
event Borrow(
address reserve,
address user,
address onBehalfOf,
uint256 amount,
uint256 borrowRateMode,
uint256 borrowRate,
uint16 referral)
Emitted on
borrow()
and flashLoan()
when debt needs to be opened.Name | Type | Description |
---|---|---|
reserve | address | The address of the underlying asset being borrowed |
user | address | The address of the user initiating the borrow() , receiving the funds on borrow() or just initiator of the transaction on flashLoan() |
onBehalfOf | address | The address that will be getting the debt |
amount | uint256 | The amount borrowed out |
borrowRateMode | uint256 | The rate mode: 1 for Stable, 2 for Variable |
borrowRate | uint256 | The numeric rate at which the user has borrowed |
referral | uint16 | The referral code used |
function repay(
address asset,
uint256 amount,
uint256 rateMode,
address onBehalfOf) returns (uint256)
Repays a borrowed
amount
on a specific reserve, burning the equivalent debt tokens owned- E.g. User repays 100 USDC, burning 100 variable/stable debt tokens of the
onBehalfOf
address.
Name | Type | Description |
---|---|---|
asset | address | The address of the borrowed underlying asset previously borrowed |
amount | uint256 | The amount to repay - Send the value type(uint256).max in order to repay the whole debt for asset on the specific debtMode |
rateMode | uint256 | The interest rate mode at of the debt the user wants to repay: 1 for Stable, 2 for Variable |
onBehalfOf | address | Address of the user who will get his debt reduced/removed. Should be the address of the user calling the function if he wants to reduce/remove his own debt, or the address of any other other borrower whose debt should be removed |
Name | Type | Description |
---|---|---|
[0] | uint256 | The final amount repaid |
event Repay(
address reserve,
address user,
address repayer,
uint256 amount)
Emitted on
repay()
Name | Type | Description |
---|---|---|
reserve | address | The address of the underlying asset of the reserve |
user | address | The beneficiary of the repayment, getting his debt reduced |
repayer | address | The address of the user initiating the repay() , providing the funds |
amount | uint256 | The amount repaid |
function setUserUseReserveAsCollateral(address asset, bool useAsCollateral)
Allows depositors to enable/disable a specific deposited asset as collateral
Name | Type | Description |
---|---|---|
asset | address | The address of the underlying asset deposited |
useAsCollateral | bool | true if the user wants to use the deposit as collateral, false otherwise |
event ReserveUsedAsCollateralEnabled(address reserve, address user)
Emitted on
setUserUseReserveAsCollateral()
Name | Type | Description |
---|---|---|
reserve | address | The address of the underlying asset of the reserve |
user | address | The address of the user enabling the usage as collateral |
event ReserveUsedAsCollateralDisabled(address reserve, address user)
Emitted on
setUserUseReserveAsCollateral()
Name | Type | Description |
---|---|---|
reserve | address | The address of the underlying asset of the reserve |
user | address | The address of the user enabling the usage as collateral |
function liquidationCall(
address collateralAsset,
address debtAsset,
address user,
uint256 debtToCover,
bool receiveAToken)
Function to liquidate a non-healthy position collateral-wise, with Health Factor below 1
- The caller (liquidator) covers
debtToCover
amount of debt of the user getting liquidated, and receives a proportionally amount of thecollateralAsset
plus a bonus to cover market risk
Name | Type | Description |
---|---|---|
collateralAsset | address | The address of the underlying asset used as collateral, to receive as result of the liquidation |
debtAsset | address | The address of the underlying borrowed asset to be repaid with the liquidation |
user | address | The address of the borrower getting liquidated |
debtToCover | uint256 | The debt amount of borrowed asset the liquidator wants to cover |
receiveAToken | bool | true if the liquidators wants to receive the collateral astTokens, false if he wants to receive the underlying collateral asset directly |
event LiquidationCall(
address collateralAsset,
address debtAsset,
address user,
uint256 debtToCover,
uint256 liquidatedCollateralAmount,
address liquidator,
bool receiveAstToken)
Emitted when a borrower is liquidated. This event is emitted by the LendingPool via LendingPoolCollateral manager using a
DELEGATECALL
This allows to have the events in the generated ABI for LendingPool.Name | Type | Description |
---|---|---|
collateralAsset | address | The address of the underlying asset used as collateral, to receive as result of the liquidation |
debtAsset | address | The address of the underlying borrowed asset to be repaid with the liquidation |
user | address | The address of the borrower getting liquidated |
debtToCover | uint256 | The debt amount of borrowed asset the liquidator wants to cover |
liquidatedCollateralAmount | uint256 | The amount of collateral received by the liiquidator |
liquidator | address | The address of the liquidator |
receiveAstToken | bool | true if the liquidators wants to receive the collateral astTokens, false if he wants to receive the underlying collateral asset directly |
struct FlashLoanLocalVars {
contract IFlashLoanReceiver receiver;
address oracle;
uint256 i;
address currentAsset;
address currentAstTokenAddress;
uint256 currentAmount;
uint256 currentPremium;
uint256 currentAmountPlusPremium;
address debtToken;
}
function flashLoan(
address receiverAddress,
address[] assets,
uint256[] amounts,
uint256[] modes,
address onBehalfOf,
bytes params,
uint16 referralCode)
Allows smartcontracts to access the liquidity of the pool within one transaction, as long as the amount taken plus a fee is returned. There are security concerns for developers of flashloan receiver contracts that must be kept into consideration.
Name | Type | Description |
---|---|---|
receiverAddress | address | The address of the contract receiving the funds, implementing the IFlashLoanReceiver interface |
assets | address[] | The addresses of the assets being flash-borrowed |
amounts | uint256[] | The amounts amounts being flash-borrowed |
modes | uint256[] | Types of the debt to open if the flash loan is not returned: 0 -> Don't open any debt, just revert if funds can't be transferred from the receiver 1 -> Open debt at stable rate for the value of the amount flash-borrowed to the onBehalfOf address 2 -> Open debt at variable rate for the value of the amount flash-borrowed to the onBehalfOf address |
onBehalfOf | address | The address that will receive the debt in the case of using on modes 1 or 2 |
params | bytes | Variadic packed params to pass to the receiver as extra information |
referralCode | uint16 | Code used to register the integrator originating the operation, for potential rewards. 0 if the action is executed directly by the user, without any middle-man |
Implements the configuration methods for the Australis protocol
struct InitReserveInput {
address astTokenImpl;
address stableDebtTokenImpl;
address variableDebtTokenImpl;
uint8 underlyingAssetDecimals;
address interestRateStrategyAddress;
address underlyingAsset;
address treasury;
address incentivesController;
string underlyingAssetName;
string astTokenName;
string astTokenSymbol;
string variableDebtTokenName;
string variableDebtTokenSymbol;
string stableDebtTokenName;
string stableDebtTokenSymbol;
bytes params;
}
function batchInitReserve(
struct InitReserveInput[] input) external
Initializes reserves in batch
event ReserveInitialized(
address asset,
address astToken,
address stableDebtToken,
address variableDebtToken,
address interestRateStrategyAddress)
Emitted when a reserve is initialized.
Name | Type | Description |
---|---|---|
asset | address | The address of the underlying asset of the reserve |
astToken | address | The address of the associated astToken contract |
stableDebtToken | address | The address of the associated stable rate debt token |
variableDebtToken | address | The address of the associated variable rate debt token |
interestRateStrategyAddress | address | The address of the interest rate strategy for the reserve |
struct UpdateAstTokenInput {
address asset;
address treasury;
address incentivesController;
string name;
string symbol;
address implementation;
bytes params;
}
function updateAstToken(struct UpdateATokenInput input) external
Updates the astToken implementation for the reserve
event AstTokenUpgraded(address asset, address proxy, address implementation)
Emitted when an aToken implementation is upgraded
Name | Type | Description |
---|---|---|
asset | address | The address of the underlying asset of the reserve |
proxy | address | The astToken proxy address |
implementation | address | The new aToken implementation |
struct UpdateDebtTokenInput {
address asset;
address incentivesController;
string name;
string symbol;
address implementation;
bytes params;
}
function updateStableDebtToken(struct UpdateDebtTokenInput input) external
Updates the stable debt token implementation for the reserve
event StableDebtTokenUpgraded(
address asset,
address proxy,
address implementation)
Emitted when the implementation of a stable debt token is upgraded
Name | Type | Description |
---|---|---|
asset | address | The address of the underlying asset of the reserve |
proxy | address | The stable debt token proxy address |
implementation | address | The new astToken implementation |
function updateVariableDebtToken(struct UpdateDebtTokenInput input) external
Updates the variable debt token implementation for the asset
event VariableDebtTokenUpgraded(
address asset,
address proxy,
address implementation)
Emitted when the implementation of a variable debt token is upgraded
Name | Type | Description |
---|---|---|
asset | address | The address of the underlying asset of the reserve |
proxy | address | The variable debt token proxy address |
implementation | address | The new astToken implementation |
Proxy smart contract to get the price of an asset from a price source, with Flux Protocol smart contracts as primary option.
- If the returned price by a Flux aggregator is <= 0, the call is forwarded to a fallbackOracle
- Owned by the Australis governance system, allowed to add sources for assets, replace them and change the fallbackOracle.
function BASE_CURRENCY() external view returns (address)
function BASE_CURRENCY_UNIT() external view returns (uint256)
function getAssetPrice(address asset) external view returns (uint256)
function setAssetSources(address[] assets, address[] sources) external
External function called by the Australis governance to set or replace sources of assets
Name | Type | Description |
---|---|---|
assets | address[] | The addresses of the assets |
sources | address[] | The address of the source of each asset |
event AssetSourceUpdated(address asset, address source)
function setFallbackOracle(address fallbackOracle) external
Sets the fallbackOracle
- Callable only by the Australis governance
Name | Type | Description |
---|---|---|
fallbackOracle | address | The address of the fallbackOracle |
event FallbackOracleUpdated(address fallbackOracle)
Last modified 4mo ago