Open dbuchacher opened 2 years ago
You can use .try_into() to convert the vectors to bounded vectors.
// Action to solve the math problem
pub fn action_solve_math_problem(
math_problem_answer: u64,
math_bounty_box: MathBountyBox,
current_height: u64,
transaction_fee: u64,
ergs_box_for_fee: ErgsBox,
user_address: String
) -> UnsignedTransaction {
let tx_inputs = vec![
math_bounty_box.as_unsigned_input(),
ergs_box_for_fee.as_unsigned_input(),
].try_into().unwrap();
// Leftover bounty after paying transaction fee
let bounty_after_fee = math_bounty_box.nano_ergs() - transaction_fee;
// Register integers are signed
let r4 = Constant::from(math_problem_answer as i64);
let withdraw_bounty_candidate = create_candidate(
bounty_after_fee,
&user_address,
&vec![],
&vec![r4],
current_height
).unwrap();
let transaction_fee_candidate =
TxFeeBox::output_candidate(transaction_fee, current_height).unwrap();
let output_candidates = vec![
withdraw_bounty_candidate,
transaction_fee_candidate
].try_into().unwrap();
UnsignedTransaction::new(tx_inputs, None, output_candidates).unwrap()
}```
Under:
Preparing Your Project
the current text doesn't work
update to?
Under:
This is the final code from everything we've accomplished in this tutorial:
the current lines not working
update to?
then there are now some issues with needing to use
bounded-vec
but I gave up at this point and now I'm writing this.console log