Launch new Mento Stablecoins [JPY, GBP, AUD, CAD, CHF, NGN, ZAR]

Hey folks, we will soon put out a proposal to enable the needed oracles for the launch of two new Mento stablecoins ($cJPY and $cNGN). This is a follow-up to CGP 177 (Adding oracles to support GBP, AUD, CAD, CHF, ZAR stablecoins) as the Chainlink feeds for JPY and NGN were not available at the time.

This post provides an overview of the transactions to whitelist the Chainlink relayer contracts that will report the rates needed for these new stablecoins. As with previous proposals, the Celo community will have the opportunity to verify these transactions. In preparation for the upcoming CGP, we have completed the following steps:

  • Tested the proposal on Alfajores
  • Simulated the proposal on a fork of Celo Mainnet and conducted tests against this fork

Before we dive into the details of each section and transaction, we recommend setting up celocli to follow along. For those technically inclined, you can find everything described here in our deployment tooling repository. For verifying the addresses included in the proposal, please refer to the Appendix at the bottom for helpful tips.

1. Whitelisting and configuring of Chainlink Relayers in SortedOracles

The ChainlinkRelayer transmits rate feed data from a single Chainlink price feed or an aggregation of multiple Chainlink price feeds to the SortedOracles contract.

This contract can aggregate multiple price feeds to provide derived rate feeds to the protocol. This is necessary because it is more efficient for Oracle providers to report FX rates against the dollar and crypto-asset rates against the dollar, rather than providing all possible combinations.

For example, Chainlink reports the JPY/USD rate, but it does not directly provide the CELO/JPY rate, which is needed for gas payments in a JPY stable token. However, by using both the JPY/USD and CELO/USD rates, the following path can be derived:

CELO/USD * inverse(JPY/USD) = CELO/JPY.

A separate ChainlinkRelayer instance will be deployed for each required rate feed.

Each token requires a total of 5 transactions, and they all follow the same pattern:

  1. Whitelist the CELO/XXX relayer (for gas payments purposes)
  2. Set the report expiry time for the CELO/XXX pair
  3. Whistelist the XXX/USD relayer
  4. Set the report expiry time for the XXX/USD pair
  5. Set the equivalent token for XXX to be CELO/XXX (for gas payments purposes)

JPY Relayers

TX#0 - whitelist CELO/JPY Relayer in SortedOracles - addOracle()

  • Verify the SortedOracleProxy address
  • Verify the Rate Feed Identifier
    • address(uint160(uint256(keccak256(abi.encodePacked("relayed:CELOJPY")))));
    • Should match: 0xd5800BbeC4Fb58b549C8de50635654E919c3Cd5D
  • Verify the ChainlinkRelayer address: 0x522D100Ce28b150fBfcB90551d8822789ff53886

TX#1 - configure CELO/JPY token report expiry time in SortedOracles - setTokenReportExpiry()

  • Verify the Rate Feed Identifier: 0xd5800BbeC4Fb58b549C8de50635654E919c3Cd5D
  • Verify Report Expiry Seconds: 360 (6 minutes)

TX#2 - whitelist JPY/USD Relayer in SortedOracles - addOracle()

  • Verify the Rate Feed Identifier
    • address(uint160(uint256(keccak256(abi.encodePacked("relayed:JPYUSD")))));
    • Should match: 0xFDE35B45cBd2504FB5dC514F007bC2DE27034274
  • Verify the ChainlinkRelayer address: 0x1327A32fA7e3a0C3c0a5828D4f3ff16CE9E13Ee9

TX#3 - Configure JPY/USD token report expiry time in SortedOracles - setTokenReportExpiry()

  • Verify the Rate Feed Identifier: 0xFDE35B45cBd2504FB5dC514F007bC2DE27034274
  • Verify Report Expiry Seconds: 360

TX#4 - Configure equivalent token for JPY rate in SortedOracles - setEquivalentToken()

  • Verify the token address: 0xc45eCF20f3CD864B32D9794d6f76814aE8892e20 (StableTokenJPYProxy)
  • Verify the Rate Feed Identifier: 0xd5800BbeC4Fb58b549C8de50635654E919c3Cd5D

NGN Relayers

TX#5 - whitelist CELO/NGN Relayer in SortedOracles - addOracle()

  • Verify the Rate Feed Identifier
    • address(uint160(uint256(keccak256(abi.encodePacked("relayed:CELONGN")))));
    • Should match: 0xd9D1A7FAA5deFe7E0301Ac5363E6ca18eB78c9D7
  • Verify the ChainlinkRelayer address: 0x75Ba8f6855e54F36282067b185f2b9c0baC8A588

TX#6 - Configure CELO/NGN token report expiry time in SortedOracles - setTokenReportExpiry()

  • Verify the Rate Feed Identifier: 0xd9D1A7FAA5deFe7E0301Ac5363E6ca18eB78c9D7
  • Verify Report Expiry Seconds: 360

TX#7 - whitelist NGN/USD Relayer in SortedOracles - addOracle()

  • Verify the Rate Feed Identifier
    • address(uint160(uint256(keccak256(abi.encodePacked("relayed:NGNUSD")))));
    • Should match: 0xC13D42556f1baeab4a8600C735afcd5344048d3C
  • Verify the ChainlinkRelayer address: 0xce35D1F69523a0672b9281dF1675D5b5D4004feF

TX#8 - Configure NGN/USD token report expiry time in SortedOracles - setTokenReportExpiry()

  • Verify the Rate Feed Identifier: 0xC13D42556f1baeab4a8600C735afcd5344048d3C
  • Verify Report Expiry Seconds: 360

TX#9 - Configure equivalent token for NGN rate in SortedOracles - setEquivalentToken()

  • Verify the token address: 0xE2702Bd97ee33c88c8f6f92DA3B733608aa76F71 (StableTokenNGNProxy)
  • Verify the Rate Feed Identifier: 0xd9D1A7FAA5deFe7E0301Ac5363E6ca18eB78c9D7

Appendix: Verifying an address

Verifying that an address in the CGP is correct requires a few different strategies depending on what the address is (see the mento docs for some additional information). Here are common situations:

1 Like