# Technical proposal to Introduce USDRIF Token in RIF on Chain Protocol

**URL:** <https://forum.moneyonchain.com/t/technical-proposal-to-introduce-usdrif-token-in-rif-on-chain-protocol/375>\
**Category:** MOC Improvement Proposals\
**Created:** [September 16, 2023, 5:02pm UTC](https://forum.moneyonchain.com/t/technical-proposal-to-introduce-usdrif-token-in-rif-on-chain-protocol/375 "2023-09-16T17:02:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![henrik](https://avatars.discourse-cdn.com/v4/letter/h/ba9def/32.png) [@henrik](https://forum.moneyonchain.com/u/henrik)\
**Post date:** [September 16, 2023, 5:02pm UTC](https://forum.moneyonchain.com/t/technical-proposal-to-introduce-usdrif-token-in-rif-on-chain-protocol/375/1 "2023-09-16T17:02:21Z")

</div>

I´m submitting this technical proposal for the changes in the proposal to [introduce USDRIF Token in RIF on Chain Protocol](https://forum.moneyonchain.com/t/proposal-to-introduce-usdrif-token-in-rif-on-chain-protocol/374), which aims to enhance the stability and recognition of the RDOC stablecoin within the ecosystem by changing its name to **USDRIF**.

## Implementation

To implement this enhancement, as the actual RDOC token is not upgradable, it will be migrated to a new token, USDRIF.

> ⚠ Warning: some technical/coding knowledge is necessary to fully understand this document.

Taking advantage of this situation, for `StableTokenV2.sol` we thought it would be a good opportunity, given the decoupled nature of this contract, to modernize the code to the latest trends and technologies.

- To begin with, it’s under a new subfolder called **hardhat** with an independent setup, allowing the use of more recent versions of _NodeJS_, _OpenZeppelin_ and _Hardhat_ itself, to leverage the advances those frameworks made in these years.
- Consequently, it allows for example to use a more enriched version of roles for the Token (_OZ AccessControl_), a more efficient upgrade strategy (_ **UUPS** _) and also a newer version of solidity itself ( **0.8.16** ) among other things.

This opens new opportunities for many changes yet to come on the protocol and fosters dev community participation.

The upgrade will introduce a new **swap functionality** in the RIF on Chain protocol and dApp to allow users to exchange their existing RDOC stablecoin tokens for USDRIF in a seamless way. It will be required that you swap your RDOC balance for USDRIF with an exchange rate of **1 RDOC = 1 USDRIF**. You will not be charged any protocol fee, you’ll just need to pay for the network transaction fees to complete the swap. The swap transaction will exchange your total RDOC balance at once.

Here are the details on the swap functionality:

 ![](https://canada1.discourse-cdn.com/flex035/uploads/moneyonchain/original/1X/af3204921528a3eaa23a7f104f43feab8659191e.png)

After this proposal is approved and applied, it will no longer be possible to mint/redeem RDOC. You will be able to transfer them though, and there is no imposed deadline for the swap to be completed.

The IPFS web dApp will be updated with the new USDRIF asset. You will no longer be able to see your RDOC balance in the dApp which will include the new swap feature.

✔ [This is the pull request](https://github.com/money-on-chain/RDOC-Contract/pull/58) to add these changes to the repository.

✔ The new proxy contract for the `StableTokenV2.sol` already deployed in `mainnet` will be this [`0x3A15461d8AE0f0Fb5fA2629e9dA7D66A794a6E37`](https://rootstock.blockscout.com/address/0x3A15461d8AE0f0Fb5fA2629e9dA7D66A794a6E37?tab=contract)

✔ The new implementation of the `StableTokenV2.sol` contract already deployed in `mainnet` will be this [`0xaBb96fC7D16bbBAE444E913cC6729694A4A4d69f`](https://rootstock.blockscout.com/address/0xaBb96fC7D16bbBAE444E913cC6729694A4A4d69f?tab=contract)

✔ The new swap feature will be the `TokenMigrator.sol` contract already deployed in `mainnet` on [`0x4AC78A51F67bdbC9fCb813D041914B2De37E87D7`](https://rootstock.blockscout.com/address/0x4AC78A51F67bdbC9fCb813D041914B2De37E87D7?tab=contract)

✔ All the contracts that use the `StableToken` variable will be upgraded. Those are:

- MoC.sol
- MoCConnector.sol
- MoCExchange.sol
- MocState.sol
- MoCSettlement.sol

For each of them, a new function is added `function migrateStableToken(address newStableTokenAddress_)` for the migration purpose and an event is emitted when it happens `event StableTokenMigrated(address oldStableTokenAddress_, address newStableTokenAddress_)`.

To avoid re-executing this function, it should not be alive in the protocol after the migration ends. To achieve this, in the change contract there are two upgrades. First, it will upgrade them to a new implementation that includes the migration logic, and later it will upgrade them again to the previous one, restoring in effect the same protocol logic, with just the new stable token, USDRIF.

Here is the first upgrade:

 ![](https://canada1.discourse-cdn.com/flex035/uploads/moneyonchain/original/1X/2ac831d1ef1171425a91f5887d56fc07176c56f8.png)

And here is the second upgrade:

 ![](https://canada1.discourse-cdn.com/flex035/uploads/moneyonchain/original/1X/08c78daa277774ba2da3a314968371978b7aa503.png)

✔ The `change contract` to make the implementation change already deployed in `mainnet` would be this [`0xb58F353cD811c883b16912C910B2873C45837664`](https://rootstock.blockscout.com/address/0xb58F353cD811c883b16912C910B2873C45837664?tab=contract)

We invite all community members to participate in the vote on this proposal for the RIF on Chain protocol.

Henrik Jondell

#### _Disclaimer:_

The USDRIF token has been under development for several months with support from the IOV Labs team and other Rootstock contributors. However, due to certain public knowledge events, the USDRIF token was postponed to prioritize the safety and security of the RIF on Chain protocol.

As a result, two different audits were conducted:

- The Flux Capacitor audit, which can be accessed [here](https://raw.githubusercontent.com/money-on-chain/Audits/master/Shared/RIF_On_Chain_2023_08.pdf).

- The USDRIF audit, which was performed by [Quill](https://www.quillaudits.com/smart-contract-audit) and did not include the Flux Capacitor, will be submitted soon.

---

<div class="post-metadata">

**Author:** ![jbokser](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.moneyonchain.com/jbokser/32/228_2.png) [@jbokser](https://forum.moneyonchain.com/u/jbokser)\
**Post date:** [September 18, 2023, 8:59pm UTC](https://forum.moneyonchain.com/t/technical-proposal-to-introduce-usdrif-token-in-rif-on-chain-protocol/375/2 "2023-09-18T20:59:23Z")

</div>

📣 **Call to MOC holders** : [This proposal](https://forum.moneyonchain.com/t/proposal-to-introduce-usdrif-token-in-rif-on-chain-protocol/374) is being voted on. [How to vote Tutorial](https://moneyonchain.com/blog/tutorial-how-to-vote-in-money-on-chain-governance/).

📣 **Llamado a los MOC holders** : [Esta propuesta](https://forum.moneyonchain.com/t/proposal-to-introduce-usdrif-token-in-rif-on-chain-protocol/374) se está votando. [Tutorial de cómo votar](https://moneyonchain.com/es/blog/tutorial-votar-gobernanza-money-on-chain/).

---

<div class="post-metadata">

**Author:** ![Zecke](https://avatars.discourse-cdn.com/v4/letter/z/d6d6ee/32.png) [@Zecke](https://forum.moneyonchain.com/u/Zecke)\
**Post date:** [September 26, 2023, 6:48pm UTC](https://forum.moneyonchain.com/t/technical-proposal-to-introduce-usdrif-token-in-rif-on-chain-protocol/375/3 "2023-09-26T18:48:47Z")

</div>

Audit report by Quill is shared below

> **[RIF\_On\_Chain\_2023\_09.pdf](https://raw.githubusercontent.com/money-on-chain/Audits/master/Shared/RIF_On_Chain_2023_09.pdf)**
>
> 4.62 MB

---

<div class="post-metadata">

**Author:** ![jbokser](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.moneyonchain.com/jbokser/32/228_2.png) [@jbokser](https://forum.moneyonchain.com/u/jbokser)\
**Post date:** [September 26, 2023, 8:58pm UTC](https://forum.moneyonchain.com/t/technical-proposal-to-introduce-usdrif-token-in-rif-on-chain-protocol/375/4 "2023-09-26T20:58:46Z")

</div>

📣 The voting process is over:

- 36.27% of the MOC tokens total supply participated in the vote.
- 100% of the participants voted in favor.
- No one voted against the proposal.
- The change was successfully implemented
