Supply
The supply function transfers an asset into the protocol, which begins accumulating interest based on the current Supply Rate for the asset. The user receives a quantity of qTokens equal to the underlying tokens supplied, divided by the current Exchange Rate.
function supply(address qToken, uint underlyingAmount) external payable returns (uint);
- msg.sender: The account which shall supply the asset, and own the minted qTokens.
- msg.value: (BNB only) The amount of BNB to be supplied, in wei.
- qToken: The address of the qToken market to supply.
- underlyingAmount: The amount of the asset to be supplied, in units of the underlying asset.
- RETURN: The qToken amount minted.
// BNB
Qore qore = Qore(<qoreAddress>);
uint qBNBAmount = qore.supply{ value: <underlyingAmount> }(<qBNBAddress>, <underlyingAmount>);
// Others
Qore qore = Qore(<qoreAddress>);
uint qTokenAmount = qore.supply(<qTokenAddress>, <underlyingAmount>);
// BNB
const qore = await ethers.getContractAt(<qoreABI>, <qoreAddress>);
const qBNBAmount = await qore.supply(<qBNBAddress>, <underlyingAmount>, { value: <underlyingAmount> });
// Others
const qore = await ethers.getContractAt(<qoreABI>, <qoreAddress>);
const qTokenAmount = await qore.supply(<qTokenAddress>, <underlyingAmount>);
Last modified 1yr ago