@@ -49,6 +49,7 @@ use crate::{
4949 SignTransactionWithInputs , SubmitTransaction ,
5050 } ,
5151 oracle_config:: { BASE_FEE , ORACLE_CONFIG } ,
52+ oracle_types:: { BlockHeight , EpochCounter } ,
5253 pool_config:: {
5354 PoolConfig , PoolConfigError , PredefinedDataPointSource , TokenIds ,
5455 DEFAULT_POOL_CONFIG_FILE_NAME ,
@@ -83,7 +84,7 @@ pub fn bootstrap(config_file_name: String) -> Result<(), BootstrapError> {
8384 tx_fee : * BASE_FEE ,
8485 erg_value_per_box,
8586 change_address : change_address. address ( ) ,
86- height : node_api. node . current_block_height ( ) ? as u32 ,
87+ height : BlockHeight ( node_api. node . current_block_height ( ) ? as u32 ) ,
8788 } ;
8889 let ( oracle_config, submitted_tx_ids) = perform_bootstrap_chained_transaction ( input) ?;
8990 wait_for_txs_confirmation ( submitted_tx_ids) ;
@@ -121,7 +122,7 @@ pub struct BootstrapInput<'a> {
121122 pub tx_fee : BoxValue ,
122123 pub erg_value_per_box : BoxValue ,
123124 pub change_address : Address ,
124- pub height : u32 ,
125+ pub height : BlockHeight ,
125126}
126127
127128/// Perform and submit to the mempool the chained-transaction to boostrap the oracle pool. We first
@@ -212,14 +213,15 @@ pub(crate) fn perform_bootstrap_chained_transaction(
212213 } ;
213214 let token_box_guard =
214215 different_token_box_guard. unwrap_or_else ( || wallet_pk_ergo_tree. clone ( ) ) ;
215- let mut builder = ErgoBoxCandidateBuilder :: new ( erg_value_per_box, token_box_guard, height) ;
216+ let mut builder =
217+ ErgoBoxCandidateBuilder :: new ( erg_value_per_box, token_box_guard, height. 0 ) ;
216218 builder. mint_token ( token. clone ( ) , token_name, token_desc, 0 ) ;
217219 let mut output_candidates = vec ! [ builder. build( ) ?] ;
218220
219221 let remaining_funds = ErgoBoxCandidateBuilder :: new (
220222 calc_target_balance ( * num_transactions_left - 1 ) ?,
221223 wallet_pk_ergo_tree. clone ( ) ,
222- height,
224+ height. 0 ,
223225 )
224226 . build ( ) ?;
225227 output_candidates. push ( remaining_funds. clone ( ) ) ;
@@ -228,7 +230,7 @@ pub(crate) fn perform_bootstrap_chained_transaction(
228230 let tx_builder = TxBuilder :: new (
229231 box_selection,
230232 output_candidates,
231- height,
233+ height. 0 ,
232234 tx_fee,
233235 change_address. clone ( ) ,
234236 ) ;
@@ -392,7 +394,7 @@ pub(crate) fn perform_bootstrap_chained_transaction(
392394 & pool_contract,
393395 // We intentionally set the initial datapoint to be 0, as it's treated as 'undefined' during bootstrap.
394396 0 ,
395- 1 ,
397+ EpochCounter ( 1 ) ,
396398 SpecToken {
397399 token_id : token_ids. pool_nft_token_id . clone ( ) ,
398400 amount : pool_nft_token. amount ,
@@ -410,7 +412,7 @@ pub(crate) fn perform_bootstrap_chained_transaction(
410412 let builder = ErgoBoxCandidateBuilder :: new (
411413 calc_target_balance ( num_transactions_left - 1 ) ?,
412414 wallet_pk_ergo_tree. clone ( ) ,
413- height,
415+ height. 0 ,
414416 ) ;
415417 output_candidates. push ( builder. build ( ) ?) ;
416418
@@ -442,7 +444,7 @@ pub(crate) fn perform_bootstrap_chained_transaction(
442444 let tx_builder = TxBuilder :: new (
443445 box_selection,
444446 output_candidates,
445- height,
447+ height. 0 ,
446448 tx_fee,
447449 change_address. clone ( ) ,
448450 ) ;
@@ -498,7 +500,7 @@ pub(crate) fn perform_bootstrap_chained_transaction(
498500 let tx_builder = TxBuilder :: new (
499501 box_selection,
500502 output_candidates,
501- height,
503+ height. 0 ,
502504 tx_fee,
503505 change_address. clone ( ) ,
504506 ) ;
@@ -721,7 +723,7 @@ pub(crate) mod tests {
721723
722724 let bootstrap_config = BootstrapConfig :: default ( ) ;
723725
724- let height = ctx. pre_header . height ;
726+ let height = BlockHeight ( ctx. pre_header . height ) ;
725727 let submit_tx = SubmitTxMock :: default ( ) ;
726728 let oracle_config = perform_bootstrap_chained_transaction ( BootstrapInput {
727729 oracle_address : address,
@@ -907,6 +909,6 @@ data_point_source_custom_script: ~
907909oracle_address: 3Wy3BaCjGDWE3bjjZkNo3aWaMz3cYrePMFhchcKovY9uG9vhpAuW
908910base_fee: 1100000
909911" ) . unwrap ( ) ;
910- assert_eq ! ( config. refresh_contract_parameters. min_data_points( ) , 2 ) ;
912+ assert_eq ! ( config. refresh_contract_parameters. min_data_points( ) . 0 , 2 ) ;
911913 }
912914}
0 commit comments