Skip to content

Commit

Permalink
feat: add LP Celo wrapped USDC
Browse files Browse the repository at this point in the history
  • Loading branch information
wischli committed Sep 27, 2023
1 parent 47569ef commit e277015
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
7 changes: 5 additions & 2 deletions libs/types/src/tokens.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,20 +379,23 @@ pub mod usdc {
pub const CURRENCY_ID_LP_ETH_GOERLI_USDC: CurrencyId = CurrencyId::ForeignAsset(100_001);
pub const CURRENCY_ID_LP_BASE_USDC: CurrencyId = CurrencyId::ForeignAsset(100_002);
pub const CURRENCY_ID_LP_ARB_USDC: CurrencyId = CurrencyId::ForeignAsset(100_004);
pub const CURRENCY_ID_LP_CELO_USDC: CurrencyId = CurrencyId::ForeignAsset(100_005);

pub const CHAIN_ID_ETHEREUM_MAINNET: EVMChainId = 1;
pub const CHAIN_ID_ETH_GOERLI_TESTNET: EVMChainId = 5;
pub const CHAIN_ID_BASE_MAINNET: EVMChainId = 8453;
pub const CHAIN_ID_ARBITRUM_MAINNET: EVMChainId = 42_161;
pub const CHAIN_ID_CELO_MAINNET: EVMChainId = 42_220;

pub const CONTRACT_ETHEREUM_USDC: [u8; 20] =
hex_literal::hex!("a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48");
pub const CONTRACT_ETH_GOERLI_USDC: [u8; 20] =
hex_literal::hex!("07865c6e87b9f70255377e024ace6630c1eaa37f");
pub const CONTRACT_BASE_USDC: [u8; 20] =
hex_literal::hex!("833589fCD6eDb6E08f4c7C32D4f71b54bdA02913");
pub const CONTRACT_ARBITRUM_USDC: [u8; 20] =
hex_literal::hex!("af88d065e77c8cC2239327C5EDb3A432268e5831");
pub const CONTRACT_ARBITRUM_USDC: [u8; 20] = hex_literal::hex!("af88d065e77c8cC2239327C5EDb3A432268e5831");
pub const CONTRACT_CELO_USDC: [u8; 20] =
hex_literal::hex!("37f750B7cC259A2f741AF45294f6a16572CF5cAd");

/// The metadata generator for the LP wrapped USDC currencies
// TODO(future): If no further LP wrapped USDC variants are expected, move this
Expand Down
16 changes: 15 additions & 1 deletion runtime/centrifuge/src/migrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,12 @@ pub mod add_wrapped_usdc_variants {
use orml_asset_registry::AssetMetadata;
use sp_runtime::SaturatedConversion;
use sp_std::{vec, vec::Vec};
use cfg_types::tokens::usdc::{CHAIN_ID_CELO_MAINNET, CONTRACT_CELO_USDC, CURRENCY_ID_LP_CELO_USDC};

use super::*;
use crate::{Balance, LiquidityPoolsPalletIndex, OrmlAssetRegistry, Runtime};
#[cfg(feature = "try-runtime")]
use crate::OrderBook;

pub struct Migration;

Expand Down Expand Up @@ -259,7 +262,7 @@ pub mod add_wrapped_usdc_variants {

impl Migration {
fn get_unregistered_ids() -> Vec<CurrencyId> {
vec![CURRENCY_ID_LP_BASE_USDC, CURRENCY_ID_LP_ARB_USDC]
vec![CURRENCY_ID_LP_BASE_USDC, CURRENCY_ID_LP_ARB_USDC, CURRENCY_ID_LP_CELO_USDC]
}

#[cfg(feature = "try-runtime")]
Expand All @@ -268,6 +271,7 @@ pub mod add_wrapped_usdc_variants {
CURRENCY_ID_LP_ETH_USDC,
CURRENCY_ID_LP_BASE_USDC,
CURRENCY_ID_LP_ARB_USDC,
CURRENCY_ID_LP_CELO_USDC
]
}

Expand Down Expand Up @@ -295,6 +299,16 @@ pub mod add_wrapped_usdc_variants {
CONTRACT_ARBITRUM_USDC,
true,
),
), (
CURRENCY_ID_LP_CELO_USDC,
lp_wrapped_usdc_metadata(
"LP Celo Wrapped USDC".as_bytes().to_vec(),
"LpCeloUSDC".as_bytes().to_vec(),
LiquidityPoolsPalletIndex::get(),
CHAIN_ID_CELO_MAINNET,
CONTRACT_CELO_USDC,
true,
),
),
]
}
Expand Down

0 comments on commit e277015

Please sign in to comment.