Technical proposal to Introduce USDRIF Token in RIF on Chain Protocol

I´m submitting this technical proposal for the changes in the proposal to introduce USDRIF Token in RIF on Chain Protocol, 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: 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:

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.

:heavy_check_mark: This is the pull request to add these changes to the repository.

:heavy_check_mark: The new proxy contract for the StableTokenV2.sol already deployed in mainnet will be this 0x3A15461d8AE0f0Fb5fA2629e9dA7D66A794a6E37

:heavy_check_mark: The new implementation of the StableTokenV2.sol contract already deployed in mainnet will be this 0xaBb96fC7D16bbBAE444E913cC6729694A4A4d69f

:heavy_check_mark: The new swap feature will be the TokenMigrator.sol contract already deployed in mainnet on 0x4AC78A51F67bdbC9fCb813D041914B2De37E87D7

:heavy_check_mark: 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:

And here is the second upgrade:

:heavy_check_mark: The change contract to make the implementation change already deployed in mainnet would be this 0xb58F353cD811c883b16912C910B2873C45837664

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.

  • The USDRIF audit, which was performed by Quill and did not include the Flux Capacitor, will be submitted soon.

1 Like

:mega: Call to MOC holders: This proposal is being voted on. How to vote Tutorial.

:mega: Llamado a los MOC holders: Esta propuesta se está votando. Tutorial de cómo votar.