From ba1e35588155f3feebed33fbdc597191a41f4839 Mon Sep 17 00:00:00 2001 From: Gianmarco Fraccaroli Date: Wed, 29 May 2024 14:57:21 +0200 Subject: [PATCH] improvment and fixes --- Cargo.lock | 58 +++++++++---------- Cargo.toml | 6 +- block_party/src/lib.rs | 10 ++-- builder/parameters/shielding-party.json | 15 +++++ .../parameters/shielding-reward-party.json | 15 +++++ builder/parameters/staking-party.json | 15 +++++ shielding_party/src/lib.rs | 37 +++++++----- shielding_reward_party/src/lib.rs | 10 ++-- staking_party/src/lib.rs | 10 ++-- 9 files changed, 113 insertions(+), 63 deletions(-) create mode 100644 builder/parameters/shielding-party.json create mode 100644 builder/parameters/shielding-reward-party.json create mode 100644 builder/parameters/staking-party.json diff --git a/Cargo.lock b/Cargo.lock index 90ea522..ecdd2de 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1867,7 +1867,7 @@ checksum = "defc4c55412d89136f966bbb339008b474350e5e6e78d2714439c386b3137a03" [[package]] name = "namada_account" version = "0.37.0" -source = "git+https://github.com/anoma/namada?branch=fraccaman/export-ibc-storage-keys-to-wasm#c75f3e253314b90a53b85a81a7ceba68c2fef122" +source = "git+https://github.com/anoma/namada?branch=fraccaman/multitoken-allow-governance-changes#14e16d0e8af51b7201adeab2455d04bb49909212" dependencies = [ "borsh 1.5.0", "namada_core", @@ -1879,7 +1879,7 @@ dependencies = [ [[package]] name = "namada_controller" version = "0.37.0" -source = "git+https://github.com/anoma/namada?branch=fraccaman/export-ibc-storage-keys-to-wasm#c75f3e253314b90a53b85a81a7ceba68c2fef122" +source = "git+https://github.com/anoma/namada?branch=fraccaman/multitoken-allow-governance-changes#14e16d0e8af51b7201adeab2455d04bb49909212" dependencies = [ "namada_core", "smooth-operator", @@ -1889,7 +1889,7 @@ dependencies = [ [[package]] name = "namada_core" version = "0.37.0" -source = "git+https://github.com/anoma/namada?branch=fraccaman/export-ibc-storage-keys-to-wasm#c75f3e253314b90a53b85a81a7ceba68c2fef122" +source = "git+https://github.com/anoma/namada?branch=fraccaman/multitoken-allow-governance-changes#14e16d0e8af51b7201adeab2455d04bb49909212" dependencies = [ "bech32", "borsh 1.5.0", @@ -1932,7 +1932,7 @@ dependencies = [ [[package]] name = "namada_events" version = "0.37.0" -source = "git+https://github.com/anoma/namada?branch=fraccaman/export-ibc-storage-keys-to-wasm#c75f3e253314b90a53b85a81a7ceba68c2fef122" +source = "git+https://github.com/anoma/namada?branch=fraccaman/multitoken-allow-governance-changes#14e16d0e8af51b7201adeab2455d04bb49909212" dependencies = [ "borsh 1.5.0", "namada_core", @@ -1946,7 +1946,7 @@ dependencies = [ [[package]] name = "namada_gas" version = "0.37.0" -source = "git+https://github.com/anoma/namada?branch=fraccaman/export-ibc-storage-keys-to-wasm#c75f3e253314b90a53b85a81a7ceba68c2fef122" +source = "git+https://github.com/anoma/namada?branch=fraccaman/multitoken-allow-governance-changes#14e16d0e8af51b7201adeab2455d04bb49909212" dependencies = [ "borsh 1.5.0", "namada_core", @@ -1959,7 +1959,7 @@ dependencies = [ [[package]] name = "namada_governance" version = "0.37.0" -source = "git+https://github.com/anoma/namada?branch=fraccaman/export-ibc-storage-keys-to-wasm#c75f3e253314b90a53b85a81a7ceba68c2fef122" +source = "git+https://github.com/anoma/namada?branch=fraccaman/multitoken-allow-governance-changes#14e16d0e8af51b7201adeab2455d04bb49909212" dependencies = [ "borsh 1.5.0", "itertools", @@ -1980,7 +1980,7 @@ dependencies = [ [[package]] name = "namada_ibc" version = "0.37.0" -source = "git+https://github.com/anoma/namada?branch=fraccaman/export-ibc-storage-keys-to-wasm#c75f3e253314b90a53b85a81a7ceba68c2fef122" +source = "git+https://github.com/anoma/namada?branch=fraccaman/multitoken-allow-governance-changes#14e16d0e8af51b7201adeab2455d04bb49909212" dependencies = [ "borsh 1.5.0", "ibc", @@ -2010,7 +2010,7 @@ dependencies = [ [[package]] name = "namada_macros" version = "0.37.0" -source = "git+https://github.com/anoma/namada?branch=fraccaman/export-ibc-storage-keys-to-wasm#c75f3e253314b90a53b85a81a7ceba68c2fef122" +source = "git+https://github.com/anoma/namada?branch=fraccaman/multitoken-allow-governance-changes#14e16d0e8af51b7201adeab2455d04bb49909212" dependencies = [ "data-encoding", "proc-macro2", @@ -2022,7 +2022,7 @@ dependencies = [ [[package]] name = "namada_merkle_tree" version = "0.37.0" -source = "git+https://github.com/anoma/namada?branch=fraccaman/export-ibc-storage-keys-to-wasm#c75f3e253314b90a53b85a81a7ceba68c2fef122" +source = "git+https://github.com/anoma/namada?branch=fraccaman/multitoken-allow-governance-changes#14e16d0e8af51b7201adeab2455d04bb49909212" dependencies = [ "borsh 1.5.0", "eyre", @@ -2037,7 +2037,7 @@ dependencies = [ [[package]] name = "namada_parameters" version = "0.37.0" -source = "git+https://github.com/anoma/namada?branch=fraccaman/export-ibc-storage-keys-to-wasm#c75f3e253314b90a53b85a81a7ceba68c2fef122" +source = "git+https://github.com/anoma/namada?branch=fraccaman/multitoken-allow-governance-changes#14e16d0e8af51b7201adeab2455d04bb49909212" dependencies = [ "borsh 1.5.0", "namada_core", @@ -2049,7 +2049,7 @@ dependencies = [ [[package]] name = "namada_proof_of_stake" version = "0.37.0" -source = "git+https://github.com/anoma/namada?branch=fraccaman/export-ibc-storage-keys-to-wasm#c75f3e253314b90a53b85a81a7ceba68c2fef122" +source = "git+https://github.com/anoma/namada?branch=fraccaman/multitoken-allow-governance-changes#14e16d0e8af51b7201adeab2455d04bb49909212" dependencies = [ "borsh 1.5.0", "data-encoding", @@ -2074,7 +2074,7 @@ dependencies = [ [[package]] name = "namada_replay_protection" version = "0.37.0" -source = "git+https://github.com/anoma/namada?branch=fraccaman/export-ibc-storage-keys-to-wasm#c75f3e253314b90a53b85a81a7ceba68c2fef122" +source = "git+https://github.com/anoma/namada?branch=fraccaman/multitoken-allow-governance-changes#14e16d0e8af51b7201adeab2455d04bb49909212" dependencies = [ "namada_core", ] @@ -2082,7 +2082,7 @@ dependencies = [ [[package]] name = "namada_shielded_token" version = "0.37.0" -source = "git+https://github.com/anoma/namada?branch=fraccaman/export-ibc-storage-keys-to-wasm#c75f3e253314b90a53b85a81a7ceba68c2fef122" +source = "git+https://github.com/anoma/namada?branch=fraccaman/multitoken-allow-governance-changes#14e16d0e8af51b7201adeab2455d04bb49909212" dependencies = [ "borsh 1.5.0", "masp_primitives", @@ -2100,7 +2100,7 @@ dependencies = [ [[package]] name = "namada_state" version = "0.37.0" -source = "git+https://github.com/anoma/namada?branch=fraccaman/export-ibc-storage-keys-to-wasm#c75f3e253314b90a53b85a81a7ceba68c2fef122" +source = "git+https://github.com/anoma/namada?branch=fraccaman/multitoken-allow-governance-changes#14e16d0e8af51b7201adeab2455d04bb49909212" dependencies = [ "borsh 1.5.0", "ics23", @@ -2126,7 +2126,7 @@ dependencies = [ [[package]] name = "namada_storage" version = "0.37.0" -source = "git+https://github.com/anoma/namada?branch=fraccaman/export-ibc-storage-keys-to-wasm#c75f3e253314b90a53b85a81a7ceba68c2fef122" +source = "git+https://github.com/anoma/namada?branch=fraccaman/multitoken-allow-governance-changes#14e16d0e8af51b7201adeab2455d04bb49909212" dependencies = [ "borsh 1.5.0", "itertools", @@ -2144,7 +2144,7 @@ dependencies = [ [[package]] name = "namada_token" version = "0.37.0" -source = "git+https://github.com/anoma/namada?branch=fraccaman/export-ibc-storage-keys-to-wasm#c75f3e253314b90a53b85a81a7ceba68c2fef122" +source = "git+https://github.com/anoma/namada?branch=fraccaman/multitoken-allow-governance-changes#14e16d0e8af51b7201adeab2455d04bb49909212" dependencies = [ "namada_core", "namada_events", @@ -2156,7 +2156,7 @@ dependencies = [ [[package]] name = "namada_trans_token" version = "0.37.0" -source = "git+https://github.com/anoma/namada?branch=fraccaman/export-ibc-storage-keys-to-wasm#c75f3e253314b90a53b85a81a7ceba68c2fef122" +source = "git+https://github.com/anoma/namada?branch=fraccaman/multitoken-allow-governance-changes#14e16d0e8af51b7201adeab2455d04bb49909212" dependencies = [ "konst", "namada_core", @@ -2167,7 +2167,7 @@ dependencies = [ [[package]] name = "namada_tx" version = "0.37.0" -source = "git+https://github.com/anoma/namada?branch=fraccaman/export-ibc-storage-keys-to-wasm#c75f3e253314b90a53b85a81a7ceba68c2fef122" +source = "git+https://github.com/anoma/namada?branch=fraccaman/multitoken-allow-governance-changes#14e16d0e8af51b7201adeab2455d04bb49909212" dependencies = [ "ark-bls12-381", "bitflags", @@ -2193,7 +2193,7 @@ dependencies = [ [[package]] name = "namada_tx_env" version = "0.37.0" -source = "git+https://github.com/anoma/namada?branch=fraccaman/export-ibc-storage-keys-to-wasm#c75f3e253314b90a53b85a81a7ceba68c2fef122" +source = "git+https://github.com/anoma/namada?branch=fraccaman/multitoken-allow-governance-changes#14e16d0e8af51b7201adeab2455d04bb49909212" dependencies = [ "namada_core", "namada_events", @@ -2203,7 +2203,7 @@ dependencies = [ [[package]] name = "namada_tx_prelude" version = "0.37.0" -source = "git+https://github.com/anoma/namada?branch=fraccaman/export-ibc-storage-keys-to-wasm#c75f3e253314b90a53b85a81a7ceba68c2fef122" +source = "git+https://github.com/anoma/namada?branch=fraccaman/multitoken-allow-governance-changes#14e16d0e8af51b7201adeab2455d04bb49909212" dependencies = [ "borsh 1.5.0", "masp_primitives", @@ -2227,7 +2227,7 @@ dependencies = [ [[package]] name = "namada_vm_env" version = "0.37.0" -source = "git+https://github.com/anoma/namada?branch=fraccaman/export-ibc-storage-keys-to-wasm#c75f3e253314b90a53b85a81a7ceba68c2fef122" +source = "git+https://github.com/anoma/namada?branch=fraccaman/multitoken-allow-governance-changes#14e16d0e8af51b7201adeab2455d04bb49909212" dependencies = [ "borsh 1.5.0", "masp_primitives", @@ -2599,9 +2599,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.83" +version = "1.0.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b33eb56c327dec362a9e55b3ad14f9d2f0904fb5a5b03b513ab5465399e9f43" +checksum = "ec96c6a92621310b51366f1e28d05ef11489516e93be030060e5fc12024a49d6" dependencies = [ "unicode-ident", ] @@ -2879,9 +2879,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.202" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "226b61a0d411b2ba5ff6d7f73a476ac4f8bb900373459cd00fab8512828ba395" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] @@ -2906,9 +2906,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.202" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6048858004bcff69094cd972ed40a32500f153bd3be9f716b2eed2e8217c4838" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", @@ -3647,9 +3647,9 @@ dependencies = [ [[package]] name = "zeroize" -version = "1.7.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" dependencies = [ "zeroize_derive", ] diff --git a/Cargo.toml b/Cargo.toml index 918a388..fd14a2b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,9 +15,9 @@ license = "GPL-3.0" version = "0.1.0" [workspace.dependencies] -namada_tx_prelude = { git = "https://github.com/anoma/namada", branch = "fraccaman/export-ibc-storage-keys-to-wasm" } -namada_proof_of_stake = { git = "https://github.com/anoma/namada", branch = "fraccaman/export-ibc-storage-keys-to-wasm" } -namada_core = { git = "https://github.com/anoma/namada", branch = "fraccaman/export-ibc-storage-keys-to-wasm" } +namada_tx_prelude = { git = "https://github.com/anoma/namada", branch = "fraccaman/multitoken-allow-governance-changes" } +namada_proof_of_stake = { git = "https://github.com/anoma/namada", branch = "fraccaman/multitoken-allow-governance-changes" } +namada_core = { git = "https://github.com/anoma/namada", branch = "fraccaman/multitoken-allow-governance-changes" } wee_alloc = "0.4.5" getrandom = { version = "0.2", features = ["custom"] } lazy_static = "1.4.0" diff --git a/block_party/src/lib.rs b/block_party/src/lib.rs index 66e3dac..c4c8b87 100644 --- a/block_party/src/lib.rs +++ b/block_party/src/lib.rs @@ -22,12 +22,12 @@ fn apply_tx(ctx: &mut Ctx, _tx_data: BatchedTx) -> TxResult { // PGF inflation let pgf_inflation_key = governance::pgf::storage::keys::get_pgf_inflation_rate_key(); - let pgf_inflation_rate = Dec::from_str("0.025").unwrap(); + let pgf_inflation_rate = Dec::from_str("0.025").unwrap(); ctx.write(&pgf_inflation_key, pgf_inflation_rate)?; // PGF stewards inflation let steward_inflation_key = governance::pgf::storage::keys::get_steward_inflation_rate_key(); - let steward_inflation_rate = Dec::from_str("0.001").unwrap(); + let steward_inflation_rate = Dec::from_str("0.001").unwrap(); ctx.write(&steward_inflation_key, steward_inflation_rate)?; // Read the current transaction allowlist from storage @@ -37,12 +37,10 @@ fn apply_tx(ctx: &mut Ctx, _tx_data: BatchedTx) -> TxResult { .unwrap_or_default(); // Update the allowlist and write the addition wasm storage keys per transaction - for (wasm_name, wasm_bytes) in [ - (TX_CLAIM_REWARDS_NAME, TX_CLAIM_REWARDS_BYTES), - ] { + for (wasm_name, wasm_bytes) in [(TX_CLAIM_REWARDS_NAME, TX_CLAIM_REWARDS_BYTES)] { let tx_hash = CodeHash::sha256(wasm_bytes); - // make the update idempotent + // make the update idempotent if current_tx_allowlist.contains(&tx_hash.to_string()) { continue; } diff --git a/builder/parameters/shielding-party.json b/builder/parameters/shielding-party.json new file mode 100644 index 0000000..05cce3a --- /dev/null +++ b/builder/parameters/shielding-party.json @@ -0,0 +1,15 @@ +{ + "title": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus eget ex id erat interdum dictum vel ac libero. Cras vitae porta velit, vel interdum odio. Phasellus quis sem finibus, luctus neque in, vestibulum lectus. Maecenas at nulla dapibus, condimentum sem vitae, ullamcorper nisi. Pellentesque tristique tempus tellus, nec sollicitudin velit facilisis at. Vivamus porta nibh sit amet eros tempor, vestibulum lacinia est pulvinar. Maecenas libero mauris, blandit sit amet tempus in, elementum quis nunc. ", + "authors": "Bob The Builer ", + "discussions-to": "www.bob-the-builder.forum.rock", + "license": "SPQR", + "abstract": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + "motivation": " Vivamus eget ex id erat interdum dictum vel ac libero.", + "details": "Phasellus quis sem finibus, luctus neque in, vestibulum lectus.", + "requires": "-1", + "author": "tnam1qxfj3sf6a0meahdu9t6znp05g8zx4dkjtgyn9gfu", + "voting_start_epoch": 9, + "voting_end_epoch": 18, + "activation_epoch": 25, + "wasm_path": "artifacts/shielding_party.wasm" +} \ No newline at end of file diff --git a/builder/parameters/shielding-reward-party.json b/builder/parameters/shielding-reward-party.json new file mode 100644 index 0000000..29baab8 --- /dev/null +++ b/builder/parameters/shielding-reward-party.json @@ -0,0 +1,15 @@ +{ + "title": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus eget ex id erat interdum dictum vel ac libero. Cras vitae porta velit, vel interdum odio. Phasellus quis sem finibus, luctus neque in, vestibulum lectus. Maecenas at nulla dapibus, condimentum sem vitae, ullamcorper nisi. Pellentesque tristique tempus tellus, nec sollicitudin velit facilisis at. Vivamus porta nibh sit amet eros tempor, vestibulum lacinia est pulvinar. Maecenas libero mauris, blandit sit amet tempus in, elementum quis nunc. ", + "authors": "Bob The Builer ", + "discussions-to": "www.bob-the-builder.forum.rock", + "license": "SPQR", + "abstract": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + "motivation": " Vivamus eget ex id erat interdum dictum vel ac libero.", + "details": "Phasellus quis sem finibus, luctus neque in, vestibulum lectus.", + "requires": "-1", + "author": "tnam1qxfj3sf6a0meahdu9t6znp05g8zx4dkjtgyn9gfu", + "voting_start_epoch": 9, + "voting_end_epoch": 18, + "activation_epoch": 25, + "wasm_path": "artifacts/shielded_reward_party.wasm" +} \ No newline at end of file diff --git a/builder/parameters/staking-party.json b/builder/parameters/staking-party.json new file mode 100644 index 0000000..ec54868 --- /dev/null +++ b/builder/parameters/staking-party.json @@ -0,0 +1,15 @@ +{ + "title": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus eget ex id erat interdum dictum vel ac libero. Cras vitae porta velit, vel interdum odio. Phasellus quis sem finibus, luctus neque in, vestibulum lectus. Maecenas at nulla dapibus, condimentum sem vitae, ullamcorper nisi. Pellentesque tristique tempus tellus, nec sollicitudin velit facilisis at. Vivamus porta nibh sit amet eros tempor, vestibulum lacinia est pulvinar. Maecenas libero mauris, blandit sit amet tempus in, elementum quis nunc. ", + "authors": "Bob The Builer ", + "discussions-to": "www.bob-the-builder.forum.rock", + "license": "SPQR", + "abstract": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", + "motivation": " Vivamus eget ex id erat interdum dictum vel ac libero.", + "details": "Phasellus quis sem finibus, luctus neque in, vestibulum lectus.", + "requires": "-1", + "author": "tnam1qxfj3sf6a0meahdu9t6znp05g8zx4dkjtgyn9gfu", + "voting_start_epoch": 9, + "voting_end_epoch": 18, + "activation_epoch": 25, + "wasm_path": "artifacts/staking_party.wasm" +} \ No newline at end of file diff --git a/shielding_party/src/lib.rs b/shielding_party/src/lib.rs index 171b245..c5ba204 100644 --- a/shielding_party/src/lib.rs +++ b/shielding_party/src/lib.rs @@ -7,7 +7,7 @@ pub type ChannelId = &'static str; pub type BaseToken = &'static str; pub type TokenMaxReward = &'static str; -pub type TokenTargetLockedAmount = &'static str; +pub type TokenTargetLockedAmount = u64; pub type KpGain = &'static str; pub type KdGain = &'static str; @@ -23,28 +23,30 @@ const IBC_TOKENS: [( ( 0, "channel-0", - "tnam1q....", + "tnam1qrdm8ymq2svrrafzuqahm547xm4kfuw3aue93uzs", "0.01", - "1_000_000_000", + 1_000_000_000, "120000", "120000", ), ( 0, - "channel-0", - "tnam1q....", + "channel-1", + "tnam1qqx4luqsngxdmpf5nk8shkn7wwlmz6g7dckp8kgm", "0.015", - "1_500_000_000", + 1_500_000_000, "150000", "110000", ), ]; -#[transaction] +#[transaction(gas = 10000)] fn apply_tx(ctx: &mut Ctx, _tx_data: BatchedTx) -> TxResult { // Read the current MASP token map let token_map_key = token::storage_key::masp_token_map_key(); - let mut token_map = ctx.read::(&token_map_key)?.unwrap_or_default().clone(); + let mut token_map = ctx + .read::(&token_map_key)? + .unwrap_or_default(); let nam_address = ctx.get_native_token()?; @@ -63,21 +65,30 @@ fn apply_tx(ctx: &mut Ctx, _tx_data: BatchedTx) -> TxResult { let shielded_native_token_kd_gain_key = token::storage_key::masp_kd_gain_key(&nam_address); // Setup native token shielded set rewards to 0 - ctx.write(&shielded_native_token_last_inflation_key, token::Amount::zero())?; + ctx.write( + &shielded_native_token_last_inflation_key, + token::Amount::zero(), + )?; ctx.write( &shielded_native_token_last_locked_amount_key, token::Amount::zero(), )?; ctx.write( &shielded_native_token_max_rewards_key, - Dec::from_str("0").unwrap(), + Dec::from_str("0.0").unwrap(), )?; ctx.write( &shielded_native_token_target_locked_amount_key, - token::Amount::from_uint("0", 6).unwrap(), + token::Amount::from_uint(0, 6).unwrap(), + )?; + ctx.write( + &shielded_native_token_kp_gain_key, + Dec::from_str("0.0").unwrap(), + )?; + ctx.write( + &shielded_native_token_kd_gain_key, + Dec::from_str("0.0").unwrap(), )?; - ctx.write(&shielded_native_token_kp_gain_key, Dec::from_str("0").unwrap())?; - ctx.write(&shielded_native_token_kd_gain_key, Dec::from_str("0").unwrap())?; // Enable shielded set rewards for ibc tokens for (denomination, channel_id, base_token, max_reward, target_locked_amount, kp, kd) in diff --git a/shielding_reward_party/src/lib.rs b/shielding_reward_party/src/lib.rs index fbf65ff..f27a870 100644 --- a/shielding_reward_party/src/lib.rs +++ b/shielding_reward_party/src/lib.rs @@ -4,7 +4,7 @@ use dec::Dec; use namada_tx_prelude::*; pub const NAM_MAX_REWARD: &str = "0.01"; -pub const NAM_TARGET_LOCKED_AMOUNT: &str = "1_000_000_000"; +pub const NAM_TARGET_LOCKED_AMOUNT: u64 = 1_000_000_000; pub const KP_GAIN: &str = "120000"; pub const KD_GAIN: &str = "120000"; @@ -14,23 +14,21 @@ fn apply_tx(ctx: &mut Ctx, _tx_data: BatchedTx) -> TxResult { let native_token_transferable_key = parameters_storage::get_native_token_transferable_key(); ctx.write(&native_token_transferable_key, true)?; - // Enable NAM to be transferable via IBC - // Enable NAM to get MASP rewards + // Enable NAM MASP rewards let nam_address = ctx.get_native_token()?; let shielded_token_last_inflation_key = token::storage_key::masp_last_inflation_key(&nam_address); let shielded_token_last_locked_amount_key = token::storage_key::masp_last_locked_amount_key(&nam_address); - let shielded_token_max_rewards_key = - token::storage_key::masp_max_reward_rate_key(&nam_address); + let shielded_token_max_rewards_key = token::storage_key::masp_max_reward_rate_key(&nam_address); let shielded_token_target_locked_amount_key = token::storage_key::masp_locked_amount_target_key(&nam_address); let shielded_token_kp_gain_key = token::storage_key::masp_kp_gain_key(&nam_address); let shielded_token_kd_gain_key = token::storage_key::masp_kd_gain_key(&nam_address); let token_map_key = token::storage_key::masp_token_map_key(); - // Add the ibc token to the masp token map + // Add native token to the masp token map let mut token_map: masp::TokenMap = ctx.read(&token_map_key)?.unwrap_or_default(); token_map.insert("nam".to_string(), nam_address); ctx.write(&token_map_key, token_map)?; diff --git a/staking_party/src/lib.rs b/staking_party/src/lib.rs index ae5f8ac..91084a4 100644 --- a/staking_party/src/lib.rs +++ b/staking_party/src/lib.rs @@ -16,19 +16,19 @@ const TX_TRANSFER_BYTES: &[u8] = include_bytes!( const IBC_TOKENS: [(ChannelId, BaseToken, MintTokenLimit, ThroughtputTokenLimit); 2] = [ ( "channel-0", - "tnam1q....", + "tnam1qrdm8ymq2svrrafzuqahm547xm4kfuw3aue93uzs", MintTokenLimit::from_u64(1000), ThroughtputTokenLimit::from_u64(10000), ), ( "channel-1", - "tnam1q....", + "tnam1qqx4luqsngxdmpf5nk8shkn7wwlmz6g7dckp8kgm", MintTokenLimit::from_u64(2000), ThroughtputTokenLimit::from_u64(13000), ), ]; -#[transaction] +#[transaction(gas = 10000)] fn apply_tx(ctx: &mut Ctx, _tx_data: BatchedTx) -> TxResult { // Enable IBC deposit/withdraws limits for (channel_id, base_token, mint_limit, throughput_limit) in IBC_TOKENS { @@ -49,9 +49,7 @@ fn apply_tx(ctx: &mut Ctx, _tx_data: BatchedTx) -> TxResult { .unwrap_or_default(); // Update the allowlist and write the addition wasm storage keys per transaction - for (wasm_name, wasm_bytes) in [ - (TX_TRANSFER_NAME, TX_TRANSFER_BYTES) - ] { + for (wasm_name, wasm_bytes) in [(TX_TRANSFER_NAME, TX_TRANSFER_BYTES)] { let tx_hash = CodeHash::sha256(wasm_bytes); if current_tx_allowlist.contains(&tx_hash.to_string()) {