Step-by-Step Guide to Working With ReserveLending via Etherscan

Residual Token, Inc.
5 min readAug 18, 2023

--

PLEASE NOTE: These instructions have not been independently tested or reviewed for accuracy. Using these instructions to withdraw and repay borrows may not result in the user’s desired outcome and total loss of funds may occur. Please consult a technical expert before following these instructions, and use at your own risk.

Step-by-Step Guide to Repay Borrows from Compound via Etherscan

Step 1: Access the Etherscan Website

Open your web browser and navigate to the Etherscan website (https://etherscan.io/).

Step 2: Find the unToken Contract Address

Go to the unFederalReserve Education Center to find the specific unToken contract address for the asset you borrowed.

For example, if you borrowed DAI, you would need the unDAI contract address.

Step 3: Locate the `borrowBalanceStored` Function

On the Etherscan website, search for the unToken contract using the contract address found in previous step.

In the contract details page, look for a section called “Read Contract”

There, you’ll find a list of functions that you can interact with.

Step 3.1: Connect Your Wallet

Click on the “Connect to Web3” button on the Etherscan page. This will prompt you to connect your Ethereum wallet (e.g., MetaMask) to Etherscan.

Step 3.2. Read borrow amount

The `borrowBalanceStored` function might require a parameter, which is borrower’s wallet address. Since you’re checking your own borrowed amount, you’ll likely use your own Ethereum address for this parameter.

Step 3.3: View Borrowed Amount

After filling in the necessary parameter, click the “Query” button. This will fetch and display the borrowed amount associated with your address.

Step 3.4: Interpret the Result

The result displayed on the page will likely be a raw number. This number represents the borrowed amount in a token-specific format (e.g., wei for Ether or token units for ERC-20 tokens).

Copy this raw number. You will be asked to repay your loan.

Step 4. Repay Borrow

Look for a section called “Write Contract”. Then look for a function called `repayBorrow`. This is the function you’ll use to repay the borrowed asset. You might need to connect your wallet again

4.1. Select the repayBorrow Function

In the “Write Contract” section, locate the repayBorrow function and click on it.

4.2 Fill in the Function Parameters

The repayBorrow function might require parameters such as the amount you want to repay and possibly the borrower’s address (often set to your own address).

Enter the amount you copied from `borrowBalanceStored` in the appropriate field. Make sure you have this amount available in your wallet.

Step 5: Confirm and Send Transaction

Review the details you’ve entered, ensuring that everything is accurate.

Click the “Write” button to initiate the transaction.

Step 6: Confirm the Transaction in Your Wallet

A pop-up from your wallet (e.g., MetaMask) will appear, showing the transaction details. Review the gas fees and other details.

Confirm the transaction in your wallet by clicking “Confirm” or “Send.”

Step 7: Wait for Confirmation

The transaction will be broadcasted to the Ethereum network. Wait for it to be mined and confirmed. You can track the transaction status on Etherscan.

Step 8: Verify Repayment

Once the transaction is confirmed, you should see a confirmation message on Etherscan.

You can also check your wallet balance to ensure that the borrowed amount has been successfully repaid.

Step-by-Step Guide to Withdraw Supply from Compound via Etherscan

Step 1: Access the Etherscan Website

Open your web browser and navigate to the Etherscan website (https://etherscan.io/).

Step 2: Find the unToken Contract Address

Go to the unFederalReserve Education Center to find the specific unToken contract address for the asset you borrowed.

For example, if you borrowed DAI, you would need the unDAI contract address.

Step 3: Locate the `balanceOf` Function

On the Etherscan website, search for the unToken contract using the contract address found in previous step.

In the contract details page, look for a section called “Read Contract”. There, you’ll find a list of functions that you can interact with.

Look for a function called `balanceOf`. This is the function you’ll use to view your supplied balance.

Step 3.1: Connect Your Wallet

Click on the “Connect to Web3” button on the Etherscan page. This will prompt you to connect your Ethereum wallet (e.g., MetaMask) to Etherscan.

Step 3.2: Select the balanceOf Function

In the “Interact with Contract” section, locate the balanceOf function and click on it.

Step 3.3: Fill in the Function Parameters

The `balanceOf` function might require a parameter, which is usually the address of the account you want to check. Enter your Ethereum address for this parameter.

Step 3.4: View Supplied Amount

After filling in the necessary parameter, click the “Query” button. This will fetch and display the amount you’ve supplied to the unFederalReserve protocol using the specific asset.

Copy this value, you will need for the next steps.

Step 3.5: Interpret the Result

The result displayed on the page will likely be a raw number. This number represents the supplied amount in a token-specific format (e.g., wei for Ether or token units for ERC-20 tokens).

Step 4: Locate the `redeem` Function

In the contract details page, look for a section called “Write Contract” There, you’ll find a list of functions that you can interact with.

Look for a function called `redeem`. This is the function you’ll use to withdraw your supplied assets. You might need to connect your wallet again

Step 4.1: Select the redeem Function

In the “Write Contract” section, locate the redeem function and click on it.

Step 4.2: Fill in the Function Parameters

The redeem function might require parameters such as the amount you want to withdraw. Enter the amount of assets you copied in Step 3.4 to withdraw in the appropriate field.

Step 5: Confirm and Send Transaction

Review the details you’ve entered, ensuring that everything is accurate.

Click the “Write” button to initiate the transaction.

Step 6: Confirm the Transaction in Your Wallet

A pop-up from your wallet (e.g., MetaMask) will appear, showing the transaction details. Review the gas fees and other details.

Confirm the transaction in your wallet by clicking “Confirm” or “Send.”

Step 7: Wait for Confirmation

The transaction will be broadcasted to the Ethereum network. Wait for it to be mined and confirmed. You can track the transaction status on Etherscan.

Step 8: Verify Withdrawal

Once the transaction is confirmed, you should see a confirmation message on Etherscan.

You can also check your wallet balance to ensure that the withdrawn assets have been successfully transferred to your wallet.

--

--

Residual Token, Inc.

We're a technology company specializing in the development and marketing of DeFi software for the global blockchain ecosystem.