dice_contract¶
In [ ]:
//// package=../dice
open rust
open rust.rust_operators
In [ ]:
//// test
open testing
dice_contract¶
state¶
In [ ]:
type state =
{
version : u32
seeds : near.vector u8
}
In [ ]:
//// test
///! rust -c
()
00:00:02 i #2 near_workspaces.print_usd / { retry = 1; total_gas_burnt_usd = +0.000808; total_gas_burnt = 1209293011611 } 00:00:02 i #3 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:02 i #4 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000602; tokens_burnt_usd = +0.000602; gas_burnt = 901211152271; tokens_burnt = 90121115227100000000 } 00:00:02 w #5 spiral_wasm.run / Error error / { retry = 1; error = "{ receipt_outcomes_len = 1; retry = 1; receipt_failures = [] }" } 00:00:04 i #8 near_workspaces.print_usd / { retry = 2; total_gas_burnt_usd = +0.000808; total_gas_burnt = 1209293011611 } 00:00:04 i #9 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:04 i #10 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000602; tokens_burnt_usd = +0.000602; gas_burnt = 901211152271; tokens_burnt = 90121115227100000000 } 00:00:04 w #11 spiral_wasm.run / Error error / { retry = 2; error = "{ receipt_outcomes_len = 1; retry = 2; receipt_failures = [] }" } 00:00:06 i #14 near_workspaces.print_usd / { retry = 3; total_gas_burnt_usd = +0.000808; total_gas_burnt = 1209293011611 } 00:00:06 i #15 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:06 i #16 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000602; tokens_burnt_usd = +0.000602; gas_burnt = 901211152271; tokens_burnt = 90121115227100000000 } 00:00:06 w #17 spiral_wasm.run / Error error / { retry = 3; error = "{ receipt_outcomes_len = 1; retry = 3; receipt_failures = [] }" } 00:00:08 i #20 near_workspaces.print_usd / { retry = 4; total_gas_burnt_usd = +0.000808; total_gas_burnt = 1209293011611 } 00:00:08 i #21 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:08 i #22 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000602; tokens_burnt_usd = +0.000602; gas_burnt = 901211152271; tokens_burnt = 90121115227100000000 } 00:00:08 w #23 spiral_wasm.run / Error error / { retry = 4; error = "{ receipt_outcomes_len = 1; retry = 4; receipt_failures = [] }" } 00:00:10 i #26 near_workspaces.print_usd / { retry = 5; total_gas_burnt_usd = +0.000808; total_gas_burnt = 1209293011611 } 00:00:10 i #27 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:10 i #28 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000602; tokens_burnt_usd = +0.000602; gas_burnt = 901211152271; tokens_burnt = 90121115227100000000 } 00:00:10 w #29 spiral_wasm.run / Error error / { retry = 5; error = "{ receipt_outcomes_len = 1; retry = 5; receipt_failures = [] }" } 00:00:12 i #32 near_workspaces.print_usd / { retry = 6; total_gas_burnt_usd = +0.000808; total_gas_burnt = 1209293011611 } 00:00:12 i #33 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:12 i #34 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000602; tokens_burnt_usd = +0.000602; gas_burnt = 901211152271; tokens_burnt = 90121115227100000000 } 00:00:12 w #35 spiral_wasm.run / Error error / { retry = 6; error = "{ receipt_outcomes_len = 1; retry = 6; receipt_failures = [] }" } 00:00:14 i #38 near_workspaces.print_usd / { retry = 7; total_gas_burnt_usd = +0.000808; total_gas_burnt = 1209293011611 } 00:00:14 i #39 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:14 i #40 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000602; tokens_burnt_usd = +0.000602; gas_burnt = 901211152271; tokens_burnt = 90121115227100000000 } 00:00:14 w #41 spiral_wasm.run / Error error / { retry = 7; error = "{ receipt_outcomes_len = 1; retry = 7; receipt_failures = [] }" } 00:00:17 i #44 near_workspaces.print_usd / { retry = 8; total_gas_burnt_usd = +0.000808; total_gas_burnt = 1209293011611 } 00:00:17 i #45 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:17 i #46 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000602; tokens_burnt_usd = +0.000602; gas_burnt = 901211152271; tokens_burnt = 90121115227100000000 } 00:00:17 w #47 spiral_wasm.run / Error error / { retry = 8; error = "{ receipt_outcomes_len = 1; retry = 8; receipt_failures = [] }" } 00:00:19 i #50 near_workspaces.print_usd / { retry = 9; total_gas_burnt_usd = +0.000808; total_gas_burnt = 1209293011611 } 00:00:19 i #51 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:19 i #52 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000602; tokens_burnt_usd = +0.000602; gas_burnt = 901211152271; tokens_burnt = 90121115227100000000 } 00:00:19 w #53 spiral_wasm.run / Error error / { retry = 9; error = "{ receipt_outcomes_len = 1; retry = 9; receipt_failures = [] }" } 00:00:21 i #56 near_workspaces.print_usd / { retry = 10; total_gas_burnt_usd = +0.000808; total_gas_burnt = 1209293011611 } 00:00:21 i #57 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:21 i #58 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000602; tokens_burnt_usd = +0.000602; gas_burnt = 901211152271; tokens_burnt = 90121115227100000000 } 00:00:21 w #59 spiral_wasm.run / Error error / { retry = 10; error = "{ receipt_outcomes_len = 1; retry = 10; receipt_failures = [] }" } 00:00:23 i #62 near_workspaces.print_usd / { retry = 11; total_gas_burnt_usd = +0.000808; total_gas_burnt = 1209293011611 } 00:00:23 i #63 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:23 i #64 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000602; tokens_burnt_usd = +0.000602; gas_burnt = 901211152271; tokens_burnt = 90121115227100000000 } 00:00:23 w #65 spiral_wasm.run / Error error / { retry = 11; error = "{ receipt_outcomes_len = 1; retry = 11; receipt_failures = [] }" } 00:00:25 i #68 near_workspaces.print_usd / { retry = 12; total_gas_burnt_usd = +0.000808; total_gas_burnt = 1209293011611 } 00:00:25 i #69 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:25 i #70 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000602; tokens_burnt_usd = +0.000602; gas_burnt = 901211152271; tokens_burnt = 90121115227100000000 } 00:00:25 w #71 spiral_wasm.run / Error error / { retry = 12; error = "{ receipt_outcomes_len = 1; retry = 12; receipt_failures = [] }" } 00:00:27 i #74 near_workspaces.print_usd / { retry = 13; total_gas_burnt_usd = +0.000808; total_gas_burnt = 1209293011611 } 00:00:27 i #75 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:27 i #76 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000602; tokens_burnt_usd = +0.000602; gas_burnt = 901211152271; tokens_burnt = 90121115227100000000 } 00:00:27 w #77 spiral_wasm.run / Error error / { retry = 13; error = "{ receipt_outcomes_len = 1; retry = 13; receipt_failures = [] }" } 00:00:29 i #80 near_workspaces.print_usd / { retry = 14; total_gas_burnt_usd = +0.000808; total_gas_burnt = 1209293011611 } 00:00:29 i #81 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:29 i #82 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000602; tokens_burnt_usd = +0.000602; gas_burnt = 901211152271; tokens_burnt = 90121115227100000000 } 00:00:29 w #83 spiral_wasm.run / Error error / { retry = 14; error = "{ receipt_outcomes_len = 1; retry = 14; receipt_failures = [] }" } 00:00:32 i #86 near_workspaces.print_usd / { retry = 15; total_gas_burnt_usd = +0.000808; total_gas_burnt = 1209293011611 } 00:00:32 i #87 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:32 i #88 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000602; tokens_burnt_usd = +0.000602; gas_burnt = 901211152271; tokens_burnt = 90121115227100000000 } 00:00:32 w #89 spiral_wasm.run / Error error / { retry = 15; error = "{ receipt_outcomes_len = 1; retry = 15; receipt_failures = [] }" }
In [ ]:
//// test
///! rust -c
trace Verbose (fun () => "") id
00:00:02 i #2 near_workspaces.print_usd / { retry = 1; total_gas_burnt_usd = +0.000883; total_gas_burnt = 1322162469146 } 00:00:02 i #3 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:02 i #4 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000677; tokens_burnt_usd = +0.000677; gas_burnt = 1014080609806; tokens_burnt = 101408060980600000000 } 00:00:02 w #5 spiral_wasm.run / Error error / { retry = 1; error = "{ receipt_outcomes_len = 1; retry = 1; receipt_failures = [] }" } 00:00:04 i #8 near_workspaces.print_usd / { retry = 2; total_gas_burnt_usd = +0.000883; total_gas_burnt = 1322162469146 } 00:00:04 i #9 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:04 i #10 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000677; tokens_burnt_usd = +0.000677; gas_burnt = 1014080609806; tokens_burnt = 101408060980600000000 } 00:00:04 w #11 spiral_wasm.run / Error error / { retry = 2; error = "{ receipt_outcomes_len = 1; retry = 2; receipt_failures = [] }" } 00:00:07 i #14 near_workspaces.print_usd / { retry = 3; total_gas_burnt_usd = +0.000883; total_gas_burnt = 1322162469146 } 00:00:07 i #15 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:07 i #16 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000677; tokens_burnt_usd = +0.000677; gas_burnt = 1014080609806; tokens_burnt = 101408060980600000000 } 00:00:07 w #17 spiral_wasm.run / Error error / { retry = 3; error = "{ receipt_outcomes_len = 1; retry = 3; receipt_failures = [] }" } 00:00:09 i #20 near_workspaces.print_usd / { retry = 4; total_gas_burnt_usd = +0.000883; total_gas_burnt = 1322162469146 } 00:00:09 i #21 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:09 i #22 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000677; tokens_burnt_usd = +0.000677; gas_burnt = 1014080609806; tokens_burnt = 101408060980600000000 } 00:00:09 w #23 spiral_wasm.run / Error error / { retry = 4; error = "{ receipt_outcomes_len = 1; retry = 4; receipt_failures = [] }" } 00:00:12 i #26 near_workspaces.print_usd / { retry = 5; total_gas_burnt_usd = +0.000883; total_gas_burnt = 1322162469146 } 00:00:12 i #27 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:12 i #28 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000677; tokens_burnt_usd = +0.000677; gas_burnt = 1014080609806; tokens_burnt = 101408060980600000000 } 00:00:12 w #29 spiral_wasm.run / Error error / { retry = 5; error = "{ receipt_outcomes_len = 1; retry = 5; receipt_failures = [] }" } 00:00:14 i #32 near_workspaces.print_usd / { retry = 6; total_gas_burnt_usd = +0.000883; total_gas_burnt = 1322162469146 } 00:00:14 i #33 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:14 i #34 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000677; tokens_burnt_usd = +0.000677; gas_burnt = 1014080609806; tokens_burnt = 101408060980600000000 } 00:00:14 w #35 spiral_wasm.run / Error error / { retry = 6; error = "{ receipt_outcomes_len = 1; retry = 6; receipt_failures = [] }" } 00:00:17 i #38 near_workspaces.print_usd / { retry = 7; total_gas_burnt_usd = +0.000883; total_gas_burnt = 1322162469146 } 00:00:17 i #39 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:17 i #40 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000677; tokens_burnt_usd = +0.000677; gas_burnt = 1014080609806; tokens_burnt = 101408060980600000000 } 00:00:17 w #41 spiral_wasm.run / Error error / { retry = 7; error = "{ receipt_outcomes_len = 1; retry = 7; receipt_failures = [] }" } 00:00:19 i #44 near_workspaces.print_usd / { retry = 8; total_gas_burnt_usd = +0.000883; total_gas_burnt = 1322162469146 } 00:00:19 i #45 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:19 i #46 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000677; tokens_burnt_usd = +0.000677; gas_burnt = 1014080609806; tokens_burnt = 101408060980600000000 } 00:00:19 w #47 spiral_wasm.run / Error error / { retry = 8; error = "{ receipt_outcomes_len = 1; retry = 8; receipt_failures = [] }" } 00:00:21 i #50 near_workspaces.print_usd / { retry = 9; total_gas_burnt_usd = +0.000883; total_gas_burnt = 1322162469146 } 00:00:21 i #51 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:21 i #52 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000677; tokens_burnt_usd = +0.000677; gas_burnt = 1014080609806; tokens_burnt = 101408060980600000000 } 00:00:21 w #53 spiral_wasm.run / Error error / { retry = 9; error = "{ receipt_outcomes_len = 1; retry = 9; receipt_failures = [] }" } 00:00:23 i #56 near_workspaces.print_usd / { retry = 10; total_gas_burnt_usd = +0.000883; total_gas_burnt = 1322162469146 } 00:00:23 i #57 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:23 i #58 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000677; tokens_burnt_usd = +0.000677; gas_burnt = 1014080609806; tokens_burnt = 101408060980600000000 } 00:00:23 w #59 spiral_wasm.run / Error error / { retry = 10; error = "{ receipt_outcomes_len = 1; retry = 10; receipt_failures = [] }" } 00:00:26 i #62 near_workspaces.print_usd / { retry = 11; total_gas_burnt_usd = +0.000883; total_gas_burnt = 1322162469146 } 00:00:26 i #63 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:26 i #64 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000677; tokens_burnt_usd = +0.000677; gas_burnt = 1014080609806; tokens_burnt = 101408060980600000000 } 00:00:26 w #65 spiral_wasm.run / Error error / { retry = 11; error = "{ receipt_outcomes_len = 1; retry = 11; receipt_failures = [] }" } 00:00:28 i #68 near_workspaces.print_usd / { retry = 12; total_gas_burnt_usd = +0.000883; total_gas_burnt = 1322162469146 } 00:00:28 i #69 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:28 i #70 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000677; tokens_burnt_usd = +0.000677; gas_burnt = 1014080609806; tokens_burnt = 101408060980600000000 } 00:00:28 w #71 spiral_wasm.run / Error error / { retry = 12; error = "{ receipt_outcomes_len = 1; retry = 12; receipt_failures = [] }" } 00:00:30 i #74 near_workspaces.print_usd / { retry = 13; total_gas_burnt_usd = +0.000883; total_gas_burnt = 1322162469146 } 00:00:30 i #75 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:30 i #76 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000677; tokens_burnt_usd = +0.000677; gas_burnt = 1014080609806; tokens_burnt = 101408060980600000000 } 00:00:30 w #77 spiral_wasm.run / Error error / { retry = 13; error = "{ receipt_outcomes_len = 1; retry = 13; receipt_failures = [] }" } 00:00:32 i #80 near_workspaces.print_usd / { retry = 14; total_gas_burnt_usd = +0.000883; total_gas_burnt = 1322162469146 } 00:00:32 i #81 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:32 i #82 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000677; tokens_burnt_usd = +0.000677; gas_burnt = 1014080609806; tokens_burnt = 101408060980600000000 } 00:00:32 w #83 spiral_wasm.run / Error error / { retry = 14; error = "{ receipt_outcomes_len = 1; retry = 14; receipt_failures = [] }" } 00:00:34 i #86 near_workspaces.print_usd / { retry = 15; total_gas_burnt_usd = +0.001032; total_gas_burnt = 1545345031646 } 00:00:34 i #87 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:34 i #88 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000677; tokens_burnt_usd = +0.000677; gas_burnt = 1014080609806; tokens_burnt = 101408060980600000000 } 00:00:34 i #89 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000149; tokens_burnt_usd = +0.000000; gas_burnt = 223182562500; tokens_burnt = 0 }
new¶
In [ ]:
inl new () : state =
{
version = 2
seeds = "seeds" |> sm'.byte_slice |> near.new_vector
}
In [ ]:
//// test
///! rust -c
inl state = new ()
trace Verbose (fun () => "dice_contract") fun () => { state = state |> sm'.format_debug }
trace Verbose (fun () => "") id
00:00:00 v #1 dice_contract / { state = (2, Vector { len: 0, prefix: [115, 101, 101, 100, 115] }) } 00:00:02 i #2 near_workspaces.print_usd / { retry = 1; total_gas_burnt_usd = +0.001037; total_gas_burnt = 1551773423552 } 00:00:02 i #3 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:02 i #4 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000831; tokens_burnt_usd = +0.000831; gas_burnt = 1243691564212; tokens_burnt = 124369156421200000000 } 00:00:02 w #5 spiral_wasm.run / Error error / { retry = 1; error = "{ receipt_outcomes_len = 1; retry = 1; receipt_failures = [] }" } 00:00:00 v #1 dice_contract / { state = (2, Vector { len: 0, prefix: [115, 101, 101, 100, 115] }) } 00:00:04 i #8 near_workspaces.print_usd / { retry = 2; total_gas_burnt_usd = +0.001186; total_gas_burnt = 1774955986052 } 00:00:04 i #9 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:04 i #10 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000831; tokens_burnt_usd = +0.000831; gas_burnt = 1243691564212; tokens_burnt = 124369156421200000000 } 00:00:04 i #11 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000149; tokens_burnt_usd = +0.000000; gas_burnt = 223182562500; tokens_burnt = 0 }
max_seeds¶
In [ ]:
inl max_seeds () : unativeint =
100i32 |> convert
contribute_seed¶
In [ ]:
inl contribute_seed (seeds : rust.ref (rust.mut' (near.vector u8))) (seed : am'.vec u8) : () =
seeds |> near.vector_extend seed
inl seed_excess_len = (seeds |> rust.len |> fun x => x : u32 |> i32) - (max_seeds () |> i32)
if seed_excess_len > 0 then
inl seed_excess : am'.vec u8 =
!\\(seed_excess_len, $'"!seeds.drain(0..$0 as u32).collect::<Vec<_>>()"')
trace Debug
fun () => "dice_contract.contribute_seed"
fun () => { seed_excess_len seed_excess = seed_excess |> sm'.format_debug }
trace Debug (fun () => "") (join id)
In [ ]:
//// test
///! rust -c
inl replicate n =
let rec loop i acc =
if i > n
then acc
else
inl i' = i % 10
inl i' =
if i' = 0
then i % limit.max
else i'
loop (i + 1) (i' :: acc)
loop 1 []
|> listm.rev
|> listm'.box
|> listm'.to_array'
inl max_seeds : u32 = max_seeds () |> convert
inl seeds = "" |> sm'.byte_slice |> near.new_vector |> rust.to_ref_mut
conv max_seeds * 1.2f64
|> replicate
|> am'.map_base u8
|> am'.to_vec
|> contribute_seed seeds
seeds
|> rust.len
|> _assert_eq max_seeds
00:00:00 d #1 dice_contract.contribute_seed / { seed_excess_len = 20; seed_excess = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 20] } 00:00:02 i #2 near_workspaces.print_usd / { retry = 1; total_gas_burnt_usd = +0.007374; total_gas_burnt = 11039459964603 } 00:00:02 i #3 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:02 i #4 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.007169; tokens_burnt_usd = +0.007169; gas_burnt = 10731378105263; tokens_burnt = 1073137810526300000000 } 00:00:02 w #5 spiral_wasm.run / Error error / { retry = 1; error = "{ receipt_outcomes_len = 1; retry = 1; receipt_failures = [] }" } 00:00:00 d #1 dice_contract.contribute_seed / { seed_excess_len = 20; seed_excess = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 20] } 00:00:05 i #8 near_workspaces.print_usd / { retry = 2; total_gas_burnt_usd = +0.007374; total_gas_burnt = 11039459964603 } 00:00:05 i #9 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:05 i #10 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.007169; tokens_burnt_usd = +0.007169; gas_burnt = 10731378105263; tokens_burnt = 1073137810526300000000 } 00:00:05 w #11 spiral_wasm.run / Error error / { retry = 2; error = "{ receipt_outcomes_len = 1; retry = 2; receipt_failures = [] }" } 00:00:00 d #1 dice_contract.contribute_seed / { seed_excess_len = 20; seed_excess = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 20] } 00:00:07 i #14 near_workspaces.print_usd / { retry = 3; total_gas_burnt_usd = +0.007374; total_gas_burnt = 11039459964603 } 00:00:07 i #15 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:07 i #16 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.007169; tokens_burnt_usd = +0.007169; gas_burnt = 10731378105263; tokens_burnt = 1073137810526300000000 } 00:00:07 w #17 spiral_wasm.run / Error error / { retry = 3; error = "{ receipt_outcomes_len = 1; retry = 3; receipt_failures = [] }" } 00:00:00 d #1 dice_contract.contribute_seed / { seed_excess_len = 20; seed_excess = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 20] } 00:00:09 i #20 near_workspaces.print_usd / { retry = 4; total_gas_burnt_usd = +0.007374; total_gas_burnt = 11039459964603 } 00:00:09 i #21 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:09 i #22 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.007169; tokens_burnt_usd = +0.007169; gas_burnt = 10731378105263; tokens_burnt = 1073137810526300000000 } 00:00:09 w #23 spiral_wasm.run / Error error / { retry = 4; error = "{ receipt_outcomes_len = 1; retry = 4; receipt_failures = [] }" } 00:00:00 d #1 dice_contract.contribute_seed / { seed_excess_len = 20; seed_excess = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 20] } 00:00:12 i #26 near_workspaces.print_usd / { retry = 5; total_gas_burnt_usd = +0.007374; total_gas_burnt = 11039459964603 } 00:00:12 i #27 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:12 i #28 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.007169; tokens_burnt_usd = +0.007169; gas_burnt = 10731378105263; tokens_burnt = 1073137810526300000000 } 00:00:12 w #29 spiral_wasm.run / Error error / { retry = 5; error = "{ receipt_outcomes_len = 1; retry = 5; receipt_failures = [] }" } 00:00:00 d #1 dice_contract.contribute_seed / { seed_excess_len = 20; seed_excess = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 20] } 00:00:14 i #32 near_workspaces.print_usd / { retry = 6; total_gas_burnt_usd = +0.007374; total_gas_burnt = 11039459964603 } 00:00:14 i #33 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:14 i #34 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.007169; tokens_burnt_usd = +0.007169; gas_burnt = 10731378105263; tokens_burnt = 1073137810526300000000 } 00:00:14 w #35 spiral_wasm.run / Error error / { retry = 6; error = "{ receipt_outcomes_len = 1; retry = 6; receipt_failures = [] }" } 00:00:00 d #1 dice_contract.contribute_seed / { seed_excess_len = 20; seed_excess = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 20] } 00:00:17 i #38 near_workspaces.print_usd / { retry = 7; total_gas_burnt_usd = +0.007523; total_gas_burnt = 11262642527103 } 00:00:17 i #39 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:17 i #40 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.007169; tokens_burnt_usd = +0.007169; gas_burnt = 10731378105263; tokens_burnt = 1073137810526300000000 } 00:00:17 i #41 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000149; tokens_burnt_usd = +0.000000; gas_burnt = 223182562500; tokens_burnt = 0 }
generate_random_number¶
In [ ]:
inl generate_random_number
(seeds : rust.ref (rust.mut' (near.vector u8)))
(key : sm'.std_string)
(proof : sm'.std_string)
(max : u64)
: u64
=
inl seed = near.random_seed ()
inl epoch_height = near.epoch_height ()
inl block_height = near.block_height ()
inl block_timestamp = near.block_timestamp ()
inl account_balance = near.account_balance ()
inl signer_account_id = near.signer_account_id ()
inl predecessor_account_id = near.predecessor_account_id ()
inl entropy =
;[
seed
seeds |> rust.reref |> near.vector_to_vec
epoch_height |> am'.to_le_bytes |> am'.to_vec'
block_height |> am'.to_le_bytes |> am'.to_vec'
block_timestamp |> am'.to_le_bytes |> am'.to_vec'
account_balance |> near.as_yoctonear |> am'.to_le_bytes |> am'.to_vec'
signer_account_id |> am'.as_bytes |> am'.to_vec''
predecessor_account_id |> am'.as_bytes |> am'.to_vec''
proof |> sm'.into_bytes
key |> sm'.into_bytes
]
|> am'.to_vec
|> rust.concat
inl hash_u8 = entropy |> near.keccak512
hash_u8 |> contribute_seed seeds
inl rolls_list =
hash_u8
|> am'.from_vec_base
|> am'.to_list_base'
|> listm'.unbox
|> stream.from_list
|> lib.dice.rotate_numbers 6
|> stream.to_list
trace Debug
fun () => "dice_contract.generate_random_number"
fun () => {
max
key
proof
block_timestamp
block_height
epoch_height
account_balance = account_balance |> sm'.format_debug
signer_account_id = signer_account_id |> sm'.to_string
predecessor_account_id = predecessor_account_id |> sm'.to_string
seed = seed |> sm'.format_debug
seeds = seeds |> sm'.format_debug
entropy_len = entropy |> am'.vec_len
entropy = entropy |> sm'.format_debug
hash_u8 = hash_u8 |> sm'.format_debug
rolls = rolls_list |> listm'.box |> listm'.to_array' |> am'.to_vec |> sm'.format_debug
}
inl sequential_roll = rolls_list |> lib.dice.create_sequential_roller
inl result = lib.dice.roll_progressively sequential_roll true max
trace Debug (fun () => "") (join id)
result
In [ ]:
//// test
///! rust -cd near-token
2000
|> generate_random_number
("" |> sm'.byte_slice |> near.new_vector |> rust.to_ref_mut)
("" |> sm'.to_std_string)
("" |> sm'.to_std_string)
|> _assert_gt 0
00:00:00 d #2 dice_contract.generate_random_number / { max = 2000; key = ""; proof = ""; block_timestamp = 1728172157280929297; block_height = 8; epoch_height = 1; account_balance = NearToken { inner: 99817379736552383587979200 }; signer_account_id = "dev-20241005234915-25535220068725"; predecessor_account_id = "dev-20241005234915-25535220068725"; seed = [250, 81, 181, 253, 22, 249, 75, 209, 5, 81, 162, 108, 20, 183, 15, 232, 48, 249, 177, 134, 89, 22, 22, 192, 190, 160, 89, 191, 13, 188, 169, 231]; seeds = Vector { len: 64, prefix: [] }; entropy_len = 138; entropy = [250, 81, 181, 253, 22, 249, 75, 209, 5, 81, 162, 108, 20, 183, 15, 232, 48, 249, 177, 134, 89, 22, 22, 192, 190, 160, 89, 191, 13, 188, 169, 231, 1, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 17, 70, 115, 185, 107, 179, 251, 23, 192, 143, 230, 30, 215, 18, 132, 255, 38, 145, 82, 0, 0, 0, 0, 0, 100, 101, 118, 45, 50, 48, 50, 52, 49, 48, 48, 53, 50, 51, 52, 57, 49, 53, 45, 50, 53, 53, 51, 53, 50, 50, 48, 48, 54, 56, 55, 50, 53, 100, 101, 118, 45, 50, 48, 50, 52, 49, 48, 48, 53, 50, 51, 52, 57, 49, 53, 45, 50, 53, 53, 51, 53, 50, 50, 48, 48, 54, 56, 55, 50, 53]; hash_u8 = [158, 103, 198, 125, 5, 202, 46, 149, 16, 123, 154, 249, 80, 239, 64, 96, 179, 29, 61, 234, 221, 104, 40, 175, 219, 118, 49, 4, 105, 194, 33, 74, 241, 182, 249, 27, 135, 141, 34, 139, 102, 92, 33, 224, 63, 155, 155, 139, 169, 47, 5, 150, 188, 5, 88, 222, 248, 107, 33, 92, 194, 218, 32, 7]; rolls = [2, 1, 6, 5, 5, 4, 4, 5, 4, 3, 4, 3, 2, 5, 4, 6, 5, 5, 1, 6, 5, 2, 4, 1, 3, 4, 1, 4, 3, 2, 3, 2, 1, 2, 3, 3, 3, 3, 4, 1, 6, 2, 3, 2, 3, 5, 5, 1, 1, 5, 5, 6, 2, 5, 4, 6, 2, 5, 3, 2, 2, 2, 2, 1] } 00:00:00 d #3 dice.calculate_dice_count / { max = 2000; p = 7776; n = 5 } 00:00:00 d #4 dice.create_sequential_roller / roll / { current_index = 0; acc = 1; len = -1; last_item = None } 00:00:00 d #5 dice.create_sequential_roller / roll / { current_index = 1; acc = 1; len = -1; last_item = Some(2) } 00:00:00 d #6 dice.create_sequential_roller / roll / { current_index = 2; acc = 1; len = -1; last_item = Some(1) } 00:00:00 d #7 dice.create_sequential_roller / roll / { current_index = 3; acc = 1; len = -1; last_item = Some(6) } 00:00:00 d #8 dice.create_sequential_roller / roll / { current_index = 4; acc = 1; len = -1; last_item = Some(5) } 00:00:00 d #9 dice.accumulate_dice_rolls / { power = 4; acc = 0; roll = 5; value = 5184 } 00:00:00 d #10 dice.accumulate_dice_rolls / { power = 3; acc = 5184; roll = 5; value = 864 } 00:00:00 d #11 dice.accumulate_dice_rolls / { power = 2; acc = 6048; roll = 6; value = 180 } 00:00:00 d #12 dice.accumulate_dice_rolls / { power = 1; acc = 6228; roll = 1 } 00:00:00 d #13 dice.accumulate_dice_rolls / { power = 0; acc = 6228; roll = 2; value = 1 } 00:00:00 d #14 dice.accumulate_dice_rolls / { power = -1; acc = 6229; result = 6230 } 00:00:00 d #15 dice.create_sequential_roller / roll / { current_index = 5; acc = 1; len = -1; last_item = Some(5) } 00:00:00 d #16 dice.create_sequential_roller / roll / { current_index = 6; acc = 1; len = -1; last_item = Some(4) } 00:00:00 d #17 dice.create_sequential_roller / roll / { current_index = 7; acc = 1; len = -1; last_item = Some(4) } 00:00:00 d #18 dice.create_sequential_roller / roll / { current_index = 8; acc = 1; len = -1; last_item = Some(5) } 00:00:00 d #19 dice.create_sequential_roller / roll / { current_index = 9; acc = 1; len = -1; last_item = Some(4) } 00:00:00 d #20 dice.accumulate_dice_rolls / { power = 4; acc = 0; roll = 3; value = 2592 } 00:00:00 d #21 dice.accumulate_dice_rolls / { power = 3; acc = 2592; roll = 4; value = 648 } 00:00:00 d #22 dice.accumulate_dice_rolls / { power = 2; acc = 3240; roll = 4; value = 108 } 00:00:00 d #23 dice.accumulate_dice_rolls / { power = 1; acc = 3348; roll = 5; value = 24 } 00:00:00 d #24 dice.accumulate_dice_rolls / { power = 0; acc = 3372; roll = 4; value = 3 } 00:00:00 d #25 dice.accumulate_dice_rolls / { power = -1; acc = 3375; result = 3376 } 00:00:00 d #26 dice.create_sequential_roller / roll / { current_index = 10; acc = 1; len = -1; last_item = Some(3) } 00:00:00 d #27 dice.create_sequential_roller / roll / { current_index = 11; acc = 1; len = -1; last_item = Some(4) } 00:00:00 d #28 dice.create_sequential_roller / roll / { current_index = 12; acc = 1; len = -1; last_item = Some(3) } 00:00:00 d #29 dice.create_sequential_roller / roll / { current_index = 13; acc = 1; len = -1; last_item = Some(2) } 00:00:00 d #30 dice.create_sequential_roller / roll / { current_index = 14; acc = 1; len = -1; last_item = Some(5) } 00:00:00 d #31 dice.accumulate_dice_rolls / { power = 4; acc = 0; roll = 4; value = 3888 } 00:00:00 d #32 dice.accumulate_dice_rolls / { power = 3; acc = 3888; roll = 4; value = 648 } 00:00:00 d #33 dice.accumulate_dice_rolls / { power = 2; acc = 4536; roll = 3; value = 72 } 00:00:00 d #34 dice.accumulate_dice_rolls / { power = 1; acc = 4608; roll = 2; value = 6 } 00:00:00 d #35 dice.accumulate_dice_rolls / { power = 0; acc = 4614; roll = 5; value = 4 } 00:00:00 d #36 dice.accumulate_dice_rolls / { power = -1; acc = 4618; result = 4619 } 00:00:00 d #37 dice.create_sequential_roller / roll / { current_index = 15; acc = 1; len = -1; last_item = Some(4) } 00:00:00 d #38 dice.create_sequential_roller / roll / { current_index = 16; acc = 1; len = -1; last_item = Some(6) } 00:00:00 d #39 dice.create_sequential_roller / roll / { current_index = 17; acc = 1; len = -1; last_item = Some(5) } 00:00:00 d #40 dice.create_sequential_roller / roll / { current_index = 18; acc = 1; len = -1; last_item = Some(5) } 00:00:00 d #41 dice.create_sequential_roller / roll / { current_index = 19; acc = 1; len = -1; last_item = Some(1) } 00:00:00 d #42 dice.accumulate_dice_rolls / { power = 4; acc = 0; roll = 6; value = 6480 } 00:00:00 d #43 dice.accumulate_dice_rolls / { power = 3; acc = 6480; roll = 6; value = 1080 } 00:00:00 d #44 dice.accumulate_dice_rolls / { power = 2; acc = 7560; roll = 5; value = 144 } 00:00:00 d #45 dice.accumulate_dice_rolls / { power = 1; acc = 7704; roll = 5; value = 24 } 00:00:00 d #46 dice.accumulate_dice_rolls / { power = 0; acc = 7728; roll = 1 } 00:00:00 d #47 dice.accumulate_dice_rolls / { power = -1; acc = 7728; result = 7729 } 00:00:00 d #48 dice.create_sequential_roller / roll / { current_index = 20; acc = 1; len = -1; last_item = Some(6) } 00:00:00 d #49 dice.create_sequential_roller / roll / { current_index = 21; acc = 1; len = -1; last_item = Some(5) } 00:00:00 d #50 dice.create_sequential_roller / roll / { current_index = 22; acc = 1; len = -1; last_item = Some(2) } 00:00:00 d #51 dice.create_sequential_roller / roll / { current_index = 23; acc = 1; len = -1; last_item = Some(4) } 00:00:00 d #52 dice.create_sequential_roller / roll / { current_index = 24; acc = 1; len = -1; last_item = Some(1) } 00:00:00 d #53 dice.accumulate_dice_rolls / { power = 4; acc = 0; roll = 3; value = 2592 } 00:00:00 d #54 dice.accumulate_dice_rolls / { power = 3; acc = 2592; roll = 5; value = 864 } 00:00:00 d #55 dice.accumulate_dice_rolls / { power = 2; acc = 3456; roll = 2; value = 36 } 00:00:00 d #56 dice.accumulate_dice_rolls / { power = 1; acc = 3492; roll = 4; value = 18 } 00:00:00 d #57 dice.accumulate_dice_rolls / { power = 0; acc = 3510; roll = 1 } 00:00:00 d #58 dice.accumulate_dice_rolls / { power = -1; acc = 3510; result = 3511 } 00:00:00 d #59 dice.create_sequential_roller / roll / { current_index = 25; acc = 1; len = -1; last_item = Some(3) } 00:00:00 d #60 dice.create_sequential_roller / roll / { current_index = 26; acc = 1; len = -1; last_item = Some(4) } 00:00:00 d #61 dice.create_sequential_roller / roll / { current_index = 27; acc = 1; len = -1; last_item = Some(1) } 00:00:00 d #62 dice.create_sequential_roller / roll / { current_index = 28; acc = 1; len = -1; last_item = Some(4) } 00:00:00 d #63 dice.create_sequential_roller / roll / { current_index = 29; acc = 1; len = -1; last_item = Some(3) } 00:00:00 d #64 dice.accumulate_dice_rolls / { power = 4; acc = 0; roll = 2; value = 1296 } 00:00:00 d #65 dice.accumulate_dice_rolls / { power = 3; acc = 1296; roll = 4; value = 648 } 00:00:00 d #66 dice.accumulate_dice_rolls / { power = 2; acc = 1944; roll = 1 } 00:00:00 d #67 dice.accumulate_dice_rolls / { power = 1; acc = 1944; roll = 4; value = 18 } 00:00:00 d #68 dice.accumulate_dice_rolls / { power = 0; acc = 1962; roll = 3; value = 2 } 00:00:00 d #69 dice.accumulate_dice_rolls / { power = -1; acc = 1964; result = 1965 } 00:00:02 i #2 near_workspaces.print_usd / { retry = 1; total_gas_burnt_usd = +0.105376; total_gas_burnt = 157749065238578 } 00:00:02 i #3 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:02 i #4 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.105171; tokens_burnt_usd = +0.105171; gas_burnt = 157440983379238; tokens_burnt = 15744098337923800000000 } 00:00:02 w #5 spiral_wasm.run / Error error / { retry = 1; error = "{ receipt_outcomes_len = 1; retry = 1; receipt_failures = [] }" } 00:00:00 d #2 dice_contract.generate_random_number / { max = 2000; key = ""; proof = ""; block_timestamp = 1728172159794056782; block_height = 8; epoch_height = 1; account_balance = NearToken { inner: 99817379736552383587979200 }; signer_account_id = "dev-20241005234918-21370171190715"; predecessor_account_id = "dev-20241005234918-21370171190715"; seed = [207, 65, 181, 124, 176, 243, 213, 140, 43, 162, 21, 50, 76, 69, 189, 149, 131, 45, 45, 118, 1, 8, 42, 55, 250, 148, 183, 195, 250, 226, 177, 164]; seeds = Vector { len: 64, prefix: [] }; entropy_len = 138; entropy = [207, 65, 181, 124, 176, 243, 213, 140, 43, 162, 21, 50, 76, 69, 189, 149, 131, 45, 45, 118, 1, 8, 42, 55, 250, 148, 183, 195, 250, 226, 177, 164, 1, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 78, 142, 62, 79, 108, 179, 251, 23, 192, 143, 230, 30, 215, 18, 132, 255, 38, 145, 82, 0, 0, 0, 0, 0, 100, 101, 118, 45, 50, 48, 50, 52, 49, 48, 48, 53, 50, 51, 52, 57, 49, 56, 45, 50, 49, 51, 55, 48, 49, 55, 49, 49, 57, 48, 55, 49, 53, 100, 101, 118, 45, 50, 48, 50, 52, 49, 48, 48, 53, 50, 51, 52, 57, 49, 56, 45, 50, 49, 51, 55, 48, 49, 55, 49, 49, 57, 48, 55, 49, 53]; hash_u8 = [22, 113, 192, 151, 81, 79, 72, 106, 123, 96, 213, 226, 216, 156, 90, 33, 20, 21, 22, 192, 136, 87, 152, 72, 78, 239, 6, 172, 12, 39, 142, 205, 132, 79, 251, 28, 162, 25, 189, 21, 91, 240, 176, 26, 7, 83, 128, 164, 151, 20, 244, 48, 187, 184, 119, 111, 53, 4, 180, 77, 137, 249, 107, 122]; rolls = [4, 5, 6, 1, 3, 1, 6, 4, 3, 6, 3, 4, 6, 6, 6, 3, 2, 3, 4, 6, 4, 3, 2, 6, 6, 5, 6, 4, 6, 3, 4, 1, 6, 1, 5, 4, 6, 1, 3, 3, 1, 6, 2, 2, 1, 5, 2, 2, 1, 2, 4, 6, 1, 4, 5, 3, 5, 4, 6, 5, 5, 3, 5, 2] } 00:00:00 d #3 dice.calculate_dice_count / { max = 2000; p = 7776; n = 5 } 00:00:00 d #4 dice.create_sequential_roller / roll / { current_index = 0; acc = 1; len = -1; last_item = None } 00:00:00 d #5 dice.create_sequential_roller / roll / { current_index = 1; acc = 1; len = -1; last_item = Some(4) } 00:00:00 d #6 dice.create_sequential_roller / roll / { current_index = 2; acc = 1; len = -1; last_item = Some(5) } 00:00:00 d #7 dice.create_sequential_roller / roll / { current_index = 3; acc = 1; len = -1; last_item = Some(6) } 00:00:00 d #8 dice.create_sequential_roller / roll / { current_index = 4; acc = 1; len = -1; last_item = Some(1) } 00:00:00 d #9 dice.accumulate_dice_rolls / { power = 4; acc = 0; roll = 3; value = 2592 } 00:00:00 d #10 dice.accumulate_dice_rolls / { power = 3; acc = 2592; roll = 1 } 00:00:00 d #11 dice.accumulate_dice_rolls / { power = 2; acc = 2592; roll = 6; value = 180 } 00:00:00 d #12 dice.accumulate_dice_rolls / { power = 1; acc = 2772; roll = 5; value = 24 } 00:00:00 d #13 dice.accumulate_dice_rolls / { power = 0; acc = 2796; roll = 4; value = 3 } 00:00:00 d #14 dice.accumulate_dice_rolls / { power = -1; acc = 2799; result = 2800 } 00:00:00 d #15 dice.create_sequential_roller / roll / { current_index = 5; acc = 1; len = -1; last_item = Some(3) } 00:00:00 d #16 dice.create_sequential_roller / roll / { current_index = 6; acc = 1; len = -1; last_item = Some(1) } 00:00:00 d #17 dice.create_sequential_roller / roll / { current_index = 7; acc = 1; len = -1; last_item = Some(6) } 00:00:00 d #18 dice.create_sequential_roller / roll / { current_index = 8; acc = 1; len = -1; last_item = Some(4) } 00:00:00 d #19 dice.create_sequential_roller / roll / { current_index = 9; acc = 1; len = -1; last_item = Some(3) } 00:00:00 d #20 dice.accumulate_dice_rolls / { power = 4; acc = 0; roll = 6; value = 6480 } 00:00:00 d #21 dice.accumulate_dice_rolls / { power = 3; acc = 6480; roll = 1 } 00:00:00 d #22 dice.accumulate_dice_rolls / { power = 2; acc = 6480; roll = 6; value = 180 } 00:00:00 d #23 dice.accumulate_dice_rolls / { power = 1; acc = 6660; roll = 4; value = 18 } 00:00:00 d #24 dice.accumulate_dice_rolls / { power = 0; acc = 6678; roll = 3; value = 2 } 00:00:00 d #25 dice.accumulate_dice_rolls / { power = -1; acc = 6680; result = 6681 } 00:00:00 d #26 dice.create_sequential_roller / roll / { current_index = 10; acc = 1; len = -1; last_item = Some(6) } 00:00:00 d #27 dice.create_sequential_roller / roll / { current_index = 11; acc = 1; len = -1; last_item = Some(3) } 00:00:00 d #28 dice.create_sequential_roller / roll / { current_index = 12; acc = 1; len = -1; last_item = Some(4) } 00:00:00 d #29 dice.create_sequential_roller / roll / { current_index = 13; acc = 1; len = -1; last_item = Some(6) } 00:00:00 d #30 dice.create_sequential_roller / roll / { current_index = 14; acc = 1; len = -1; last_item = Some(6) } 00:00:00 d #31 dice.accumulate_dice_rolls / { power = 4; acc = 0; roll = 6; value = 6480 } 00:00:00 d #32 dice.accumulate_dice_rolls / { power = 3; acc = 6480; roll = 3; value = 432 } 00:00:00 d #33 dice.accumulate_dice_rolls / { power = 2; acc = 6912; roll = 4; value = 108 } 00:00:00 d #34 dice.accumulate_dice_rolls / { power = 1; acc = 7020; roll = 6; value = 30 } 00:00:00 d #35 dice.accumulate_dice_rolls / { power = 0; acc = 7050; roll = 6; value = 5 } 00:00:00 d #36 dice.accumulate_dice_rolls / { power = -1; acc = 7055; result = 7056 } 00:00:00 d #37 dice.create_sequential_roller / roll / { current_index = 15; acc = 1; len = -1; last_item = Some(6) } 00:00:00 d #38 dice.create_sequential_roller / roll / { current_index = 16; acc = 1; len = -1; last_item = Some(3) } 00:00:00 d #39 dice.create_sequential_roller / roll / { current_index = 17; acc = 1; len = -1; last_item = Some(2) } 00:00:00 d #40 dice.create_sequential_roller / roll / { current_index = 18; acc = 1; len = -1; last_item = Some(3) } 00:00:00 d #41 dice.create_sequential_roller / roll / { current_index = 19; acc = 1; len = -1; last_item = Some(4) } 00:00:00 d #42 dice.accumulate_dice_rolls / { power = 4; acc = 0; roll = 6; value = 6480 } 00:00:00 d #43 dice.accumulate_dice_rolls / { power = 3; acc = 6480; roll = 3; value = 432 } 00:00:00 d #44 dice.accumulate_dice_rolls / { power = 2; acc = 6912; roll = 2; value = 36 } 00:00:00 d #45 dice.accumulate_dice_rolls / { power = 1; acc = 6948; roll = 3; value = 12 } 00:00:00 d #46 dice.accumulate_dice_rolls / { power = 0; acc = 6960; roll = 4; value = 3 } 00:00:00 d #47 dice.accumulate_dice_rolls / { power = -1; acc = 6963; result = 6964 } 00:00:00 d #48 dice.create_sequential_roller / roll / { current_index = 20; acc = 1; len = -1; last_item = Some(6) } 00:00:00 d #49 dice.create_sequential_roller / roll / { current_index = 21; acc = 1; len = -1; last_item = Some(4) } 00:00:00 d #50 dice.create_sequential_roller / roll / { current_index = 22; acc = 1; len = -1; last_item = Some(3) } 00:00:00 d #51 dice.create_sequential_roller / roll / { current_index = 23; acc = 1; len = -1; last_item = Some(2) } 00:00:00 d #52 dice.create_sequential_roller / roll / { current_index = 24; acc = 1; len = -1; last_item = Some(6) } 00:00:00 d #53 dice.accumulate_dice_rolls / { power = 4; acc = 0; roll = 6; value = 6480 } 00:00:00 d #54 dice.accumulate_dice_rolls / { power = 3; acc = 6480; roll = 4; value = 648 } 00:00:00 d #55 dice.accumulate_dice_rolls / { power = 2; acc = 7128; roll = 3; value = 72 } 00:00:00 d #56 dice.accumulate_dice_rolls / { power = 1; acc = 7200; roll = 2; value = 6 } 00:00:00 d #57 dice.accumulate_dice_rolls / { power = 0; acc = 7206; roll = 6; value = 5 } 00:00:00 d #58 dice.accumulate_dice_rolls / { power = -1; acc = 7211; result = 7212 } 00:00:00 d #59 dice.create_sequential_roller / roll / { current_index = 25; acc = 1; len = -1; last_item = Some(6) } 00:00:00 d #60 dice.create_sequential_roller / roll / { current_index = 26; acc = 1; len = -1; last_item = Some(5) } 00:00:00 d #61 dice.create_sequential_roller / roll / { current_index = 27; acc = 1; len = -1; last_item = Some(6) } 00:00:00 d #62 dice.create_sequential_roller / roll / { current_index = 28; acc = 1; len = -1; last_item = Some(4) } 00:00:00 d #63 dice.create_sequential_roller / roll / { current_index = 29; acc = 1; len = -1; last_item = Some(6) } 00:00:00 d #64 dice.accumulate_dice_rolls / { power = 4; acc = 0; roll = 3; value = 2592 } 00:00:00 d #65 dice.accumulate_dice_rolls / { power = 3; acc = 2592; roll = 5; value = 864 } 00:00:00 d #66 dice.accumulate_dice_rolls / { power = 2; acc = 3456; roll = 6; value = 180 } 00:00:00 d #67 dice.accumulate_dice_rolls / { power = 1; acc = 3636; roll = 4; value = 18 } 00:00:00 d #68 dice.accumulate_dice_rolls / { power = 0; acc = 3654; roll = 6; value = 5 } 00:00:00 d #69 dice.accumulate_dice_rolls / { power = -1; acc = 3659; result = 3660 } 00:00:00 d #70 dice.create_sequential_roller / roll / { current_index = 30; acc = 1; len = -1; last_item = Some(3) } 00:00:00 d #71 dice.create_sequential_roller / roll / { current_index = 31; acc = 1; len = -1; last_item = Some(4) } 00:00:00 d #72 dice.create_sequential_roller / roll / { current_index = 32; acc = 1; len = -1; last_item = Some(1) } 00:00:00 d #73 dice.create_sequential_roller / roll / { current_index = 33; acc = 1; len = -1; last_item = Some(6) } 00:00:00 d #74 dice.create_sequential_roller / roll / { current_index = 34; acc = 1; len = -1; last_item = Some(1) } 00:00:00 d #75 dice.accumulate_dice_rolls / { power = 4; acc = 0; roll = 5; value = 5184 } 00:00:00 d #76 dice.accumulate_dice_rolls / { power = 3; acc = 5184; roll = 4; value = 648 } 00:00:00 d #77 dice.accumulate_dice_rolls / { power = 2; acc = 5832; roll = 1 } 00:00:00 d #78 dice.accumulate_dice_rolls / { power = 1; acc = 5832; roll = 6; value = 30 } 00:00:00 d #79 dice.accumulate_dice_rolls / { power = 0; acc = 5862; roll = 1 } 00:00:00 d #80 dice.accumulate_dice_rolls / { power = -1; acc = 5862; result = 5863 } 00:00:00 d #81 dice.create_sequential_roller / roll / { current_index = 35; acc = 1; len = -1; last_item = Some(5) } 00:00:00 d #82 dice.create_sequential_roller / roll / { current_index = 36; acc = 1; len = -1; last_item = Some(4) } 00:00:00 d #83 dice.create_sequential_roller / roll / { current_index = 37; acc = 1; len = -1; last_item = Some(6) } 00:00:00 d #84 dice.create_sequential_roller / roll / { current_index = 38; acc = 1; len = -1; last_item = Some(1) } 00:00:00 d #85 dice.create_sequential_roller / roll / { current_index = 39; acc = 1; len = -1; last_item = Some(3) } 00:00:00 d #86 dice.accumulate_dice_rolls / { power = 4; acc = 0; roll = 3; value = 2592 } 00:00:00 d #87 dice.accumulate_dice_rolls / { power = 3; acc = 2592; roll = 4; value = 648 } 00:00:00 d #88 dice.accumulate_dice_rolls / { power = 2; acc = 3240; roll = 6; value = 180 } 00:00:00 d #89 dice.accumulate_dice_rolls / { power = 1; acc = 3420; roll = 1 } 00:00:00 d #90 dice.accumulate_dice_rolls / { power = 0; acc = 3420; roll = 3; value = 2 } 00:00:00 d #91 dice.accumulate_dice_rolls / { power = -1; acc = 3422; result = 3423 } 00:00:00 d #92 dice.create_sequential_roller / roll / { current_index = 40; acc = 1; len = -1; last_item = Some(3) } 00:00:00 d #93 dice.create_sequential_roller / roll / { current_index = 41; acc = 1; len = -1; last_item = Some(1) } 00:00:00 d #94 dice.create_sequential_roller / roll / { current_index = 42; acc = 1; len = -1; last_item = Some(6) } 00:00:00 d #95 dice.create_sequential_roller / roll / { current_index = 43; acc = 1; len = -1; last_item = Some(2) } 00:00:00 d #96 dice.create_sequential_roller / roll / { current_index = 44; acc = 1; len = -1; last_item = Some(2) } 00:00:00 d #97 dice.accumulate_dice_rolls / { power = 4; acc = 0; roll = 1 } 00:00:00 d #98 dice.accumulate_dice_rolls / { power = 3; acc = 0; roll = 1 } 00:00:00 d #99 dice.accumulate_dice_rolls / { power = 2; acc = 0; roll = 6; value = 180 } 00:00:00 d #100 dice.accumulate_dice_rolls / { power = 1; acc = 180; roll = 2; value = 6 } 00:00:00 d #101 dice.accumulate_dice_rolls / { power = 0; acc = 186; roll = 2; value = 1 } 00:00:00 d #102 dice.accumulate_dice_rolls / { power = -1; acc = 187; result = 188 } 00:00:05 i #8 near_workspaces.print_usd / { retry = 2; total_gas_burnt_usd = +0.196870; total_gas_burnt = 294715044175559 } 00:00:05 i #9 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:05 i #10 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.196664; tokens_burnt_usd = +0.196664; gas_burnt = 294406962316219; tokens_burnt = 29440696231621900000000 } 00:00:05 w #11 spiral_wasm.run / Error error / { retry = 2; error = "{ receipt_outcomes_len = 1; retry = 2; receipt_failures = [] }" } 00:00:00 d #2 dice_contract.generate_random_number / { max = 2000; key = ""; proof = ""; block_timestamp = 1728172162323732268; block_height = 8; epoch_height = 1; account_balance = NearToken { inner: 99817379736552383587979200 }; signer_account_id = "dev-20241005234921-67734845539142"; predecessor_account_id = "dev-20241005234921-67734845539142"; seed = [123, 252, 221, 113, 30, 47, 87, 111, 88, 239, 241, 17, 26, 191, 92, 183, 192, 202, 170, 247, 3, 74, 91, 238, 240, 220, 8, 184, 34, 227, 114, 77]; seeds = Vector { len: 64, prefix: [] }; entropy_len = 138; entropy = [123, 252, 221, 113, 30, 47, 87, 111, 88, 239, 241, 17, 26, 191, 92, 183, 192, 202, 170, 247, 3, 74, 91, 238, 240, 220, 8, 184, 34, 227, 114, 77, 1, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 44, 87, 6, 230, 108, 179, 251, 23, 192, 143, 230, 30, 215, 18, 132, 255, 38, 145, 82, 0, 0, 0, 0, 0, 100, 101, 118, 45, 50, 48, 50, 52, 49, 48, 48, 53, 50, 51, 52, 57, 50, 49, 45, 54, 55, 55, 51, 52, 56, 52, 53, 53, 51, 57, 49, 52, 50, 100, 101, 118, 45, 50, 48, 50, 52, 49, 48, 48, 53, 50, 51, 52, 57, 50, 49, 45, 54, 55, 55, 51, 52, 56, 52, 53, 53, 51, 57, 49, 52, 50]; hash_u8 = [151, 240, 101, 97, 113, 239, 130, 180, 201, 175, 81, 30, 39, 53, 231, 224, 159, 157, 169, 29, 212, 14, 24, 167, 197, 94, 192, 166, 230, 204, 246, 217, 242, 230, 250, 204, 204, 144, 81, 63, 114, 234, 244, 226, 54, 248, 139, 132, 92, 195, 46, 32, 61, 221, 146, 146, 156, 207, 169, 206, 237, 174, 186, 170]; rolls = [1, 6, 5, 1, 5, 5, 4, 6, 3, 1, 3, 6, 3, 5, 3, 2, 3, 1, 1, 5, 2, 2, 6, 5, 5, 4, 6, 4, 2, 6, 6, 1, 2, 2, 4, 6, 6, 6, 3, 3, 6, 6, 4, 4, 6, 2, 1, 6, 2, 3, 4, 2, 1, 5, 2, 2, 6, 3, 1, 2, 3, 6, 6, 2] } 00:00:00 d #3 dice.calculate_dice_count / { max = 2000; p = 7776; n = 5 } 00:00:00 d #4 dice.create_sequential_roller / roll / { current_index = 0; acc = 1; len = -1; last_item = None } 00:00:00 d #5 dice.create_sequential_roller / roll / { current_index = 1; acc = 1; len = -1; last_item = Some(1) } 00:00:00 d #6 dice.create_sequential_roller / roll / { current_index = 2; acc = 1; len = -1; last_item = Some(6) } 00:00:00 d #7 dice.create_sequential_roller / roll / { current_index = 3; acc = 1; len = -1; last_item = Some(5) } 00:00:00 d #8 dice.create_sequential_roller / roll / { current_index = 4; acc = 1; len = -1; last_item = Some(1) } 00:00:00 d #9 dice.accumulate_dice_rolls / { power = 4; acc = 0; roll = 5; value = 5184 } 00:00:00 d #10 dice.accumulate_dice_rolls / { power = 3; acc = 5184; roll = 1 } 00:00:00 d #11 dice.accumulate_dice_rolls / { power = 2; acc = 5184; roll = 5; value = 144 } 00:00:00 d #12 dice.accumulate_dice_rolls / { power = 1; acc = 5328; roll = 6; value = 30 } 00:00:00 d #13 dice.accumulate_dice_rolls / { power = 0; acc = 5358; roll = 1 } 00:00:00 d #14 dice.accumulate_dice_rolls / { power = -1; acc = 5358; result = 5359 } 00:00:00 d #15 dice.create_sequential_roller / roll / { current_index = 5; acc = 1; len = -1; last_item = Some(5) } 00:00:00 d #16 dice.create_sequential_roller / roll / { current_index = 6; acc = 1; len = -1; last_item = Some(5) } 00:00:00 d #17 dice.create_sequential_roller / roll / { current_index = 7; acc = 1; len = -1; last_item = Some(4) } 00:00:00 d #18 dice.create_sequential_roller / roll / { current_index = 8; acc = 1; len = -1; last_item = Some(6) } 00:00:00 d #19 dice.create_sequential_roller / roll / { current_index = 9; acc = 1; len = -1; last_item = Some(3) } 00:00:00 d #20 dice.accumulate_dice_rolls / { power = 4; acc = 0; roll = 1 } 00:00:00 d #21 dice.accumulate_dice_rolls / { power = 3; acc = 0; roll = 5; value = 864 } 00:00:00 d #22 dice.accumulate_dice_rolls / { power = 2; acc = 864; roll = 4; value = 108 } 00:00:00 d #23 dice.accumulate_dice_rolls / { power = 1; acc = 972; roll = 6; value = 30 } 00:00:00 d #24 dice.accumulate_dice_rolls / { power = 0; acc = 1002; roll = 3; value = 2 } 00:00:00 d #25 dice.accumulate_dice_rolls / { power = -1; acc = 1004; result = 1005 } 00:00:07 i #14 near_workspaces.print_usd / { retry = 3; total_gas_burnt_usd = +0.027647; total_gas_burnt = 41388367766837 } 00:00:07 i #15 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:07 i #16 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.027442; tokens_burnt_usd = +0.027442; gas_burnt = 41080285907497; tokens_burnt = 4108028590749700000000 } 00:00:07 w #17 spiral_wasm.run / Error error / { retry = 3; error = "{ receipt_outcomes_len = 1; retry = 3; receipt_failures = [] }" } 00:00:00 d #2 dice_contract.generate_random_number / { max = 2000; key = ""; proof = ""; block_timestamp = 1728172164376712717; block_height = 6; epoch_height = 1; account_balance = NearToken { inner: 99817379736552383587979200 }; signer_account_id = "dev-20241005234923-19285854926747"; predecessor_account_id = "dev-20241005234923-19285854926747"; seed = [25, 169, 143, 48, 252, 224, 30, 68, 44, 51, 209, 37, 86, 189, 121, 58, 78, 202, 150, 1, 33, 166, 217, 168, 150, 176, 247, 0, 14, 216, 119, 156]; seeds = Vector { len: 64, prefix: [] }; entropy_len = 138; entropy = [25, 169, 143, 48, 252, 224, 30, 68, 44, 51, 209, 37, 86, 189, 121, 58, 78, 202, 150, 1, 33, 166, 217, 168, 150, 176, 247, 0, 14, 216, 119, 156, 1, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 13, 86, 100, 96, 109, 179, 251, 23, 192, 143, 230, 30, 215, 18, 132, 255, 38, 145, 82, 0, 0, 0, 0, 0, 100, 101, 118, 45, 50, 48, 50, 52, 49, 48, 48, 53, 50, 51, 52, 57, 50, 51, 45, 49, 57, 50, 56, 53, 56, 53, 52, 57, 50, 54, 55, 52, 55, 100, 101, 118, 45, 50, 48, 50, 52, 49, 48, 48, 53, 50, 51, 52, 57, 50, 51, 45, 49, 57, 50, 56, 53, 56, 53, 52, 57, 50, 54, 55, 52, 55]; hash_u8 = [231, 7, 57, 62, 219, 16, 214, 11, 27, 245, 203, 161, 231, 200, 174, 93, 169, 32, 175, 7, 132, 166, 58, 219, 195, 246, 254, 61, 125, 165, 255, 53, 34, 132, 56, 151, 153, 41, 98, 34, 181, 14, 37, 152, 9, 165, 87, 230, 65, 205, 109, 245, 114, 244, 154, 132, 139, 48, 157, 131, 135, 61, 208, 8]; rolls = [3, 1, 3, 2, 3, 4, 4, 5, 3, 5, 5, 5, 3, 2, 6, 3, 1, 2, 1, 1, 6, 4, 4, 3, 3, 6, 2, 1, 5, 3, 3, 5, 4, 6, 2, 1, 3, 5, 2, 4, 1, 2, 1, 2, 3, 3, 3, 2, 5, 1, 1, 5, 6, 4, 4, 6, 1, 6, 1, 5, 3, 1, 4, 2] } 00:00:00 d #3 dice.calculate_dice_count / { max = 2000; p = 7776; n = 5 } 00:00:00 d #4 dice.create_sequential_roller / roll / { current_index = 0; acc = 1; len = -1; last_item = None } 00:00:00 d #5 dice.create_sequential_roller / roll / { current_index = 1; acc = 1; len = -1; last_item = Some(3) } 00:00:00 d #6 dice.create_sequential_roller / roll / { current_index = 2; acc = 1; len = -1; last_item = Some(1) } 00:00:00 d #7 dice.create_sequential_roller / roll / { current_index = 3; acc = 1; len = -1; last_item = Some(3) } 00:00:00 d #8 dice.create_sequential_roller / roll / { current_index = 4; acc = 1; len = -1; last_item = Some(2) } 00:00:00 d #9 dice.accumulate_dice_rolls / { power = 4; acc = 0; roll = 3; value = 2592 } 00:00:00 d #10 dice.accumulate_dice_rolls / { power = 3; acc = 2592; roll = 2; value = 216 } 00:00:00 d #11 dice.accumulate_dice_rolls / { power = 2; acc = 2808; roll = 3; value = 72 } 00:00:00 d #12 dice.accumulate_dice_rolls / { power = 1; acc = 2880; roll = 1 } 00:00:00 d #13 dice.accumulate_dice_rolls / { power = 0; acc = 2880; roll = 3; value = 2 } 00:00:00 d #14 dice.accumulate_dice_rolls / { power = -1; acc = 2882; result = 2883 } 00:00:00 d #15 dice.create_sequential_roller / roll / { current_index = 5; acc = 1; len = -1; last_item = Some(3) } 00:00:00 d #16 dice.create_sequential_roller / roll / { current_index = 6; acc = 1; len = -1; last_item = Some(4) } 00:00:00 d #17 dice.create_sequential_roller / roll / { current_index = 7; acc = 1; len = -1; last_item = Some(4) } 00:00:00 d #18 dice.create_sequential_roller / roll / { current_index = 8; acc = 1; len = -1; last_item = Some(5) } 00:00:00 d #19 dice.create_sequential_roller / roll / { current_index = 9; acc = 1; len = -1; last_item = Some(3) } 00:00:00 d #20 dice.accumulate_dice_rolls / { power = 4; acc = 0; roll = 5; value = 5184 } 00:00:00 d #21 dice.accumulate_dice_rolls / { power = 3; acc = 5184; roll = 4; value = 648 } 00:00:00 d #22 dice.accumulate_dice_rolls / { power = 2; acc = 5832; roll = 4; value = 108 } 00:00:00 d #23 dice.accumulate_dice_rolls / { power = 1; acc = 5940; roll = 5; value = 24 } 00:00:00 d #24 dice.accumulate_dice_rolls / { power = 0; acc = 5964; roll = 3; value = 2 } 00:00:00 d #25 dice.accumulate_dice_rolls / { power = -1; acc = 5966; result = 5967 } 00:00:00 d #26 dice.create_sequential_roller / roll / { current_index = 10; acc = 1; len = -1; last_item = Some(5) } 00:00:00 d #27 dice.create_sequential_roller / roll / { current_index = 11; acc = 1; len = -1; last_item = Some(5) } 00:00:00 d #28 dice.create_sequential_roller / roll / { current_index = 12; acc = 1; len = -1; last_item = Some(5) } 00:00:00 d #29 dice.create_sequential_roller / roll / { current_index = 13; acc = 1; len = -1; last_item = Some(3) } 00:00:00 d #30 dice.create_sequential_roller / roll / { current_index = 14; acc = 1; len = -1; last_item = Some(2) } 00:00:00 d #31 dice.accumulate_dice_rolls / { power = 4; acc = 0; roll = 6; value = 6480 } 00:00:00 d #32 dice.accumulate_dice_rolls / { power = 3; acc = 6480; roll = 5; value = 864 } 00:00:00 d #33 dice.accumulate_dice_rolls / { power = 2; acc = 7344; roll = 5; value = 144 } 00:00:00 d #34 dice.accumulate_dice_rolls / { power = 1; acc = 7488; roll = 3; value = 12 } 00:00:00 d #35 dice.accumulate_dice_rolls / { power = 0; acc = 7500; roll = 2; value = 1 } 00:00:00 d #36 dice.accumulate_dice_rolls / { power = -1; acc = 7501; result = 7502 } 00:00:00 d #37 dice.create_sequential_roller / roll / { current_index = 15; acc = 1; len = -1; last_item = Some(6) } 00:00:00 d #38 dice.create_sequential_roller / roll / { current_index = 16; acc = 1; len = -1; last_item = Some(3) } 00:00:00 d #39 dice.create_sequential_roller / roll / { current_index = 17; acc = 1; len = -1; last_item = Some(1) } 00:00:00 d #40 dice.create_sequential_roller / roll / { current_index = 18; acc = 1; len = -1; last_item = Some(2) } 00:00:00 d #41 dice.create_sequential_roller / roll / { current_index = 19; acc = 1; len = -1; last_item = Some(1) } 00:00:00 d #42 dice.accumulate_dice_rolls / { power = 4; acc = 0; roll = 1 } 00:00:00 d #43 dice.accumulate_dice_rolls / { power = 3; acc = 0; roll = 3; value = 432 } 00:00:00 d #44 dice.accumulate_dice_rolls / { power = 2; acc = 432; roll = 1 } 00:00:00 d #45 dice.accumulate_dice_rolls / { power = 1; acc = 432; roll = 2; value = 6 } 00:00:00 d #46 dice.accumulate_dice_rolls / { power = 0; acc = 438; roll = 1 } 00:00:00 d #47 dice.accumulate_dice_rolls / { power = -1; acc = 438; result = 439 } 00:00:09 i #20 near_workspaces.print_usd / { retry = 4; total_gas_burnt_usd = +0.060086; total_gas_burnt = 89949486294680 } 00:00:09 i #21 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:09 i #22 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.059880; tokens_burnt_usd = +0.059880; gas_burnt = 89641404435340; tokens_burnt = 8964140443534000000000 } 00:00:09 w #23 spiral_wasm.run / Error error / { retry = 4; error = "{ receipt_outcomes_len = 1; retry = 4; receipt_failures = [] }" } 00:00:00 d #2 dice_contract.generate_random_number / { max = 2000; key = ""; proof = ""; block_timestamp = 1728172166422249346; block_height = 6; epoch_height = 1; account_balance = NearToken { inner: 99817379736552383587979200 }; signer_account_id = "dev-20241005234925-64375819838138"; predecessor_account_id = "dev-20241005234925-64375819838138"; seed = [142, 52, 178, 249, 140, 228, 164, 0, 249, 202, 137, 119, 153, 217, 154, 163, 5, 72, 78, 231, 12, 237, 120, 2, 29, 238, 11, 11, 208, 136, 90, 106]; seeds = Vector { len: 64, prefix: [] }; entropy_len = 138; entropy = [142, 52, 178, 249, 140, 228, 164, 0, 249, 202, 137, 119, 153, 217, 154, 163, 5, 72, 78, 231, 12, 237, 120, 2, 29, 238, 11, 11, 208, 136, 90, 106, 1, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 130, 191, 80, 218, 109, 179, 251, 23, 192, 143, 230, 30, 215, 18, 132, 255, 38, 145, 82, 0, 0, 0, 0, 0, 100, 101, 118, 45, 50, 48, 50, 52, 49, 48, 48, 53, 50, 51, 52, 57, 50, 53, 45, 54, 52, 51, 55, 53, 56, 49, 57, 56, 51, 56, 49, 51, 56, 100, 101, 118, 45, 50, 48, 50, 52, 49, 48, 48, 53, 50, 51, 52, 57, 50, 53, 45, 54, 52, 51, 55, 53, 56, 49, 57, 56, 51, 56, 49, 51, 56]; hash_u8 = [202, 86, 243, 174, 136, 251, 200, 205, 253, 247, 236, 99, 71, 154, 216, 46, 5, 122, 196, 110, 87, 8, 250, 50, 165, 236, 16, 85, 131, 238, 136, 41, 115, 198, 93, 72, 214, 129, 114, 182, 65, 101, 232, 0, 194, 216, 28, 253, 109, 180, 96, 27, 126, 192, 130, 166, 211, 80, 87, 197, 45, 42, 175, 199]; rolls = [4, 2, 3, 6, 4, 5, 2, 1, 1, 1, 2, 3, 5, 4, 6, 4, 5, 2, 4, 2, 3, 2, 4, 2, 3, 2, 4, 1, 5, 4, 4, 5, 1, 6, 3, 6, 4, 3, 6, 2, 5, 5, 4, 6, 2, 6, 4, 1, 1, 6, 6, 3, 6, 6, 4, 4, 1, 2, 3, 5, 3, 6, 1, 1] } 00:00:00 d #3 dice.calculate_dice_count / { max = 2000; p = 7776; n = 5 } 00:00:00 d #4 dice.create_sequential_roller / roll / { current_index = 0; acc = 1; len = -1; last_item = None } 00:00:00 d #5 dice.create_sequential_roller / roll / { current_index = 1; acc = 1; len = -1; last_item = Some(4) } 00:00:00 d #6 dice.create_sequential_roller / roll / { current_index = 2; acc = 1; len = -1; last_item = Some(2) } 00:00:00 d #7 dice.create_sequential_roller / roll / { current_index = 3; acc = 1; len = -1; last_item = Some(3) } 00:00:00 d #8 dice.create_sequential_roller / roll / { current_index = 4; acc = 1; len = -1; last_item = Some(6) } 00:00:00 d #9 dice.accumulate_dice_rolls / { power = 4; acc = 0; roll = 4; value = 3888 } 00:00:00 d #10 dice.accumulate_dice_rolls / { power = 3; acc = 3888; roll = 6; value = 1080 } 00:00:00 d #11 dice.accumulate_dice_rolls / { power = 2; acc = 4968; roll = 3; value = 72 } 00:00:00 d #12 dice.accumulate_dice_rolls / { power = 1; acc = 5040; roll = 2; value = 6 } 00:00:00 d #13 dice.accumulate_dice_rolls / { power = 0; acc = 5046; roll = 4; value = 3 } 00:00:00 d #14 dice.accumulate_dice_rolls / { power = -1; acc = 5049; result = 5050 } 00:00:00 d #15 dice.create_sequential_roller / roll / { current_index = 5; acc = 1; len = -1; last_item = Some(4) } 00:00:00 d #16 dice.create_sequential_roller / roll / { current_index = 6; acc = 1; len = -1; last_item = Some(5) } 00:00:00 d #17 dice.create_sequential_roller / roll / { current_index = 7; acc = 1; len = -1; last_item = Some(2) } 00:00:00 d #18 dice.create_sequential_roller / roll / { current_index = 8; acc = 1; len = -1; last_item = Some(1) } 00:00:00 d #19 dice.create_sequential_roller / roll / { current_index = 9; acc = 1; len = -1; last_item = Some(1) } 00:00:00 d #20 dice.accumulate_dice_rolls / { power = 4; acc = 0; roll = 1 } 00:00:00 d #21 dice.accumulate_dice_rolls / { power = 3; acc = 0; roll = 5; value = 864 } 00:00:00 d #22 dice.accumulate_dice_rolls / { power = 2; acc = 864; roll = 2; value = 36 } 00:00:00 d #23 dice.accumulate_dice_rolls / { power = 1; acc = 900; roll = 1 } 00:00:00 d #24 dice.accumulate_dice_rolls / { power = 0; acc = 900; roll = 1 } 00:00:00 d #25 dice.accumulate_dice_rolls / { power = -1; acc = 900; result = 901 } 00:00:11 i #26 near_workspaces.print_usd / { retry = 5; total_gas_burnt_usd = +0.027685; total_gas_burnt = 41444167524689 } 00:00:11 i #27 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:11 i #28 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.027479; tokens_burnt_usd = +0.027479; gas_burnt = 41136085665349; tokens_burnt = 4113608566534900000000 } 00:00:11 w #29 spiral_wasm.run / Error error / { retry = 5; error = "{ receipt_outcomes_len = 1; retry = 5; receipt_failures = [] }" } 00:00:00 d #2 dice_contract.generate_random_number / { max = 2000; key = ""; proof = ""; block_timestamp = 1728172168889447902; block_height = 8; epoch_height = 1; account_balance = NearToken { inner: 99817379736552383587979200 }; signer_account_id = "dev-20241005234927-82892779194578"; predecessor_account_id = "dev-20241005234927-82892779194578"; seed = [14, 177, 214, 231, 191, 229, 240, 155, 199, 240, 119, 205, 92, 209, 192, 34, 148, 186, 141, 125, 5, 23, 7, 142, 61, 12, 115, 107, 173, 244, 33, 47]; seeds = Vector { len: 64, prefix: [] }; entropy_len = 138; entropy = [14, 177, 214, 231, 191, 229, 240, 155, 199, 240, 119, 205, 92, 209, 192, 34, 148, 186, 141, 125, 5, 23, 7, 142, 61, 12, 115, 107, 173, 244, 33, 47, 1, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 222, 53, 95, 109, 110, 179, 251, 23, 192, 143, 230, 30, 215, 18, 132, 255, 38, 145, 82, 0, 0, 0, 0, 0, 100, 101, 118, 45, 50, 48, 50, 52, 49, 48, 48, 53, 50, 51, 52, 57, 50, 55, 45, 56, 50, 56, 57, 50, 55, 55, 57, 49, 57, 52, 53, 55, 56, 100, 101, 118, 45, 50, 48, 50, 52, 49, 48, 48, 53, 50, 51, 52, 57, 50, 55, 45, 56, 50, 56, 57, 50, 55, 55, 57, 49, 57, 52, 53, 55, 56]; hash_u8 = [185, 225, 221, 188, 218, 3, 93, 7, 32, 244, 143, 34, 4, 242, 22, 85, 40, 97, 75, 232, 21, 183, 33, 142, 112, 48, 57, 84, 3, 37, 212, 70, 22, 197, 151, 20, 209, 74, 65, 62, 95, 14, 30, 35, 124, 236, 39, 89, 153, 203, 226, 184, 24, 86, 15, 162, 87, 61, 187, 107, 29, 201, 191, 190]; rolls = [5, 3, 5, 2, 2, 3, 3, 1, 2, 4, 5, 4, 4, 2, 4, 1, 4, 1, 3, 4, 3, 3, 3, 4, 4, 6, 3, 6, 3, 1, 2, 4, 4, 5, 1, 2, 5, 2, 5, 2, 5, 2, 6, 5, 4, 2, 3, 5, 3, 5, 4, 4, 6, 2, 3, 6, 3, 1, 1, 5, 5, 3, 5, 4] } 00:00:00 d #3 dice.calculate_dice_count / { max = 2000; p = 7776; n = 5 } 00:00:00 d #4 dice.create_sequential_roller / roll / { current_index = 0; acc = 1; len = -1; last_item = None } 00:00:00 d #5 dice.create_sequential_roller / roll / { current_index = 1; acc = 1; len = -1; last_item = Some(5) } 00:00:00 d #6 dice.create_sequential_roller / roll / { current_index = 2; acc = 1; len = -1; last_item = Some(3) } 00:00:00 d #7 dice.create_sequential_roller / roll / { current_index = 3; acc = 1; len = -1; last_item = Some(5) } 00:00:00 d #8 dice.create_sequential_roller / roll / { current_index = 4; acc = 1; len = -1; last_item = Some(2) } 00:00:00 d #9 dice.accumulate_dice_rolls / { power = 4; acc = 0; roll = 2; value = 1296 } 00:00:00 d #10 dice.accumulate_dice_rolls / { power = 3; acc = 1296; roll = 2; value = 216 } 00:00:00 d #11 dice.accumulate_dice_rolls / { power = 2; acc = 1512; roll = 5; value = 144 } 00:00:00 d #12 dice.accumulate_dice_rolls / { power = 1; acc = 1656; roll = 3; value = 12 } 00:00:00 d #13 dice.accumulate_dice_rolls / { power = 0; acc = 1668; roll = 5; value = 4 } 00:00:00 d #14 dice.accumulate_dice_rolls / { power = -1; acc = 1672; result = 1673 } 00:00:14 i #32 near_workspaces.print_usd / { retry = 6; total_gas_burnt_usd = +0.016476; total_gas_burnt = 24664617164165 } 00:00:14 i #33 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:14 i #34 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.016121; tokens_burnt_usd = +0.016121; gas_burnt = 24133352742325; tokens_burnt = 2413335274232500000000 } 00:00:14 i #35 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000149; tokens_burnt_usd = +0.000000; gas_burnt = 223182562500; tokens_burnt = 0 }
roll_within_bounds¶
In [ ]:
inl roll_within_bounds (max : u64) (rolls : am'.vec u8) : optionm'.option' u64 =
inl result =
rolls
|> am'.from_vec_base
|> am'.to_list_base'
|> listm'.unbox
|> lib.dice.roll_within_bounds max
|> optionm'.box
trace Debug
fun () => "dice_contract.roll_within_bounds"
fun () => { max rolls = rolls |> sm'.format_debug; result = result |> sm'.format_debug }
trace Debug (fun () => "") (join id)
result
In [ ]:
//// test
///! rust -c
inl rolls = ;[ 1; 5; 4; 4; 5 ] |> am'.to_vec
rolls
|> roll_within_bounds 2000
|> _assert_eq' (optionm'.some' 995)
00:00:00 d #1 dice.accumulate_dice_rolls / { power = 4; acc = 0; roll = 1 } 00:00:00 d #2 dice.accumulate_dice_rolls / { power = 3; acc = 0; roll = 5; value = 864 } 00:00:00 d #3 dice.accumulate_dice_rolls / { power = 2; acc = 864; roll = 4; value = 108 } 00:00:00 d #4 dice.accumulate_dice_rolls / { power = 1; acc = 972; roll = 4; value = 18 } 00:00:00 d #5 dice.accumulate_dice_rolls / { power = 0; acc = 990; roll = 5; value = 4 } 00:00:00 d #6 dice.accumulate_dice_rolls / { power = -1; acc = 994; result = 995 } 00:00:00 d #7 dice_contract.roll_within_bounds / { max = 2000; rolls = [1, 5, 4, 4, 5]; result = Some(995) } 00:00:02 i #2 near_workspaces.print_usd / { retry = 1; total_gas_burnt_usd = +0.002666; total_gas_burnt = 3990565610697 } 00:00:02 i #3 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:02 i #4 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.002460; tokens_burnt_usd = +0.002460; gas_burnt = 3682483751357; tokens_burnt = 368248375135700000000 } 00:00:02 w #5 spiral_wasm.run / Error error / { retry = 1; error = "{ receipt_outcomes_len = 1; retry = 1; receipt_failures = [] }" } 00:00:00 d #1 dice.accumulate_dice_rolls / { power = 4; acc = 0; roll = 1 } 00:00:00 d #2 dice.accumulate_dice_rolls / { power = 3; acc = 0; roll = 5; value = 864 } 00:00:00 d #3 dice.accumulate_dice_rolls / { power = 2; acc = 864; roll = 4; value = 108 } 00:00:00 d #4 dice.accumulate_dice_rolls / { power = 1; acc = 972; roll = 4; value = 18 } 00:00:00 d #5 dice.accumulate_dice_rolls / { power = 0; acc = 990; roll = 5; value = 4 } 00:00:00 d #6 dice.accumulate_dice_rolls / { power = -1; acc = 994; result = 995 } 00:00:00 d #7 dice_contract.roll_within_bounds / { max = 2000; rolls = [1, 5, 4, 4, 5]; result = Some(995) } 00:00:04 i #8 near_workspaces.print_usd / { retry = 2; total_gas_burnt_usd = +0.002666; total_gas_burnt = 3990565610697 } 00:00:04 i #9 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:04 i #10 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.002460; tokens_burnt_usd = +0.002460; gas_burnt = 3682483751357; tokens_burnt = 368248375135700000000 } 00:00:04 w #11 spiral_wasm.run / Error error / { retry = 2; error = "{ receipt_outcomes_len = 1; retry = 2; receipt_failures = [] }" } 00:00:00 d #1 dice.accumulate_dice_rolls / { power = 4; acc = 0; roll = 1 } 00:00:00 d #2 dice.accumulate_dice_rolls / { power = 3; acc = 0; roll = 5; value = 864 } 00:00:00 d #3 dice.accumulate_dice_rolls / { power = 2; acc = 864; roll = 4; value = 108 } 00:00:00 d #4 dice.accumulate_dice_rolls / { power = 1; acc = 972; roll = 4; value = 18 } 00:00:00 d #5 dice.accumulate_dice_rolls / { power = 0; acc = 990; roll = 5; value = 4 } 00:00:00 d #6 dice.accumulate_dice_rolls / { power = -1; acc = 994; result = 995 } 00:00:00 d #7 dice_contract.roll_within_bounds / { max = 2000; rolls = [1, 5, 4, 4, 5]; result = Some(995) } 00:00:07 i #14 near_workspaces.print_usd / { retry = 3; total_gas_burnt_usd = +0.002815; total_gas_burnt = 4213748173197 } 00:00:07 i #15 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:07 i #16 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.002460; tokens_burnt_usd = +0.002460; gas_burnt = 3682483751357; tokens_burnt = 368248375135700000000 } 00:00:07 i #17 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000149; tokens_burnt_usd = +0.000000; gas_burnt = 223182562500; tokens_burnt = 0 }
In [ ]:
//// test
///! rust -c
inl rolls = ;[ 2; 2; 6; 4; 5 ] |> am'.to_vec
rolls
|> roll_within_bounds 2000
|> _assert_eq' (optionm'.some' 1715)
00:00:00 d #1 dice.accumulate_dice_rolls / { power = 4; acc = 0; roll = 2; value = 1296 } 00:00:00 d #2 dice.accumulate_dice_rolls / { power = 3; acc = 1296; roll = 2; value = 216 } 00:00:00 d #3 dice.accumulate_dice_rolls / { power = 2; acc = 1512; roll = 6; value = 180 } 00:00:00 d #4 dice.accumulate_dice_rolls / { power = 1; acc = 1692; roll = 4; value = 18 } 00:00:00 d #5 dice.accumulate_dice_rolls / { power = 0; acc = 1710; roll = 5; value = 4 } 00:00:00 d #6 dice.accumulate_dice_rolls / { power = -1; acc = 1714; result = 1715 } 00:00:00 d #7 dice_contract.roll_within_bounds / { max = 2000; rolls = [2, 2, 6, 4, 5]; result = Some(1715) } 00:00:02 i #2 near_workspaces.print_usd / { retry = 1; total_gas_burnt_usd = +0.002886; total_gas_burnt = 4320322486758 } 00:00:02 i #3 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:02 i #4 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.002531; tokens_burnt_usd = +0.002531; gas_burnt = 3789058064918; tokens_burnt = 378905806491800000000 } 00:00:02 i #5 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000149; tokens_burnt_usd = +0.000000; gas_burnt = 223182562500; tokens_burnt = 0 }
main¶
In [ ]:
///! _
inl main () =
!\($'"} //"') : ()
!\($'"#[derive( //"') : ()
!\($'" near_sdk::PanicOnDefault, //"') : ()
!\($'" borsh::BorshDeserialize, //"') : ()
!\($'" borsh::BorshSerialize, //"') : ()
!\($'")] //"') : ()
!\($'"pub struct OldState { //"') : ()
!\($'" version: u32, //"') : ()
!\($'" seeds: near_sdk::store::vec::Vector<u8>, //"') : ()
!\($'"} //"') : ()
!\($'"#[near_sdk::near_bindgen] //"') : ()
!\($'"#[derive( //"') : ()
!\($'" near_sdk::PanicOnDefault, //"') : ()
!\($'" borsh::BorshDeserialize, //"') : ()
!\($'" borsh::BorshSerialize, //"') : ()
!\($'")] //"') : ()
!\($'"pub struct State ( //"') : ()
!\($'"/*"') : ()
(null () : rust.type_emit state) |> ignore
!\($'"*/ )"') : ()
!\($'"impl From<OldState> for State { //"') : ()
!\($'" fn from(old_state: OldState) -> Self { //"') : ()
!\($'" Self((old_state.version + 1, old_state.seeds)) //"') : ()
!\($'" } //"') : ()
!\($'"} //"') : ()
inl new_ () =
!\($'"#[init] //"') : ()
!\($'"pub fn new() -> Self { // 1"') : ()
(!\($'"true; /*"') : bool) |> ignore
(null () : rust.type_emit ()) |> ignore
(!\($'"true; */"') : bool) |> ignore
inl result = new ()
$'let _result = !result in _result |> (fun x -> Fable.Core.RustInterop.emitRustExpr x $"Self($0) // x") // 2' : ()
!\($'"} // 2."') : ()
!\($'"} // 1."') : ()
2
inl contribute_seed () =
!\($'"pub fn contribute_seed(&mut self, seed: Vec<u8>) { //"') : ()
inl seeds : rust.ref (rust.mut' (near.vector u8)) = !\($'$"&mut self.0.1"')
inl seed : am'.vec u8 = !\($'$"seed"')
seed |> contribute_seed seeds
!\($'"} //"') : ()
!\($'"} //"') : ()
!\($'"} //"') : ()
3
inl contribute_seed_borsh () =
!\($'"pub fn contribute_seed_borsh(&mut self, #[serializer(borsh)] seed: Vec<u8>) { //"') : ()
!\($'" self.contribute_seed(seed) //"') : ()
!\($'"} //"') : ()
1
inl generate_random_number () =
!\($'"pub fn generate_random_number(&mut self, key: String, proof: String, max: u64) -> u64 { //"') : ()
inl key : sm'.std_string = !\($'$"key"')
inl proof : sm'.std_string = !\($'$"proof"')
inl max : u64 = !\($'$"max"')
inl seeds : rust.ref (rust.mut' (near.vector u8)) = !\($'$"&mut self.0.1"')
inl result = generate_random_number seeds key proof max
!\($'"!result //"') : ()
!\($'"} //"') : ()
!\($'"} //"') : ()
!\($'"} //"') : ()
3
inl roll_within_bounds () =
!\($'"pub fn roll_within_bounds(&self, max: u64, rolls: Vec<u8>) -> Option<u64> { //"') : ()
inl max : u64 = !\($'$"max"')
inl rolls : am'.vec u8 = !\($'$"rolls"')
inl result = roll_within_bounds max rolls
!\\(result, $'"$0 //"') : ()
!\($'"} //"') : ()
!\($'"} //"') : ()
2
inl roll_within_bounds_borsh () =
!\($'"#[result_serializer(borsh)] //"') : ()
!\($'"pub fn roll_within_bounds_borsh( //"') : ()
!\($'" &self, //"') : ()
!\($'" #[serializer(borsh)] max: u64, //"') : ()
!\($'" #[serializer(borsh)] rolls: Vec<u8>, //"') : ()
!\($'") -> Option<u64> { //"') : ()
!\($'" self.roll_within_bounds(max, rolls) //"') : ()
!\($'"} //"') : ()
1
inl fns =
[
new_
contribute_seed
contribute_seed_borsh
generate_random_number
roll_within_bounds
roll_within_bounds_borsh
]
inl rec loop acc fns i =
match fns with
| [] => acc
| x :: xs =>
!\($'"#[near_sdk::near_bindgen] //"') : ()
!\($'"impl State { //"') : ()
inl n = x ()
!\($'"} /* c"') : ()
inl rec loop' i' =
if i' <> 1 // <= n
then (!\($'"true; */ // ???? / i: !i / i\': !i' / acc: !acc / n: !n"') : bool) |> ignore
else
(!\($'"true; // ??? / i: !i / i\': !i' / acc: !acc / n: !n"') : bool) |> ignore
loop' (i' + 1)
loop' 1u8
loop (acc + n) xs (i + 1)
inl n = loop 0u8 fns 1u8
// !\($'"/* a"') : ()
// !\($'"} // b"') : ()
!\($'"fn _main() //"') : ()
!\($'" //"') : ()
inl rec loop' i' =
if i' <= n
then
(!\($'"true; { (); // ?? / i\': !i' / n: !n"') : bool) |> ignore
loop' (i' + 1)
else
(!\($'"true; { { (); // ? / i\': !i' / n: !n"') : bool) |> ignore
// (!\($'"true; */ // ?? / i\': !i' / n: !n"') : bool) |> ignore
loop' 1u8
inl main () =
$'!main |> ignore' : ()