Lending on Compound

Getting the Wrap Calldata from Compound:

In order to lend or withdraw your components on Compound, you will need to call the wrap (wrapWithEther) or unwrap (unwrapWithEther) functions on the WrapModule. Compound interacts directly with Ether, so wrapWithEther and unwrapWithEther are needed when depositing or withdrawing WETH in the SetToken.

Select examples:

This is an example of what to pass into the wrap function for WBTC to cWBTC.

/**
 * MANAGER-ONLY: Instructs the SetToken to wrap an underlying asset into a wrappedToken via a specified adapter.
 *
 * @param _setToken             Instance of the SetToken
 * @param _underlyingToken      Address of the component to be wrapped
 * @param _wrappedToken         Address of the desired wrapped token
 * @param _underlyingUnits      Quantity of underlying units in Position units
 * @param _integrationName      Name of wrap module integration (mapping on integration registry)
 */
function wrap(
    0xYourSetTokenAddress,
    0x2260fac5e5542a773aa44fbcfedf7c193bc2c599,
    0xccf4429db6322d5c611ee964527d42e5d685dd6a,
    3000,
    CompoundWrapAdapter
) 

This is an example of what to pass into the unwrap function for cETH to WETH.

/**
 * MANAGER-ONLY: Instructs the SetToken to unwrap a wrapped asset collateralized by Ether into Wrapped Ether. Since
 * external protocol will send back Ether that Ether must be Wrapped into WETH in order to be accounted for by SetToken.
 *
 * @param _setToken                 Instance of the SetToken
 * @param _wrappedToken             Address of the component to be unwrapped
 * @param _wrappedUnits             Quantity of wrapped tokens in Position units
 * @param _integrationName          ID of wrap module integration (mapping on integration registry)
 */
function unwrapWithEther(
    0xYourSetTokenAddress,
    0x4ddc2d193948926d02f9b1fe9e1daa0718270ed5,
    1000000000000000000,
    CompoundWrapAdapter
)

Last updated