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

feat: Rewards tokens for locking after cooldown period. Remove separate execution module. #133

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
16a7851
refactor: Remove execution runtime module and merge into config module
ltfschoen Mar 1, 2021
23cc7c5
refactor: Rename without duplicate _token
ltfschoen Mar 1, 2021
8e753b7
wip
ltfschoen Mar 1, 2021
1f594c2
wip
ltfschoen Mar 2, 2021
2922d52
fixes
festelo Mar 2, 2021
7fdc96d
wip
ltfschoen Mar 3, 2021
c6bcb1e
fix type conversion thanks to ilya
ltfschoen Mar 3, 2021
1409c6e
try move into balance_to_u32 fn
ltfschoen Mar 3, 2021
c5a3019
revert back to ilya solution
ltfschoen Mar 3, 2021
984f849
feat: Got treasury transfer reward to compile
ltfschoen Mar 3, 2021
cf8dfc1
feat: use BalanceOf and Balance types to get post-cooldown event to c…
ltfschoen Mar 3, 2021
85c908d
wip
ltfschoen Mar 3, 2021
60e8ce7
wip - remove use of roaming_operators from token_mining_config
ltfschoen Mar 3, 2021
480f9fc
remove roaming_operators dependency in mining_tokens_config
ltfschoen Mar 3, 2021
3a5825c
change to BalanceOf, add Currency to runtime instead of use balances
ltfschoen Mar 5, 2021
0089aa6
wip
ltfschoen Mar 5, 2021
af6d6f8
wip
ltfschoen Mar 5, 2021
e841565
compiles now
ltfschoen Mar 5, 2021
acd9a75
clean up'
ltfschoen Mar 5, 2021
7693a14
add question on how to do tests
ltfschoen Mar 5, 2021
e84fe27
add fixme comment
ltfschoen Mar 5, 2021
492dbb0
merge latest master
ltfschoen Mar 5, 2021
083daf2
remove newline
ltfschoen Mar 5, 2021
8783741
lint
ltfschoen Mar 5, 2021
bd0be46
try get tests to pass
ltfschoen Mar 6, 2021
173b843
fix errors so compiles
ltfschoen Mar 6, 2021
ec6462b
remove comments
ltfschoen Mar 6, 2021
eb6e7cb
configure start block to be 0
ltfschoen Mar 6, 2021
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
3 changes: 1 addition & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ jobs:
cargo +nightly-2020-10-06 test -p mining-eligibility-hardware &&
cargo +nightly-2020-10-06 test -p mining-claims-token &&
cargo +nightly-2020-10-06 test -p mining-claims-hardware &&
cargo +nightly-2020-10-06 test -p mining-execution-token &&
cargo +nightly-2020-10-06 test -p exchange-rate
cargo +nightly-2020-10-06 test -p exchange-rate

lints:
name: Lints
Expand Down
26 changes: 2 additions & 24 deletions Cargo.lock

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

