Intents
Transactions vs Intents
The de-facto way to interact with Ethereum is to craft and sign a transaction. A Transaction is a structured message which contains the necessary resolute for Ethereum Virtual Machine(EVM) to understand and execute the state changes. To fulfil a particular resolute in DeFi requires knowledge of the complex working of the space. And this complexity leads to inefficiency as users interact with the blockchain without sufficient context.
Set(Fixed) Route that transactions use eliminate the possibility of finding a better alternative route to achieve the end outcome. In contrast, Intents enable solvers to scan all available routes and use the best one to achieve higher capital efficiency.
What is an Intent?
INFO
An Intent is a signed resolute which lets the user specify the inputs and the desired end-outcome where protocols/solvers can use any set of transactions to the outcome.
MethLab works on app-specific Intents. Lenders publishes their Intents on-chain to lend the assets that are available to be matched with borrowers.
Each Intent consists of the following
struct Intent {
uint256 strikePrice;
uint256 interestRate;
uint256 duration;
}
// Also check IntentCollection Struct below.
These invariant parameters make up for a Quote.
Intent Space
On an abstracted level, a borrower has its own intent to borrow an arbitrary asset against an arbitrary collateral. Intent Space is where Lenders' Intents and the Borrowers' Intents reside along with their respective lend and borrow parameters that make up the super-set of the Intent Space.
A Matching Filter is responsible for matching the intents of the lenders and the borrowers.
MethLab allows Borrowers to select one/multiple Lender Intents without manually searching for the best possible Quote based on highest Reserve Price offered per Bucket from the Intent Space. This saves borrowers' time and leads to a better user experience for all the Borrowers.
Intent Collection
An Intent Collection is an array of Intents that a Lender adds to their Vaults. Once a Vault is created, an Intent Collection must be created to write and publish Intents. A collection consists of the following -
collToken
- the address of the collateral tokenborrowToken
- the address of the borrow tokenminSingleLoanAmt
- the minimum loan amount that borrower must borrowmaxSingleLoanAmt
- the maximum loan amount that borrower can borrowexpiresAt
- the time of collection expiryisEnabled
- the validity of collectionintents
- the array of intents
You can find the IntentCollection Struct in DataTypes.sol.
struct IntentCollection {
address collToken;
address borrowToken;
uint256 minSingleLoanAmt;
uint256 maxSingleLoanAmt;
uint256 expiresAt;
bool isEnabled;
Intent[] intents;
}
Lenders can simply write intents using the Dashboard and the Intent Collection logic is abstracted away and individual Intents remain. Developers can look into how to create Collections here.