Articles on: Blockchain How-To

Paying RMM Debt from another address

You can repay the funds borrowed on the RMM v3 from any Gnosis Chain address. The RMM interface doesn't allow this at the moment, so all you have to do is interact directly with the smart Contract on the blockchain.

We will :

Authorize the RMM to use your stablecoins.

Connect to the RMM v3 Smart Contract.

Enter the amount we want to refund and the address that will benefit from the transfer.

Managing stablecoins Allowance

If this is the first time your address interacts with the RMM contract, you need to authorize the RMM contract to use your tokens. This involves a simple interaction with either the wxDAI contract or the USDC contract, depending on the stablecoin you plan to use for repayment.

Numbers in the blockchain must be in UINT (unsigned integer), meaning that USDC Tokens have 6 decimals, while wxDAI have 18 decimals.

If you want to repay:
1 USDC you will have to put 1000000
1.5 USDC will be 1500000
1 wxDAI = 1000000000000000000
1.5 wxDAI = 1500000000000000000

For example, if we want to repay 100 wxDAI, the first step is to go to Gnosis Scan to create our interaction with the Blockchain on the wxDAI contract address.
For USDC, you can find the USDC contract address here.
We select Contract and Write Contract. Don´t forget to click "Connect to Web3" to connect your wallet.

Your wallet may not connect on the first attempt, so you could have to redo the operation to ensure that your Gnosis address appears in green on the site.

Next, we click the approve function.
The first line is the spender, the address we authorize to use our tokens. Here is the RMM Contract Address: 0xFb9b496519fCa8473fba1af0850B6B8F476BFdB3
The second line is the amount. In the case of 100 wxDAI, we will put 100000000000000000000 (remember the 18 decimals for wxDAI)

Click Write and validate the transaction on your wallet. Please note that no funds have left our address yet. We just authorized the RMM contract to use our tokens.

Reaching the RMM Smart Contract

The RMM v3 Smart Contract is: 0xFb9b496519fCa8473fba1af0850B6B8F476BFdB3

We use again the Gnosis block explorer to access it easily:

DeFi Real World Asset

Then click on Contract and Write as Proxy :

Click here to go directly to this page.

This page allows you to interact directly with the RMM Smart Contract. Like any interaction on the blockchain, you need to connect your wallet (Click on Connect to Web3).

Interact with Smart Contract

Function 15 is used to repay loans on the RMM Smart Contract, "repay." In our example, we'll take a random address that borrowed funds from the RMM and repay 0.1 WXDAI.

There are four fields to fill in before validating the transaction on our wallet.

asset (address)

This corresponds to the currency in which your debt is. If your debt is in USDC, you must indicate this smart contract: 0xddafbb505ad214d7b80b1f830fccc89b60fb7a83, and if your debt is in WXDAI, this smart contract: 0xe91d153e0b41518a2ce8dd3d7944fa863463a97d.

In our example, it's 0xe91d153e0b41518a2ce8dd3d7944fa863463a97d

amount (uint256)

This is the amount to be reimbursed, which must be in uint256 format. Note that this format does not accept commas and requires 18 decimal places for WXDAI debt and 6 decimal places for USDC debt.

In our example, 0.1 becomes 0100000000000000000

interestRateMode (uint256)

Enter the digit "2".

onBehalfOf (address)

This is the address for which we are seeking to repay the loan.

All you have to do is validate the operation in your wallet, and the transaction will be completed.

Updated on: 26/06/2024