Module 7 - About Lending/Borrowing Adapters
Adapters for Lending/Borrowing
This Module is Useful for Understanding the Benqi Adapter which is important for Learning about Lending/Borrowing Adapters. Refer this Repository for Smart Contracts.
Benqi Adapter
The BenqiSupply
Smart Contract Tutorial! This Guide will help you Understand the functionality of the BenqiSupply
Contract, its Purpose, and how to Interact with it. By the end of this Tutorial, you will have a Good Understanding of how to Supply funds to Benqi
using this Contract.
-
Contract Structure - The
BenqiSupply
Contract is Designed to facilitate the Supply of funds to the Benqi Protocol on the Avalanche Blockchain. This Contract leverages theRouterIntentEoaAdapterWithoutDataProvider
from the Router Protocol, ensuring Seamless Integration and Interaction with Benqi.a) IBenqiPool: Interface for the Benqi Pool.
b) RouterIntentEoaAdapterWithoutDataProvider and EoaExecutorWithoutDataProvider: Contracts from the Router Protocol.
c) Errors: Utility Contract for Standardized Error messages.
d) IERC20 and SafeERC20: Interface and Library for ERC20 Token Operations.
e) SafeMath: Library for Safe Mathematical Operations.
f) qiToken: The address of the QiToken (Benqi’s interest-bearing Token) Contract.
-
Functions -
a) constructor() - The Constructor initializes the Contract with the addresses of the Native Token, Wrapped Native Token, and QiToken.
b) name() - Returns the name of the Contract.
c) execute() - Executes the Supply Operation by Parsing the Input Data, Transferring the required Amount of Tokens, and Calling the
_benqiSupply
function.d) _benqiSupply() - Handles the actual Supply of funds to the Benqi Protocol.
e) parseInputs() - Parses the Input Data.
f) ExecutionEvent() - Emitted when an execution Occurs.
-
Usage - To use the
DexSpanAdapter
, Deploy the Contract with the required Parameters --
Deploying the Contract - To Deploy the
BenqiSupply
Contract, you will need to Provide the addresses of the Native Token, Wrapped Native Token, and QiToken. -
Supplying Funds - To Supply funds to
Benqi
using this Contract, call theexecute
function with the appropriate Input Data, including the Asset, Recipient, and Amount. For Example -
-
Conclusion
The BenqiSupply
Contract Simplifies the Process of Supplying funds to the Benqi Protocol. By Understanding and following this Tutorial, you should be able to Interact with the Contract effectively and Leverage its functionality to Manage your Assets on Benqi.