Skip to content

Commit 174dd84

Browse files
committed
Remove height parameter in update-pool + write docs for update-pool / prepare-update
1 parent 4852efa commit 174dd84

File tree

3 files changed

+15
-22
lines changed

3 files changed

+15
-22
lines changed

core/src/box_kind/ballot_box.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,6 @@ pub fn make_local_ballot_box_candidate(
197197
value: BoxValue,
198198
creation_height: u32,
199199
) -> Result<ErgoBoxCandidate, ErgoBoxCandidateBuilderError> {
200-
dbg!(&reward_tokens);
201200
let mut builder = ErgoBoxCandidateBuilder::new(value, contract.ergo_tree(), creation_height);
202201
builder.set_register_value(
203202
NonMandatoryRegisterId::R4,

core/src/cli_commands/update_pool.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ pub fn update_pool(
7272
new_pool_box_hash_str: Option<String>,
7373
reward_token_id: Option<String>,
7474
reward_token_amount: Option<u64>,
75-
height: Option<u64>,
7675
) -> Result<(), UpdatePoolError> {
7776
info!("Opening oracle_config_updated.yaml");
7877
let s = std::fs::read_to_string("oracle_config_updated.yaml")?;
@@ -113,22 +112,18 @@ pub fn update_pool(
113112

114113
if new_pool_box_hash_str.is_none() {
115114
println!(
116-
"Run ./oracle-core --new_pool_box_hash {} --height HEIGHT to update pool",
115+
"Run ./oracle-core --new_pool_box_hash {} to update pool",
117116
String::from(new_pool_box_hash)
118117
);
119118
return Ok(());
120119
}
121-
let height = height.unwrap();
122120
let new_reward_tokens = reward_token_id
123121
.zip(reward_token_amount)
124122
.map(|(token_id, amount)| Token {
125123
token_id: TokenId::from_base64(&token_id).unwrap(),
126124
amount: amount.try_into().unwrap(),
127125
});
128-
if height != current_block_height()? {
129-
println!("Height outdated, please use current blockchain height");
130-
std::process::exit(exitcode::SOFTWARE);
131-
}
126+
132127
let tx = build_update_pool_box_tx(
133128
op.get_pool_box_source(),
134129
op.get_ballot_boxes_source(),

core/src/main.rs

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -104,17 +104,13 @@ enum Command {
104104
},
105105

106106
/// Extract reward tokens to a chosen address
107-
ExtractRewardTokens {
108-
rewards_address: String,
109-
},
107+
ExtractRewardTokens { rewards_address: String },
110108

111109
/// Print the number of reward tokens earned by the oracle.
112110
PrintRewardTokens,
113111

114112
/// Transfer an oracle token to a chosen address.
115-
TransferOracleToken {
116-
oracle_token_address: String,
117-
},
113+
TransferOracleToken { oracle_token_address: String },
118114

119115
/// Vote to update the oracle pool
120116
VoteUpdatePool {
@@ -127,14 +123,21 @@ enum Command {
127123
/// The creation height of the update box.
128124
update_box_creation_height: u32,
129125
},
126+
/// Initiate the Update Pool transaction.
127+
/// Run with no arguments to to show diff between oracle_config.yaml and oracle_config_updated.yaml
128+
/// Updated config file must be created using --prepare-update command first
130129
UpdatePool {
130+
/// New pool box hash. Must match hash of updated pool contract
131131
new_pool_box_hash: Option<String>,
132+
/// New reward token id (optional)
132133
reward_token_id: Option<String>,
134+
/// New reward token amount, required if new token id was voted for
133135
reward_token_amount: Option<u64>,
134-
height: Option<u64>,
135136
},
137+
/// Prepare updating oracle pool with new contracts/parameters.
136138
PrepareUpdate {
137-
update_bootstrap_file: String,
139+
/// Name of update parameters file (.yaml)
140+
update_file: String,
138141
},
139142
}
140143

@@ -255,24 +258,20 @@ fn main() {
255258
new_pool_box_hash,
256259
reward_token_id,
257260
reward_token_amount,
258-
height,
259261
} => {
260262
assert_wallet_unlocked(&new_node_interface());
261263
if let Err(e) = cli_commands::update_pool::update_pool(
262264
new_pool_box_hash,
263265
reward_token_id,
264266
reward_token_amount,
265-
height,
266267
) {
267268
error!("Fatal update-pool error: {}", e);
268269
std::process::exit(exitcode::SOFTWARE);
269270
}
270271
}
271-
Command::PrepareUpdate {
272-
update_bootstrap_file,
273-
} => {
272+
Command::PrepareUpdate { update_file } => {
274273
assert_wallet_unlocked(&new_node_interface());
275-
if let Err(e) = cli_commands::update::prepare_update(update_bootstrap_file) {
274+
if let Err(e) = cli_commands::update::prepare_update(update_file) {
276275
error!("Fatal update error : {}", e);
277276
std::process::exit(exitcode::SOFTWARE);
278277
}

0 commit comments

Comments
 (0)