Skip to content

Commit

Permalink
Burn parachain backing RING (#218)
Browse files Browse the repository at this point in the history
  • Loading branch information
AurevoirXavier authored Jan 18, 2023
1 parent 2301211 commit 8f08de1
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
10 changes: 10 additions & 0 deletions tool/state-processor/src/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,32 @@ pub const ROOT: [u8; 20] = [0x72, 0x6f, 0x6f, 0x74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0

pub trait Configurable {
const NAME: &'static str;
// This account's balance will be burned.
// Please make sure no one transfer balance to this account.
const PARACHAIN_BACKING: &'static str;
}
impl Configurable for () {
const NAME: &'static str = "";
const PARACHAIN_BACKING: &'static str = "";
}

pub struct Darwinia;
impl Configurable for Darwinia {
const NAME: &'static str = "darwinia";
const PARACHAIN_BACKING: &'static str =
"0x1000000000000000000000000000000000000000000000000000000000000000";
}

pub struct Crab;
impl Configurable for Crab {
const NAME: &'static str = "crab";
const PARACHAIN_BACKING: &'static str =
"0x64766d3a0000000000000035a314e53e2fddfeca7b743042aacfb1abaf0adea3";
}

pub struct Pangolin;
impl Configurable for Pangolin {
const NAME: &'static str = "pangolin";
const PARACHAIN_BACKING: &'static str =
"0x64766d3a000000000000008c585f9791ee5b4b23fe82888ce576dbb69607ebe9";
}
8 changes: 4 additions & 4 deletions tool/state-processor/src/system/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@
- use all previous data to build the new accounts and calculate total issuances
- merge solo and para account infos
- how to deal with the account references? - TODO
- burn parachain backing ring
- set `Balances::TotalIssuance`
- compare the calculated one with the storage one
- remove para backing account - TODO
- check remaining sum - TODO
- XCM relate - TODO
- remove para backing account
- check remaining sum
- XCM related things
- create KTON asset details
- set accounts
- if is EVM address
Expand All @@ -30,7 +31,6 @@
- insert to `AccountMigration::Accounts`
- set KTON total issuances
- compare the calculated one with the storage one
- check remaining sum - TODO

- some remaining accounts, bridge endpoint accounts - TODO
- special accounts - TODO
Expand Down
9 changes: 9 additions & 0 deletions tool/state-processor/src/system/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@ where
ring_total_issuance += v.data.reserved;
});

log::info!("burn parachain backing ring");
if let Some(a) = accounts.get_mut(&blake2_128_concat_to_string(
array_bytes::hex2array_unchecked::<_, 32>(S::PARACHAIN_BACKING),
)) {
ring_total_issuance -= a.ring;
a.ring = 0;
}

log::info!("`ring_total_issuance({ring_total_issuance})`");
log::info!("`ring_total_issuance_storage({ring_total_issuance_storage})`");

Expand Down Expand Up @@ -226,6 +234,7 @@ where
);
}
});

log::info!("total_remaining_ring({total_remaining_ring})");
log::info!("total_remaining_kton({total_remaining_kton})");

Expand Down

0 comments on commit 8f08de1

Please sign in to comment.