Action
Action.sol
is a module contract that handles various user actions within the Unlockd Protocol, such as borrowing, repaying, and unlocking assets.
Key functions:
Returns the details of a loan given its ID.
Parameters:
loanId
: The ID of the loan to retrieve.
Returns the amount required to repay a loan.
Parameters:
loanId
: The ID of the loan to calculate the repayment amount for.
Allows users to borrow assets using the specified loan and collateral. It validates the signature, updates the loan state, and performs the necessary actions to borrow the assets.
Parameters:
amount
: The amount to borrow.
assets
: An array of assets to be used as collateral.
signAction
: The signed action data.
sig
: The EIP-712 signature for the borrow operation.
Allows users to repay a loan and unlock assets if the health factor is above 1. It validates the signature, updates the loan state, transfers the repayment amount, and unlocks the assets if the health factor is above 1 or the total amount repaid.
Parameters:
amount
: The amount to repay.
signAction
: The signed action data.
sig
: The EIP-712 signature for the repay operation.
Signature
signAction
(type: DataTypes.SignAction
), it contains the following fields:
signAction
(type: DataTypes.SignAction
), it contains the following fields:loan
(type: DataTypes.SignLoanConfig
): The loan configuration data, including the loan ID, aggregated loan price, LTV, liquidation threshold, total assets, nonce, and deadline.
assets
(type: bytes32[]
): An array of assetIDs involved in the action.
underlyingAsset
(type: address
): The address of the underlying asset for the loan.
nonce
(type: uint256
): The nonce value is used to ensure the uniqueness of the signature and prevent replay attacks.
deadline
(type: uint256
): The deadline timestamp until which the signature is considered valid.
sig
(type: DataTypes.EIP712Signature
), it contains the following fields:
sig
(type: DataTypes.EIP712Signature
), it contains the following fields:v
(type: uint8
): The recovery ID of the signature.
r
(type: bytes32
): The first 32 bytes of the signature.
s
(type: bytes32
): The second 32 bytes of the signature.
deadline
(type: uint256
): The deadline timestamp until which the signature is considered valid.
Last updated