Where do I get pooladdress and reserve address when calling the borrow method?
antiwinter opened this issue · comments
Question
To borrow via API V3, the sample code is documented as below.
import { Pool, InterestRate } from '@aave/contract-helpers';
const pool = new Pool(provider, {
POOL: poolAddress,
WETH_GATEWAY: wethGatewayAddress,
});
/*
- @param `user` The ethereum address that repays
- @param `reserve` The ethereum address of the reserve on which the user borrowed
- @param `amount` The amount to repay, or (-1) if the user wants to repay everything
- @param `interestRateMode` // Whether the borrow will incur a stable (InterestRate.Stable) or variable (InterestRate.Variable) interest rate
- @param @optional `onBehalfOf` The ethereum address for which user is repaying. It will default to the user address
*/
const txs: EthereumTransactionTypeExtended[] = pool.Borrow({
user,
reserve,
amount,
interestRateMode,
onBehalfOf,
});
How can I get the poolAddress
and reserve
(The ethereum address of the reserve on which the user borrowed)? I didn't find any relevant members in the array returned by getReservesHumanized()
or formatUserSummaryAndIncentives()
. I think this should be more clearly documented.
Thanks for the feedback, we can definitely add some more documentation on this.
You can find the Pool
address for each market in the aave-address-book (also available as npm package), or in the docs. The reserve
is the address of the underlying token, which is the underlyingAsset
field returned in the functions you mention.
Brilliant, thank you 😁