@@ -244,51 +244,51 @@ pub mod pallet {
244244 impl < T : Config > Pallet < T > {
245245 // customised by governance at any time. this function allows us to change it each year
246246 // https://docs.google.com/spreadsheets/d/1W2AzOH9Cs9oCR8UYfYCbpmd9X7hp-USbYXL7AuwMY_Q/edit#gid=970997021
247- #[ pallet:: weight( 10_000 + T :: DbWeight :: get( ) . writes( 1 ) ) ]
248- pub fn set_bonded_dhx_of_account_for_date ( origin : OriginFor < T > , account_id : T :: AccountId ) -> DispatchResult {
249- let _who = ensure_signed ( origin) ?;
250-
251- // Note: we DO need the following as we're using the current timestamp, rather than a function parameter.
252- let timestamp: <T as pallet_timestamp:: Config >:: Moment = <pallet_timestamp:: Pallet < T > >:: get ( ) ;
253- let requested_date_as_u64 = Self :: convert_moment_to_u64_in_milliseconds ( timestamp. clone ( ) ) ?;
254- log:: info!( "requested_date_as_u64: {:?}" , requested_date_as_u64. clone( ) ) ;
255-
256- // convert the requested date/time to the start of that day date/time to signify that date for lookup
257- // i.e. 21 Apr @ 1420 -> 21 Apr @ 0000
258- let requested_date_millis = Self :: convert_u64_in_milliseconds_to_start_of_date ( requested_date_as_u64. clone ( ) ) ?;
259-
260- // TODO - fetch from democracy or elections
261- let bonded_dhx_current_u128 = 1000u128 ;
262-
263- let bonded_dhx_current;
264- let _bonded_dhx_current = Self :: convert_u128_to_balance ( bonded_dhx_current_u128. clone ( ) ) ;
265- match _bonded_dhx_current {
266- Err ( _e) => {
267- log:: error!( "Unable to convert u128 to balance for bonded_dhx_current" ) ;
268- return Err ( DispatchError :: Other ( "Unable to convert u128 to balance for bonded_dhx_current" ) ) ;
269- } ,
270- Ok ( ref x) => {
271- bonded_dhx_current = x;
272- }
273- }
274-
275- let bonded_data: BondedData < T > = BondedDHXForAccountData {
276- account_id : account_id. clone ( ) ,
277- bonded_dhx_current : bonded_dhx_current. clone ( ) ,
278- requestor_account_id : _who. clone ( ) ,
279- } ;
280-
281- // Update storage. Override the default that may have been set in on_initialize
282- <RewardsAllowanceDHXForDate < T > >:: insert ( requested_date_millis. clone ( ) , & bonded_data) ;
283- log:: info!( "account_id: {:?}" , & account_id) ;
284- log:: info!( "bonded_data: {:?}" , & bonded_data) ;
285-
286- // Emit an event.
287- // TODO
288-
289- // Return a successful DispatchResultWithPostInfo
290- Ok ( ( ) )
291- }
247+ // #[pallet::weight(10_000 + T::DbWeight::get().writes(1))]
248+ // pub fn set_bonded_dhx_of_account_for_date(origin: OriginFor<T>, account_id: T::AccountId) -> DispatchResult {
249+ // let _who = ensure_signed(origin)?;
250+
251+ // // Note: we DO need the following as we're using the current timestamp, rather than a function parameter.
252+ // let timestamp: <T as pallet_timestamp::Config>::Moment = <pallet_timestamp::Pallet<T>>::get();
253+ // let requested_date_as_u64 = Self::convert_moment_to_u64_in_milliseconds(timestamp.clone())?;
254+ // log::info!("requested_date_as_u64: {:?}", requested_date_as_u64.clone());
255+
256+ // // convert the requested date/time to the start of that day date/time to signify that date for lookup
257+ // // i.e. 21 Apr @ 1420 -> 21 Apr @ 0000
258+ // let requested_date_millis = Self::convert_u64_in_milliseconds_to_start_of_date(requested_date_as_u64.clone())?;
259+
260+ // // TODO - fetch from democracy or elections
261+ // let bonded_dhx_current_u128 = 1000u128;
262+
263+ // let bonded_dhx_current;
264+ // let _bonded_dhx_current = Self::convert_u128_to_balance(bonded_dhx_current_u128.clone());
265+ // match _bonded_dhx_current {
266+ // Err(_e) => {
267+ // log::error!("Unable to convert u128 to balance for bonded_dhx_current");
268+ // return Err(DispatchError::Other("Unable to convert u128 to balance for bonded_dhx_current"));
269+ // },
270+ // Ok(ref x) => {
271+ // bonded_dhx_current = x;
272+ // }
273+ // }
274+
275+ // let bonded_data: BondedData<T> = BondedDHXForAccountData {
276+ // account_id: account_id.clone(),
277+ // bonded_dhx_current: bonded_dhx_current.clone(),
278+ // requestor_account_id: _who.clone(),
279+ // };
280+
281+ // // Update storage. Override the default that may have been set in on_initialize
282+ // <RewardsAllowanceDHXForDate<T>>::insert(requested_date_millis.clone(), &bonded_data);
283+ // log::info!("account_id: {:?}", &account_id);
284+ // log::info!("bonded_data: {:?}", &bonded_data);
285+
286+ // // Emit an event.
287+ // // TODO
288+
289+ // // Return a successful DispatchResultWithPostInfo
290+ // Ok(())
291+ // }
292292
293293 // customised by governance at any time
294294 #[ pallet:: weight( 10_000 + T :: DbWeight :: get( ) . writes( 1 ) ) ]
0 commit comments