Skip to content

Commit

Permalink
try fix github actions Check error
Browse files Browse the repository at this point in the history
  • Loading branch information
ltfschoen committed Sep 8, 2021
1 parent f77b639 commit 4195838
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 45 deletions.
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
rustup update stable
rustup toolchain install nightly-2021-08-31
rustup default nightly-2021-08-31
rustup override set nightly-2021-08-31
rustup target add wasm32-unknown-unknown --toolchain nightly-2021-08-31
cargo build --release
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ jobs:
with:
profile: minimal
toolchain: nightly
override: true

- name: Initialize WASM build environment
run: |
rustup update stable
rustup toolchain install nightly-2021-08-31
rustup default nightly-2021-08-31
rustup override set nightly-2021-08-31
rustup target add wasm32-unknown-unknown --toolchain nightly-2021-08-31
- name: Run cargo check
Expand All @@ -52,12 +54,14 @@ jobs:
with:
profile: minimal
toolchain: nightly
override: true

- name: Initialize WASM build environment
run: |
rustup update stable
rustup toolchain install nightly-2021-08-31
rustup default nightly-2021-08-31
rustup override set nightly-2021-08-31
rustup target add wasm32-unknown-unknown --toolchain nightly-2021-08-31
# Runs integration tests in the runtime/tests folder
Expand Down
90 changes: 45 additions & 45 deletions pallets/mining/rewards-allowance/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,51 +244,51 @@ pub mod pallet {
impl<T: Config> Pallet<T> {
// customised by governance at any time. this function allows us to change it each year
// https://docs.google.com/spreadsheets/d/1W2AzOH9Cs9oCR8UYfYCbpmd9X7hp-USbYXL7AuwMY_Q/edit#gid=970997021
#[pallet::weight(10_000 + T::DbWeight::get().writes(1))]
pub fn set_bonded_dhx_of_account_for_date(origin: OriginFor<T>, account_id: T::AccountId) -> DispatchResult {
let _who = ensure_signed(origin)?;

// Note: we DO need the following as we're using the current timestamp, rather than a function parameter.
let timestamp: <T as pallet_timestamp::Config>::Moment = <pallet_timestamp::Pallet<T>>::get();
let requested_date_as_u64 = Self::convert_moment_to_u64_in_milliseconds(timestamp.clone())?;
log::info!("requested_date_as_u64: {:?}", requested_date_as_u64.clone());

// convert the requested date/time to the start of that day date/time to signify that date for lookup
// i.e. 21 Apr @ 1420 -> 21 Apr @ 0000
let requested_date_millis = Self::convert_u64_in_milliseconds_to_start_of_date(requested_date_as_u64.clone())?;

// TODO - fetch from democracy or elections
let bonded_dhx_current_u128 = 1000u128;

let bonded_dhx_current;
let _bonded_dhx_current = Self::convert_u128_to_balance(bonded_dhx_current_u128.clone());
match _bonded_dhx_current {
Err(_e) => {
log::error!("Unable to convert u128 to balance for bonded_dhx_current");
return Err(DispatchError::Other("Unable to convert u128 to balance for bonded_dhx_current"));
},
Ok(ref x) => {
bonded_dhx_current = x;
}
}

let bonded_data: BondedData<T> = BondedDHXForAccountData {
account_id: account_id.clone(),
bonded_dhx_current: bonded_dhx_current.clone(),
requestor_account_id: _who.clone(),
};

// Update storage. Override the default that may have been set in on_initialize
<RewardsAllowanceDHXForDate<T>>::insert(requested_date_millis.clone(), &bonded_data);
log::info!("account_id: {:?}", &account_id);
log::info!("bonded_data: {:?}", &bonded_data);

// Emit an event.
// TODO

// Return a successful DispatchResultWithPostInfo
Ok(())
}
// #[pallet::weight(10_000 + T::DbWeight::get().writes(1))]
// pub fn set_bonded_dhx_of_account_for_date(origin: OriginFor<T>, account_id: T::AccountId) -> DispatchResult {
// let _who = ensure_signed(origin)?;

// // Note: we DO need the following as we're using the current timestamp, rather than a function parameter.
// let timestamp: <T as pallet_timestamp::Config>::Moment = <pallet_timestamp::Pallet<T>>::get();
// let requested_date_as_u64 = Self::convert_moment_to_u64_in_milliseconds(timestamp.clone())?;
// log::info!("requested_date_as_u64: {:?}", requested_date_as_u64.clone());

// // convert the requested date/time to the start of that day date/time to signify that date for lookup
// // i.e. 21 Apr @ 1420 -> 21 Apr @ 0000
// let requested_date_millis = Self::convert_u64_in_milliseconds_to_start_of_date(requested_date_as_u64.clone())?;

// // TODO - fetch from democracy or elections
// let bonded_dhx_current_u128 = 1000u128;

// let bonded_dhx_current;
// let _bonded_dhx_current = Self::convert_u128_to_balance(bonded_dhx_current_u128.clone());
// match _bonded_dhx_current {
// Err(_e) => {
// log::error!("Unable to convert u128 to balance for bonded_dhx_current");
// return Err(DispatchError::Other("Unable to convert u128 to balance for bonded_dhx_current"));
// },
// Ok(ref x) => {
// bonded_dhx_current = x;
// }
// }

// let bonded_data: BondedData<T> = BondedDHXForAccountData {
// account_id: account_id.clone(),
// bonded_dhx_current: bonded_dhx_current.clone(),
// requestor_account_id: _who.clone(),
// };

// // Update storage. Override the default that may have been set in on_initialize
// <RewardsAllowanceDHXForDate<T>>::insert(requested_date_millis.clone(), &bonded_data);
// log::info!("account_id: {:?}", &account_id);
// log::info!("bonded_data: {:?}", &bonded_data);

// // Emit an event.
// // TODO

// // Return a successful DispatchResultWithPostInfo
// Ok(())
// }

// customised by governance at any time
#[pallet::weight(10_000 + T::DbWeight::get().writes(1))]
Expand Down

0 comments on commit 4195838

Please sign in to comment.