Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dapp staking v3 - part 4 #1053

Merged
merged 53 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
0a7c519
EraRewardSpan
Dinonard Oct 11, 2023
e598d1b
Initial version of claim_staker_reward
Dinonard Oct 12, 2023
fff0656
Tests
Dinonard Oct 12, 2023
0daae3a
Test utils for claim-staker
Dinonard Oct 13, 2023
ebae663
Bug fixes, improvements
Dinonard Oct 13, 2023
c76ade9
Claim improvements & some tests
Dinonard Oct 13, 2023
096726e
Refactoring in progress
Dinonard Oct 16, 2023
39c6cf0
Refactoring continued
Dinonard Oct 16, 2023
e77327d
Refactoring progress
Dinonard Oct 17, 2023
025f0b7
Refactoring finished
Dinonard Oct 17, 2023
80a0e4f
Bonus rewards
Dinonard Oct 18, 2023
82c71ad
Docs & some minor changes
Dinonard Oct 18, 2023
582aef4
Comments, tests, improved coverage
Dinonard Oct 18, 2023
b25ccb1
Tier params & config init solution
Dinonard Oct 20, 2023
3d2d146
Tier reward calculation WIP
Dinonard Oct 20, 2023
894d10d
Tier assignemnt
Dinonard Oct 23, 2023
ff61cf1
Minor cleanup
Dinonard Oct 24, 2023
3ded046
Claim dapp rewards
Dinonard Oct 24, 2023
f2f8a5f
Claim dapp reward tests
Dinonard Oct 24, 2023
03d88f4
unstake from unregistered call
Dinonard Oct 24, 2023
ea3e23d
Extra traits
Dinonard Oct 24, 2023
7558682
fixes
Dinonard Oct 24, 2023
e0f19e1
Extra calls
Dinonard Oct 25, 2023
4926838
Refactoring
Dinonard Oct 25, 2023
d47bcf4
More refactoring, improvements, TODO solving
Dinonard Oct 25, 2023
0197c95
Local integration
Dinonard Oct 25, 2023
4ea8556
Genesis config
Dinonard Oct 25, 2023
589575b
Add forcing call
Dinonard Oct 25, 2023
1e80e09
try runtime build fix
Dinonard Oct 25, 2023
fbe4c4d
Minor changes
Dinonard Oct 26, 2023
12d01fd
Minor
Dinonard Oct 27, 2023
d725575
Formatting
Dinonard Oct 27, 2023
72d3983
Benchmarks INIT
Dinonard Oct 27, 2023
f0c14cc
Compiling benchmarks
Dinonard Oct 27, 2023
e2447b3
Fix
Dinonard Oct 30, 2023
4b9e03d
dapp tier calculation benchmark
Dinonard Oct 30, 2023
8982e10
Measured tier assignment
Dinonard Oct 30, 2023
ee50c2d
Decending rewards in benchmarks
Dinonard Oct 30, 2023
67de44c
Series refactoring & partial tests
Dinonard Oct 31, 2023
c586a6c
Comments, minor changes
Dinonard Oct 31, 2023
5cf60a1
Tests, improvements
Dinonard Oct 31, 2023
7a3c634
More tests, some minor refactoring
Dinonard Nov 2, 2023
c47d36e
Formatting
Dinonard Nov 2, 2023
d36839c
More benchmarks & experiments, refactoring
Dinonard Nov 2, 2023
d0d196e
Readme, docs
Dinonard Nov 2, 2023
9723d9f
Minor renaming, docs
Dinonard Nov 3, 2023
24b4b53
More docs
Dinonard Nov 3, 2023
408eaad
More docs
Dinonard Nov 3, 2023
fd65f20
Minor addition
Dinonard Nov 7, 2023
8fe1563
Review comment fixes & changes
Dinonard Nov 9, 2023
3b894ef
Minor change
Dinonard Nov 10, 2023
7cc82da
Review comments
Dinonard Nov 10, 2023
cc1efcc
Update frontier to make CI pass
Dinonard Nov 13, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 28 additions & 24 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ pallet-block-reward = { path = "./pallets/block-reward", default-features = fals
pallet-collator-selection = { path = "./pallets/collator-selection", default-features = false }
pallet-custom-signatures = { path = "./pallets/custom-signatures", default-features = false }
pallet-dapps-staking = { path = "./pallets/dapps-staking", default-features = false }
pallet-dapp-staking-v3 = { path = "./pallets/dapp-staking-v3", default-features = false }
pallet-xc-asset-config = { path = "./pallets/xc-asset-config", default-features = false }
pallet-xvm = { path = "./pallets/xvm", default-features = false }
pallet-xcm = { path = "./pallets/pallet-xcm", default-features = false }
Expand Down
1 change: 1 addition & 0 deletions bin/collator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ shiden-runtime = { workspace = true, features = ["std"] }
# astar pallets dependencies
astar-primitives = { workspace = true }
pallet-block-reward = { workspace = true }
pallet-dapp-staking-v3 = { workspace = true }

# frame dependencies
frame-system = { workspace = true, features = ["std"] }
Expand Down
42 changes: 37 additions & 5 deletions bin/collator/src/local/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,19 @@

use local_runtime::{
wasm_binary_unwrap, AccountId, AuraConfig, AuraId, BalancesConfig, BaseFeeConfig,
BlockRewardConfig, CouncilConfig, DemocracyConfig, EVMConfig, GenesisConfig, GrandpaConfig,
GrandpaId, Precompiles, Signature, SudoConfig, SystemConfig, TechnicalCommitteeConfig,
TreasuryConfig, VestingConfig,
BlockRewardConfig, CouncilConfig, DappStakingConfig, DemocracyConfig, EVMConfig, GenesisConfig,
GrandpaConfig, GrandpaId, Precompiles, Signature, SudoConfig, SystemConfig,
TechnicalCommitteeConfig, TreasuryConfig, VestingConfig, AST,
};
use sc_service::ChainType;
use sp_core::{crypto::Ss58Codec, sr25519, Pair, Public};
use sp_runtime::{
traits::{IdentifyAccount, Verify},
Perbill,
Perbill, Permill,
};

use pallet_dapp_staking_v3::TierThreshold;

type AccountPublic = <Signature as Verify>::Signer;

/// Specialized `ChainSpec` for Shiden Network.
Expand Down Expand Up @@ -112,7 +114,7 @@ fn testnet_genesis(
balances: endowed_accounts
.iter()
.cloned()
.map(|k| (k, 1_000_000_000_000_000_000_000_000_000))
.map(|k| (k, 1_000_000_000 * AST))
.collect(),
},
block_reward: BlockRewardConfig {
Expand Down Expand Up @@ -181,6 +183,36 @@ fn testnet_genesis(
},
democracy: DemocracyConfig::default(),
treasury: TreasuryConfig::default(),
dapp_staking: DappStakingConfig {
reward_portion: vec![
Permill::from_percent(40),
Permill::from_percent(30),
Permill::from_percent(20),
Permill::from_percent(10),
],
slot_distribution: vec![
Permill::from_percent(10),
Permill::from_percent(20),
Permill::from_percent(30),
Permill::from_percent(40),
],
tier_thresholds: vec![
TierThreshold::DynamicTvlAmount {
amount: 100 * AST,
minimum_amount: 80 * AST,
},
TierThreshold::DynamicTvlAmount {
amount: 50 * AST,
minimum_amount: 40 * AST,
},
TierThreshold::DynamicTvlAmount {
amount: 20 * AST,
minimum_amount: 20 * AST,
},
TierThreshold::FixedTvlAmount { amount: 10 * AST },
],
slots_per_tier: vec![10, 20, 30, 40],
},
}
}

Expand Down
11 changes: 11 additions & 0 deletions pallets/dapp-staking-v3/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ sp-std = { workspace = true }

astar-primitives = { workspace = true }

frame-benchmarking = { workspace = true, optional = true }

[dev-dependencies]
pallet-balances = { workspace = true }

Expand All @@ -42,4 +44,13 @@ std = [
"frame-system/std",
"pallet-balances/std",
"astar-primitives/std",
"frame-benchmarking/std",
]
runtime-benchmarks = [
"frame-benchmarking",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"astar-primitives/runtime-benchmarks",
]
try-runtime = ["frame-support/try-runtime"]
Loading
Loading