3 changes: 2 additions & 1 deletion EXAMPLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ rm -rf /tmp/polkadot-chains/alice /tmp/polkadot-chains/bob /tmp/polkadot-chains/
--base-path /tmp/polkadot-chains/alice \
--name "Data Highway Development Chain" \
--dev \
--telemetry-url "wss://telemetry.polkadot.io/submit/ 0"
--telemetry-url "wss://telemetry.polkadot.io/submit/ 0" \
-lruntime=debug
```

## Example "local" PoS testnet (with multiple nodes) <a id="chapter-f21efd"></a>
Expand Down
18 changes: 8 additions & 10 deletions custom_types.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@
"MiningConfigTokenConfig": {
"token_type": "Text",
"token_lock_amount": "u64",
"token_lock_start_block": "Moment",
"token_lock_interval_blocks": "Moment"
"token_lock_start_block": "u64",
"token_lock_interval_blocks": "u64"
},
"MiningConfigTokenRequirementsConfig": {
"token_type": "Text",
Expand All @@ -146,6 +146,12 @@
"hardware_lock_start_block": "Moment",
"hardware_lock_interval_blocks": "Moment"
},
"MiningConfigTokenExecutorAccountID": "u64",
"MiningConfigTokenExecutionResult": {
"token_execution_executor_account_id": "u64",
"token_execution_started_block": "u64",
"token_execution_interval_blocks": "u64"
},
"MiningSamplingToken": "[u8; 16]",
"MiningSamplingTokenIndex": "u64",
"MiningSamplingTokenSampleLockedAmount": "u64",
Expand Down Expand Up @@ -196,14 +202,6 @@
"hardware_claim_amount": "u64",
"hardware_claim_block_redeemed": "u64"
},
"MiningExecutionToken": "[u8; 16]",
"MiningExecutionTokenIndex": "u64",
"MiningExecutionTokenExecutorAccountID": "u64",
"MiningExecutionTokenExecutionResult": {
"token_execution_exector_account_id": "u64",
"token_execution_started_block": "Moment",
"token_execution_ended_block": "Moment"
},
"ExchangeRateIndex": "u64",
"ExchangeRateConfig": {
"hbtc": "u64",
Expand Down
2 changes: 1 addition & 1 deletion pallets/exchange-rate/src/lib.rs
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ impl<T: Trait> Module<T> {

fn random_value(sender: &T::AccountId) -> [u8; 16] {
let payload = (
T::Randomness::random(&[0]),
<T as roaming_operators::Trait>::Randomness::random(&[0]),
sender,
<frame_system::Module<T>>::extrinsic_index(),
<frame_system::Module<T>>::block_number(),
Expand Down
2 changes: 1 addition & 1 deletion pallets/mining/claims/hardware/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ impl<T: Trait> Module<T> {

fn random_value(sender: &T::AccountId) -> [u8; 16] {
let payload = (
T::Randomness::random(&[0]),
<T as roaming_operators::Trait>::Randomness::random(&[0]),
sender,
<frame_system::Module<T>>::extrinsic_index(),
<frame_system::Module<T>>::block_number(),
Expand Down
4 changes: 2 additions & 2 deletions pallets/mining/claims/token/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ decl_module! {
// FIXME
// let current_block = <frame_system::Module<T>>::block_number();
// // Get the config associated with the given configuration_token
// if let Some(configuration_token_config) = <mining_config_token::Module<T>>::mining_config_token_token_configs(mining_config_token_id) {
// if let Some(configuration_token_config) = <mining_config_token::Module<T>>::mining_config_token_configs(mining_config_token_id) {
// if let _token_lock_interval_blocks = configuration_token_config.token_lock_interval_blocks {
// ensure!(current_block > _token_lock_interval_blocks, "Claim may not be made until after the end of the lock interval");
// } else {
Expand Down Expand Up @@ -475,7 +475,7 @@ impl<T: Trait> Module<T> {

fn random_value(sender: &T::AccountId) -> [u8; 16] {
let payload = (
T::Randomness::random(&[0]),
<T as roaming_operators::Trait>::Randomness::random(&[0]),
sender,
<frame_system::Module<T>>::extrinsic_index(),
<frame_system::Module<T>>::block_number(),
Expand Down
2 changes: 1 addition & 1 deletion pallets/mining/config/hardware/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ impl<T: Trait> Module<T> {

fn random_value(sender: &T::AccountId) -> [u8; 16] {
let payload = (
T::Randomness::random(&[0]),
<T as roaming_operators::Trait>::Randomness::random(&[0]),
sender,
<frame_system::Module<T>>::extrinsic_index(),
<frame_system::Module<T>>::block_number(),
Expand Down
4 changes: 4 additions & 0 deletions pallets/mining/config/token/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ std = [
'pallet-balances/std',
'pallet-randomness-collective-flip/std',
'pallet-transaction-payment/std',
'pallet-treasury/std',
'sp-core/std',
'sp-io/std',
'sp-runtime/std',
'sp-std/std',

'roaming-operators/std',
'mining-rates-token/std',
]

[dependencies]
Expand All @@ -30,11 +32,13 @@ frame-system = { version = '2.0.0', default_features = false }
pallet-balances = { version = '2.0.0', default_features = false }
pallet-randomness-collective-flip = { version = '2.0.0', default_features = false }
pallet-transaction-payment = { version = '2.0.0', default_features = false }
pallet-treasury = { version = '2.0.0', default-features = false }
sp-core = { version = '2.0.0', default_features = false }
sp-io = { version = '2.0.0', default_features = false }
sp-runtime = { version = '2.0.0', default_features = false }
sp-std = { version = '2.0.0', default_features = false }

roaming-operators = { default_features = false, package = 'roaming-operators', path = '../../../roaming/roaming-operators' }
mining-rates-token = { default_features = false, package = 'mining-rates-token', path = '../../../mining/rates/token' }

[dev-dependencies]
Loading