From e73fde86bad5c6791c1c6698ee1a25cc3104e92c Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Thu, 29 Aug 2024 10:39:58 +0800 Subject: [PATCH] Set team for KTON Signed-off-by: Xavier Lau --- runtime/crab/src/migration.rs | 18 +++++++++++++++--- runtime/darwinia/src/migration.rs | 18 +++++++++++++++--- runtime/koi/src/migration.rs | 26 ++++++++++++++++++++++++-- 3 files changed, 54 insertions(+), 8 deletions(-) diff --git a/runtime/crab/src/migration.rs b/runtime/crab/src/migration.rs index 31dd6c38a..34335bb0e 100644 --- a/runtime/crab/src/migration.rs +++ b/runtime/crab/src/migration.rs @@ -55,16 +55,28 @@ fn migrate() -> frame_support::weights::Weight { migration::put_storage_value(b"DarwinaStaking", b"CacheStates", &[], s); } - if let Ok(owner) = + if let Ok(dao) = array_bytes::hex_n_into::<_, AccountId, 20>("0x7FAcDaFB282028E4B3264fB08cd633A9142514df") { let _ = >::transfer_ownership( RuntimeOrigin::signed(ROOT), codec::Compact(AssetIds::CKton as AssetId), - owner, + dao, ); + + if let Ok(deposit) = array_bytes::hex_n_into::<_, AccountId, 20>( + "0x08837De0Ae21C270383D9F2de4DB03c7b1314632", + ) { + let _ = >::set_team( + RuntimeOrigin::signed(dao), + codec::Compact(AssetIds::CKton as AssetId), + deposit, + deposit, + dao, + ); + } } // frame_support::weights::Weight::zero() - ::DbWeight::get().reads_writes(3, 3) + ::DbWeight::get().reads_writes(7, 7) } diff --git a/runtime/darwinia/src/migration.rs b/runtime/darwinia/src/migration.rs index ce08cf436..0bda7b7cc 100644 --- a/runtime/darwinia/src/migration.rs +++ b/runtime/darwinia/src/migration.rs @@ -63,16 +63,28 @@ fn migrate() -> frame_support::weights::Weight { migration::put_storage_value(b"DarwinaStaking", b"CacheStates", &[], s); } - if let Ok(owner) = + if let Ok(dao) = array_bytes::hex_n_into::<_, AccountId, 20>("0x7FAcDaFB282028E4B3264fB08cd633A9142514df") { let _ = >::transfer_ownership( RuntimeOrigin::signed(ROOT), codec::Compact(AssetIds::Kton as AssetId), - owner, + dao, ); + + if let Ok(deposit) = array_bytes::hex_n_into::<_, AccountId, 20>( + "0x08837De0Ae21C270383D9F2de4DB03c7b1314632", + ) { + let _ = >::set_team( + RuntimeOrigin::signed(dao), + codec::Compact(AssetIds::Kton as AssetId), + deposit, + deposit, + dao, + ); + } } // frame_support::weights::Weight::zero() - ::DbWeight::get().reads_writes(3, 103) + ::DbWeight::get().reads_writes(7, 107) } diff --git a/runtime/koi/src/migration.rs b/runtime/koi/src/migration.rs index 391d97524..15e9e442f 100644 --- a/runtime/koi/src/migration.rs +++ b/runtime/koi/src/migration.rs @@ -45,6 +45,28 @@ impl frame_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade { } fn migrate() -> frame_support::weights::Weight { - frame_support::weights::Weight::zero() - // ::DbWeight::get().reads_writes(2, 2) + if let Ok(dao) = + array_bytes::hex_n_into::<_, AccountId, 20>("0x7FAcDaFB282028E4B3264fB08cd633A9142514df") + { + let _ = >::transfer_ownership( + RuntimeOrigin::signed(ROOT), + codec::Compact(AssetIds::KKton as AssetId), + dao, + ); + + if let Ok(deposit) = array_bytes::hex_n_into::<_, AccountId, 20>( + "0x08837De0Ae21C270383D9F2de4DB03c7b1314632", + ) { + let _ = >::set_team( + RuntimeOrigin::signed(dao), + codec::Compact(AssetIds::KKton as AssetId), + deposit, + deposit, + dao, + ); + } + } + + // frame_support::weights::Weight::zero() + ::DbWeight::get().reads_writes(5, 5) }