CompoundV2Lending

Git Source

Inherits: ERC20Selectors, Masks

Lending base contract that wraps multiple Compound V2 lender types. Most effective for Venus

State Variables

NATIVE_TRANSFER_FAILED

bytes4 private constant NATIVE_TRANSFER_FAILED = 0xf4b3b1bc

Functions

_borrowFromCompoundV2

Borrows from Compound V2 lending pool

Note this is for Venus Finance only as other Compound forks do not have this feature

Note: calldata-offset-table:

Offset Length (bytes) Description
0 20 underlying
20 16 amount
36 20 receiver
56 20 cToken
function _borrowFromCompoundV2(uint256 currentOffset, address callerAddress) internal returns (uint256);

Parameters

Name Type Description
currentOffset uint256 Current position in the calldata
callerAddress address Address of the caller

Returns

Name Type Description
<none> uint256 Updated calldata offset after processing

_withdrawFromCompoundV2

Withdraws from Compound V2 lending pool

Supports both transferFrom and redeemBehalf modes

Note: calldata-offset-table:

Offset Length (bytes) Description
0 20 underlying
20 16 amount
36 20 receiver
56 20 cToken
function _withdrawFromCompoundV2(uint256 currentOffset, address callerAddress) internal returns (uint256);

Parameters

Name Type Description
currentOffset uint256 Current position in the calldata
callerAddress address Address of the caller

Returns

Name Type Description
<none> uint256 Updated calldata offset after processing

_depositToCompoundV2

Deposits to Compound V2 lending pool

Note: Some Compound V2 forks might not have this feature and need a separate function. Supports both native and ERC20 tokens. Zero amount uses contract balance.

Note: calldata-offset-table:

Offset Length (bytes) Description
0 20 underlying
20 16 amount
36 20 receiver
56 20 cToken
function _depositToCompoundV2(uint256 currentOffset) internal returns (uint256);

Parameters

Name Type Description
currentOffset uint256 Current position in the calldata

Returns

Name Type Description
<none> uint256 Updated calldata offset after processing

_repayToCompoundV2

Repays debt to Compound V2 lending pool

Supports both native and ERC20 tokens. Zero amount uses contract balance. Max amount (0xffffffffffffffffffffffffffff) repays minimum of contract balance and user debt.

Note: calldata-offset-table:

Offset Length (bytes) Description
0 20 underlying
20 16 amount
36 20 receiver
56 20 cToken
function _repayToCompoundV2(uint256 currentOffset) internal returns (uint256);

Parameters

Name Type Description
currentOffset uint256 Current position in the calldata

Returns

Name Type Description
<none> uint256 Updated calldata offset after processing

results matching ""

    No results matching ""