Skip to content

Commit

Permalink
update BNC tag to TNT
Browse files Browse the repository at this point in the history
  • Loading branch information
salman01zp committed Jun 3, 2024
1 parent 64d077e commit b139f19
Show file tree
Hide file tree
Showing 43 changed files with 341 additions and 341 deletions.
12 changes: 6 additions & 6 deletions integration-tests/tangle-kusama/src/dollor_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const DOT_DECIMALS: u128 = 10_000_000_000;
fn dollar_should_work() {
TangleKusama::execute_with(|| {
assert_eq!(dollar::<Runtime>(CurrencyId::Token(ASG)), DECIMAL_12);
assert_eq!(dollar::<Runtime>(CurrencyId::Token(BNC)), DECIMAL_12);
assert_eq!(dollar::<Runtime>(CurrencyId::Token(TNT)), DECIMAL_12);
assert_eq!(dollar::<Runtime>(CurrencyId::Token(KUSD)), DECIMAL_12);
assert_eq!(dollar::<Runtime>(CurrencyId::Token(DOT)), DOT_DECIMALS);
assert_eq!(dollar::<Runtime>(CurrencyId::Token(KSM)), DECIMAL_12);
Expand All @@ -44,7 +44,7 @@ fn dollar_should_work() {
fn milli_should_work() {
TangleKusama::execute_with(|| {
assert_eq!(milli::<Runtime>(CurrencyId::Token(ASG)), DECIMAL_12 / 1000);
assert_eq!(milli::<Runtime>(CurrencyId::Token(BNC)), DECIMAL_12 / 1000);
assert_eq!(milli::<Runtime>(CurrencyId::Token(TNT)), DECIMAL_12 / 1000);
assert_eq!(milli::<Runtime>(CurrencyId::Token(KUSD)), DECIMAL_12 / 1000);
assert_eq!(milli::<Runtime>(CurrencyId::Token(DOT)), DOT_DECIMALS / 1000);
assert_eq!(milli::<Runtime>(CurrencyId::Token(KSM)), DECIMAL_12 / 1000);
Expand All @@ -61,7 +61,7 @@ fn milli_should_work() {
fn micro_should_work() {
TangleKusama::execute_with(|| {
assert_eq!(micro::<Runtime>(CurrencyId::Token(ASG)), DECIMAL_12 / 1_000_000);
assert_eq!(micro::<Runtime>(CurrencyId::Token(BNC)), DECIMAL_12 / 1_000_000);
assert_eq!(micro::<Runtime>(CurrencyId::Token(TNT)), DECIMAL_12 / 1_000_000);
assert_eq!(micro::<Runtime>(CurrencyId::Token(KUSD)), DECIMAL_12 / 1_000_000);
assert_eq!(micro::<Runtime>(CurrencyId::Token(DOT)), DOT_DECIMALS / 1_000_000);
assert_eq!(micro::<Runtime>(CurrencyId::Token(KSM)), DECIMAL_12 / 1_000_000);
Expand All @@ -78,7 +78,7 @@ fn micro_should_work() {
fn cent_should_work() {
TangleKusama::execute_with(|| {
assert_eq!(cent::<Runtime>(CurrencyId::Token(ASG)), DECIMAL_12 / 100);
assert_eq!(cent::<Runtime>(CurrencyId::Token(BNC)), DECIMAL_12 / 100);
assert_eq!(cent::<Runtime>(CurrencyId::Token(TNT)), DECIMAL_12 / 100);
assert_eq!(cent::<Runtime>(CurrencyId::Token(KUSD)), DECIMAL_12 / 100);
assert_eq!(cent::<Runtime>(CurrencyId::Token(DOT)), DOT_DECIMALS / 100);
assert_eq!(cent::<Runtime>(CurrencyId::Token(KSM)), DECIMAL_12 / 100);
Expand All @@ -95,7 +95,7 @@ fn cent_should_work() {
fn millicent_should_work() {
TangleKusama::execute_with(|| {
assert_eq!(millicent::<Runtime>(CurrencyId::Token(ASG)), DECIMAL_12 / 100_000);
assert_eq!(millicent::<Runtime>(CurrencyId::Token(BNC)), DECIMAL_12 / 100_000);
assert_eq!(millicent::<Runtime>(CurrencyId::Token(TNT)), DECIMAL_12 / 100_000);
assert_eq!(millicent::<Runtime>(CurrencyId::Token(KUSD)), DECIMAL_12 / 100_000);
assert_eq!(millicent::<Runtime>(CurrencyId::Token(DOT)), DOT_DECIMALS / 100_000);
assert_eq!(millicent::<Runtime>(CurrencyId::Token(KSM)), DECIMAL_12 / 100_000);
Expand All @@ -112,7 +112,7 @@ fn millicent_should_work() {
fn microcent_should_work() {
TangleKusama::execute_with(|| {
assert_eq!(microcent::<Runtime>(CurrencyId::Token(ASG)), DECIMAL_12 / 100_000_000);
assert_eq!(microcent::<Runtime>(CurrencyId::Token(BNC)), DECIMAL_12 / 100_000_000);
assert_eq!(microcent::<Runtime>(CurrencyId::Token(TNT)), DECIMAL_12 / 100_000_000);
assert_eq!(microcent::<Runtime>(CurrencyId::Token(KUSD)), DECIMAL_12 / 100_000_000);
assert_eq!(microcent::<Runtime>(CurrencyId::Token(DOT)), DOT_DECIMALS / 100_000_000);
assert_eq!(microcent::<Runtime>(CurrencyId::Token(KSM)), DECIMAL_12 / 100_000_000);
Expand Down
2 changes: 1 addition & 1 deletion node/service/res/stage/tangle-stage.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
10
],
"tokenSymbol": [
"BNC",
"TNT",
"KUSD",
"DOT",
"KSM",
Expand Down
2 changes: 1 addition & 1 deletion node/service/res/tangle-k-rococo.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
18
],
"tokenSymbol": [
"BNC",
"TNT",
"KUSD",
"DOT",
"KSM",
Expand Down
2 changes: 1 addition & 1 deletion node/service/res/tangle-kusama.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
18
],
"tokenSymbol": [
"BNC",
"TNT",
"KUSD",
"DOT",
"KSM",
Expand Down
2 changes: 1 addition & 1 deletion node/service/res/tangle-polkadot.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
12
],
"tokenSymbol": [
"BNC"
"TNT"
]
},
"relayChain": "polkadot",
Expand Down
10 changes: 5 additions & 5 deletions node/service/src/chain_spec/tangle_kusama.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ fn tangle_kusama_properties() -> Properties {
let mut token_decimals: Vec<u32> = vec![];
[
// native token
Native(BNC),
Native(TNT),
// stable token
Stable(KUSD),
// token
Expand Down Expand Up @@ -292,7 +292,7 @@ fn local_config_genesis(id: ParaId) -> RuntimeGenesisConfig {
),
(
x.clone(),
CurrencyId::VSBond(TokenSymbol::BNC, 2001, 13, 20),
CurrencyId::VSBond(TokenSymbol::TNT, 2001, 13, 20),
ENDOWMENT() * 4_000_000,
),
]
Expand All @@ -307,7 +307,7 @@ fn local_config_genesis(id: ParaId) -> RuntimeGenesisConfig {

// Token
let currency = vec![
(Native(BNC), DOLLARS / 100, None),
(Native(TNT), DOLLARS / 100, None),
(Stable(KUSD), DOLLARS / 10_000, None),
(Token(KSM), DOLLARS / 10_000, None),
(Token(ZLK), DOLLARS / 1000_000, None),
Expand All @@ -316,12 +316,12 @@ fn local_config_genesis(id: ParaId) -> RuntimeGenesisConfig {
(Token(PHA), 4 * DOLLARS / 100, None),
(Token(MOVR), DOLLARS / 1000_000, None),
];
let vcurrency = vec![VSToken(KSM), lst(BNC), lst(KSM), lst(MOVR)];
let vcurrency = vec![VSToken(KSM), lst(TNT), lst(KSM), lst(MOVR)];

// vsBond
let vsbond = vec![
// Token, ParaId, first_slot, last_slot
(Native(BNC), 2001u32, 13u32, 20u32),
(Native(TNT), 2001u32, 13u32, 20u32),
(Token(KSM), 2011, 19, 26),
(Token(KSM), 2085, 15, 22),
(Token(KSM), 2087, 17, 24),
Expand Down
6 changes: 3 additions & 3 deletions node/service/src/chain_spec/tangle_polkadot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ fn tangle_polkadot_properties() -> Properties {
let mut token_decimals: Vec<u32> = vec![];
[
// native token
CurrencyId::Native(TokenSymbol::BNC),
CurrencyId::Native(TokenSymbol::TNT),
]
.iter()
.for_each(|token| {
Expand Down Expand Up @@ -229,14 +229,14 @@ fn local_config_genesis(id: ParaId) -> RuntimeGenesisConfig {
let salp_multisig: AccountId =
hex!["49daa32c7287890f38b7e1a8cd2961723d36d20baa0bf3b82e0c4bdda93b1c0a"].into();
let currency = vec![
(Native(TokenSymbol::BNC), DOLLARS / 100, None),
(Native(TokenSymbol::TNT), DOLLARS / 100, None),
(
Token2(DOT_TOKEN_ID),
DOLLARS / 1000_000,
Some((String::from("Polkadot DOT"), String::from("DOT"), 10u8)),
),
];
let vcurrency = vec![VSToken2(DOT_TOKEN_ID), Lst(TokenSymbol::BNC), Lst2(DOT_TOKEN_ID)];
let vcurrency = vec![VSToken2(DOT_TOKEN_ID), Lst(TokenSymbol::TNT), Lst2(DOT_TOKEN_ID)];

tangle_polkadot_genesis(
vec![
Expand Down
10 changes: 5 additions & 5 deletions pallets/asset-registry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -610,10 +610,10 @@ impl<T: Config> CurrencyIdMapping<CurrencyId, MultiLocation, AssetMetadata<Balan
impl<T: Config> CurrencyIdConversion<CurrencyId> for AssetIdMaps<T> {
fn convert_to_token(currency_id: CurrencyId) -> Result<CurrencyId, ()> {
match currency_id {
CurrencyId::VSBond(TokenSymbol::BNC, 2001, 13, 20) => {
CurrencyId::VSBond(TokenSymbol::TNT, 2001, 13, 20) => {
Ok(CurrencyId::Token(TokenSymbol::KSM))
},
CurrencyId::Lst(TokenSymbol::BNC) => Ok(CurrencyId::Native(TokenSymbol::BNC)),
CurrencyId::Lst(TokenSymbol::TNT) => Ok(CurrencyId::Native(TokenSymbol::TNT)),
CurrencyId::Lst(token_symbol)
| CurrencyId::VSToken(token_symbol)
| CurrencyId::VSBond(token_symbol, ..) => Ok(CurrencyId::Token(token_symbol)),
Expand Down Expand Up @@ -652,8 +652,8 @@ impl<T: Config> CurrencyIdConversion<CurrencyId> for AssetIdMaps<T> {
CurrencyId::Token(token_symbol) => {
let mut vs_bond = CurrencyId::VSBond(token_symbol, index, first_slot, last_slot);
if vs_bond == CurrencyId::VSBond(TokenSymbol::KSM, 2001, 13, 20) {
// fix vsBOND::BNC
vs_bond = CurrencyId::VSBond(TokenSymbol::BNC, 2001, 13, 20);
// fix vsBOND::TNT
vs_bond = CurrencyId::VSBond(TokenSymbol::TNT, 2001, 13, 20);
}
Ok(vs_bond)
},
Expand Down Expand Up @@ -732,7 +732,7 @@ impl<T: Config> CurrencyIdRegister<CurrencyId> for AssetIdMaps<T> {
let option_token_metadata =
if CurrencyMetadatas::<T>::contains_key(CurrencyId::Token(token_symbol)) {
CurrencyMetadatas::<T>::get(CurrencyId::Token(token_symbol))
} else if token_symbol == TokenSymbol::BNC
} else if token_symbol == TokenSymbol::TNT
&& CurrencyMetadatas::<T>::contains_key(CurrencyId::Native(token_symbol))
{
CurrencyMetadatas::<T>::get(CurrencyId::Native(token_symbol))
Expand Down
20 changes: 10 additions & 10 deletions pallets/asset-registry/src/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use crate::*;
use frame_support::traits::{Get, OnRuntimeUpgrade};
#[cfg(feature = "try-runtime")]
use sp_runtime::TryRuntimeError;
use tangle_primitives::{CurrencyId, BNC};
use tangle_primitives::{CurrencyId, TNT};
use xcm::prelude::{GeneralKey, X1};

const LOG_TARGET: &str = "asset-registry::migration";
Expand Down Expand Up @@ -53,20 +53,20 @@ const BNC_LOCATION: MultiLocation = MultiLocation {
pub struct InsertBNCMetadata<T>(PhantomData<T>);
impl<T: Config> OnRuntimeUpgrade for InsertBNCMetadata<T> {
fn on_runtime_upgrade() -> Weight {
log::info!(target: LOG_TARGET, "Start to insert BNC Metadata...");
log::info!(target: LOG_TARGET, "Start to insert TNT Metadata...");
CurrencyMetadatas::<T>::insert(
BNC,
TNT,
&AssetMetadata {
name: b"tangle Native Token".to_vec(),
symbol: b"BNC".to_vec(),
symbol: b"TNT".to_vec(),
decimals: 12,
minimal_balance: BalanceOf::<T>::unique_saturated_from(10_000_000_000u128),
},
);

CurrencyIdToLocations::<T>::insert(BNC, BNC_LOCATION);
CurrencyIdToLocations::<T>::insert(TNT, BNC_LOCATION);

LocationToCurrencyIds::<T>::insert(BNC_LOCATION, BNC);
LocationToCurrencyIds::<T>::insert(BNC_LOCATION, TNT);

Weight::from(T::DbWeight::get().reads_writes(3 as u64 + 1, 3 as u64 + 1))
}
Expand All @@ -80,12 +80,12 @@ impl<T: Config> OnRuntimeUpgrade for InsertBNCMetadata<T> {

#[cfg(feature = "try-runtime")]
fn post_upgrade(_cnt: Vec<u8>) -> Result<(), TryRuntimeError> {
let metadata = CurrencyMetadatas::<T>::get(BNC);
let metadata = CurrencyMetadatas::<T>::get(TNT);
assert_eq!(
metadata,
Some(AssetMetadata {
name: b"tangle Native Token".to_vec(),
symbol: b"BNC".to_vec(),
symbol: b"TNT".to_vec(),
decimals: 12,
minimal_balance: BalanceOf::<T>::unique_saturated_from(10_000_000_000u128),
})
Expand All @@ -96,7 +96,7 @@ impl<T: Config> OnRuntimeUpgrade for InsertBNCMetadata<T> {
metadata
);

let location = CurrencyIdToLocations::<T>::get(BNC);
let location = CurrencyIdToLocations::<T>::get(TNT);
assert_eq!(location, Some(BNC_LOCATION));

log::info!(
Expand All @@ -106,7 +106,7 @@ impl<T: Config> OnRuntimeUpgrade for InsertBNCMetadata<T> {
);

let currency = LocationToCurrencyIds::<T>::get(BNC_LOCATION);
assert_eq!(currency, Some(BNC));
assert_eq!(currency, Some(TNT));
log::info!(
target: LOG_TARGET,
"InsertBNCMetadata post-migrate storage: {:?}",
Expand Down
12 changes: 6 additions & 6 deletions pallets/asset-registry/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ fn register_token_metadata_should_work() {
ExtBuilder::default().build().execute_with(|| {
let metadata = AssetMetadata {
name: b"tangle Native Coin".to_vec(),
symbol: b"BNC".to_vec(),
symbol: b"TNT".to_vec(),
decimals: 12,
minimal_balance: 0,
};
Expand All @@ -205,13 +205,13 @@ fn register_lst_metadata_should_work() {
ExtBuilder::default().build().execute_with(|| {
let metadata = AssetMetadata {
name: b"tangle Native Coin".to_vec(),
symbol: b"BNC".to_vec(),
symbol: b"TNT".to_vec(),
decimals: 12,
minimal_balance: 0,
};
let v_metadata = AssetMetadata {
name: b"Voucher BNC".to_vec(),
symbol: b"vBNC".to_vec(),
name: b"Voucher TNT".to_vec(),
symbol: b"vTNT".to_vec(),
decimals: 12,
minimal_balance: 0,
};
Expand Down Expand Up @@ -313,7 +313,7 @@ fn register_multilocation_should_work() {
ExtBuilder::default().build().execute_with(|| {
let metadata = AssetMetadata {
name: b"tangle Native Coin".to_vec(),
symbol: b"BNC".to_vec(),
symbol: b"TNT".to_vec(),
decimals: 12,
minimal_balance: 0,
};
Expand Down Expand Up @@ -376,7 +376,7 @@ fn force_set_multilocation_should_work() {
ExtBuilder::default().build().execute_with(|| {
let metadata = AssetMetadata {
name: b"tangle Native Coin".to_vec(),
symbol: b"BNC".to_vec(),
symbol: b"TNT".to_vec(),
decimals: 12,
minimal_balance: 0,
};
Expand Down
4 changes: 2 additions & 2 deletions pallets/lst-minting/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub mod pallet {
use super::*;
use frame_support::pallet_prelude::DispatchResultWithPostInfo;
use orml_traits::XcmTransfer;
use tangle_primitives::{currency::BNC, FIL};
use tangle_primitives::{currency::TNT, FIL};
use xcm::{prelude::*, v3::MultiLocation};

#[pallet::pallet]
Expand Down Expand Up @@ -1068,7 +1068,7 @@ pub mod pallet {
if token_id == FIL {
let assets = vec![
(token_id, unlock_amount),
(BNC, T::TangleSlpx::get_moonbeam_transfer_to_fee()),
(TNT, T::TangleSlpx::get_moonbeam_transfer_to_fee()),
];

T::XcmTransfer::transfer_multicurrencies(
Expand Down
Loading

0 comments on commit b139f19

Please sign in to comment.