Pausing / Unpausing Token Operations

Pausing and unpausing token Operations

// 5. Pause token
    println!("\n5. Pause Token");
    println!("==============");

    let pause_payload = TokenPausePayload {
        recent_epoch: state.epoch,
        recent_checkpoint: state.checkpoint,
        chain_id,
        nonce: current_nonce,
        action: PauseAction::Pause,
        token: token_address,
    };
    current_nonce += 1; // Increment for next transaction

    match client.pause_token(pause_payload, private_key).await {
        Ok(response) => {
            println!("Token paused - Tx: {}", response.hash);
        }
        Err(e) => {
            print_detailed_error("Could not pause token", &e);
        }
    }
    sleep(Duration::from_secs(1)).await;

    // 6. Unpause token
    println!("\n6. Unpause Token");
    println!("================");

    let unpause_payload = TokenPausePayload {
        recent_epoch: state.epoch,
        recent_checkpoint: state.checkpoint,
        chain_id,
        nonce: current_nonce,
        action: PauseAction::Unpause,
        token: token_address,
    };
    current_nonce += 1; // Increment for next transaction

    match client.pause_token(unpause_payload, private_key).await {
        Ok(response) => {
            println!("Token unpaused - Tx: {}", response.hash);
        }
        Err(e) => {
            print_detailed_error("Could not unpause token", &e);
        }
    }

Last updated