pub fn func_lock_bets(ctx: &ScFuncContext, f: &LockBetsContext) {

    // Get the bets array in state storage.
    let bets: ArrayOfMutableBet = f.state.bets();

    // Get the lockedBets array in state storage.
    let locked_bets: ArrayOfMutableBet = f.state.locked_bets();

    // Determine the amount of bets in the 'bets' array.
    let nr_bets: i32 = bets.length();

    // Copy all bet data from the 'bets' array to the 'lockedBets' array by
    // looping through all indexes of the array and copying the bets one by one.
    for i in 0..nr_bets {
        // Get the bet data stored at the next index in the 'bets' array.
        let bet: &Bet = &bets.get_bet(i).value();

        // Save the bet data at the next index in the 'lockedBets' array.
        locked_bets.get_bet(i).set_value(bet);
    }

    // Now that we have a copy of all bets it is safe to clear the 'bets' array
    // This will reset the length to zero, so that the next incoming bet will once
    // again trigger the delayed 'lockBets' request.
    bets.clear();

    // Next we trigger an immediate request to the 'payWinners' function
    ScFuncs::pay_winners(ctx).func.transfer_iotas(1).post();
}
// 'lockBets' is a function whose execution gets initiated by the 'placeBets' function as soon as
// the first bet comes in and will be triggered after a configurable number of seconds that defines
// the length of the playing round that started with that first bet. While this function is waiting
// to get triggered by the ISCP at the correct time any other incoming bets are added to the "bets"
// array in state storage. Once the 'lockBets' function gets triggered it will move all bets to a
// second state storage array called "lockedBets", after which it will request the 'payWinners'
// function to be run. Note that any bets coming in after that moment will start the cycle from
// scratch, with the first incoming bet triggering a new delayed execution of 'lockBets'.
'lockBets' is a function whose execution gets initiated by the 'placeBets' function as soon as
the first bet comes in and will be triggered after a configurable number of seconds that defines
the length of the playing round that started with that first bet. While this function is waiting
to get triggered by the ISCP at the correct time any other incoming bets are added to the "bets"
array in state storage. Once the 'lockBets' function gets triggered it will move all bets to a
second state storage array called "lockedBets", after which it will request the 'payWinners'
function to be run. Note that any bets coming in after that moment will start the cycle from
scratch, with the first incoming bet triggering a new delayed execution of 'lockBets'.
' lockBets ' is a function whose execution gets initiated by the ' placeBets ' function as soon as the first bet comes in and will be triggered after a configurable number of seconds that defines the length of the playing round that started with that first bet . While this function is waiting to get triggered by the ISCP at the correct time any other incoming bets are added to the " bets " array in state storage . Once the ' lockBets ' function gets triggered it will move all bets to a second state storage array called " lockedBets " after which it will request the ' payWinners ' function to be run . Note that any bets coming in after that moment will start the cycle from scratch with the first incoming bet triggering a new delayed execution of ' lockBets ' .
pub fn func_lock_bets(ctx: &ScFuncContext, f: &LockBetsContext) {
    // Get the bets array in state storage.
    let bets: ArrayOfMutableBet = f.state.bets();
    // Get the lockedBets array in state storage.
    let locked_bets: ArrayOfMutableBet = f.state.locked_bets();
    // Determine the amount of bets in the 'bets' array.
    let nr_bets: i32 = bets.length();
    // Copy all bet data from the 'bets' array to the 'lockedBets' array by
    // looping through all indexes of the array and copying the bets one by one.
    for i in 0..nr_bets {
        // Get the bet data stored at the next index in the 'bets' array.
        let bet: &Bet = &bets.get_bet(i).value();
        // Save the bet data at the next index in the 'lockedBets' array.
        locked_bets.get_bet(i).set_value(bet);
    }
    // Now that we have a copy of all bets it is safe to clear the 'bets' array
    // This will reset the length to zero, so that the next incoming bet will once
    // again trigger the delayed 'lockBets' request.
    bets.clear();
    // Next we trigger an immediate request to the 'payWinners' function
    ScFuncs::pay_winners(ctx).func.transfer_iotas(1).post();
}
pub fn func_lock_bets ( ctx : & ScFuncContext , f : & LockBetsContext ) { // Get the bets array in state storage. let bets : ArrayOfMutableBet = f . state . bets ( ) ; // Get the lockedBets array in state storage. let locked_bets : ArrayOfMutableBet = f . state . locked_bets ( ) ; // Determine the amount of bets in the 'bets' array. let nr_bets : i32 = bets . length ( ) ; // Copy all bet data from the 'bets' array to the 'lockedBets' array by // looping through all indexes of the array and copying the bets one by one. for i in 0 .. nr_bets { // Get the bet data stored at the next index in the 'bets' array. let bet : & Bet = & bets . get_bet ( i ) . value ( ) ; // Save the bet data at the next index in the 'lockedBets' array. locked_bets . get_bet ( i ) . set_value ( bet ) ; } // Now that we have a copy of all bets it is safe to clear the 'bets' array // This will reset the length to zero, so that the next incoming bet will once // again trigger the delayed 'lockBets' request. bets . clear ( ) ; // Next we trigger an immediate request to the 'payWinners' function ScFuncs :: pay_winners ( ctx ) . func . transfer_iotas ( 1 ) . post ( ) ; }
'lockBets' is a function whose execution gets initiated by the 'placeBets' function as soon as
the first bet comes in and will be triggered after a configurable number of seconds that defines
the length of the playing round that started with that first bet.
' lockBets ' is a function whose execution gets initiated by the ' placeBets ' function as soon as the first bet comes in and will be triggered after a configurable number of seconds that defines the length of the playing round that started with that first bet .
ctx
&ScFuncContext
f
&LockBetsContext
ctx
&ScFuncContext
f
&LockBetsContext