A string of the asset to borrow (must be a supported underlying asset).
A string, number, or BigNumber
object of the amount of an asset to borrow. Use the mantissa boolean in
the options parameter to indicate if this value is scaled up (so there
are no decimals) or in its natural scale.
Returns an Ethers.js transaction object of the borrow transaction.
Redeems the user's Ethereum asset from the Compound Protocol.
A string of the asset to redeem, or its cToken name.
A string, number, or BigNumber
object of the amount of an asset to redeem. Use the mantissa boolean in
the options parameter to indicate if this value is scaled up (so there
are no decimals) or in its natural scale. This can be an amount of
cTokens or underlying asset (use the asset parameter to specify).
Returns an Ethers.js transaction object of the redeem transaction.
Repays a borrowed Ethereum asset for the user or on behalf of another Ethereum address.
A string of the asset that was borrowed (must be a supported underlying asset).
A string, number, or BigNumber
object of the amount of an asset to borrow. Use the mantissa boolean in
the options parameter to indicate if this value is scaled up (so there
are no decimals) or in its natural scale.
Returns an Ethers.js transaction object of the repayBorrow or repayBorrowBehalf transaction.
Supplies the user's Ethereum asset to the Compound Protocol.
A string of the asset to supply.
A string, number, or BigNumber
object of the amount of an asset to supply. Use the mantissa boolean in
the options parameter to indicate if this value is scaled up (so there
are no decimals) or in its natural scale.
Explicitly prevent this method from attempting an
ERC-20 approve transaction prior to sending the mint transaction.
Returns an Ethers.js transaction object of the supply transaction.
Borrows an Ethereum asset from the Compound Protocol for the user. The user's address must first have supplied collateral and entered a corresponding market.
const compound = new Compound(window.ethereum); (async function() { const daiScaledUp = '32000000000000000000'; const trxOptions = { mantissa: true }; console.log('Borrowing 32 Dai...'); const trx = await compound.borrow(Compound.DAI, daiScaledUp, trxOptions); console.log('Ethers.js transaction object', trx); })().catch(console.error);