Repository: unionlabs/union
File: voyager/plugins/sui-ibc-app/src/zkgm.rs (Rust)

Code before:
                .into(),
            ));
        }
        _ => panic!("tf?"),
    };

    let wrapped_token = predict_wrapped_denom(
        zkgm_packet.path.to_le_bytes().into(),
        packet.destination_channel_id,
        fao.base_token.to_vec(),
        metadata_image,
    );

    // A token might still be received with `INITIALIZE` although it's already registered. So, we do this
    // additional check and do an early return if we find a registered token.
    if let Some(wrapped_token_t) = get_registered_wrapped_token(module, &wrapped_token).await? {
        return Ok(Some(wrapped_token_t));
    }

    let Some(coin_metadata) = coin_metadata else {
        return Err(anyhow!(
            "the coin is going to be received for the first time, so the metadata must be provided"
        ));
    };
    let (treasury_ref, metadata_ref, coin_t) =
        publish_new_coin(module, pk, coin_metadata.decimals).await?;

    // let treasury_ref = module
    //     .sui_client
    //     .read_api()
    //     .get_object_with_options(
    //         ObjectID::from_str(
    //             "0x9053c2370c0c751cea3f937339c0ee429dadca72220b51186b6f23fab6d4b2eb",
    //         )
    //         .unwrap(),
    //         SuiObjectDataOptions::default().with_owner(),
    //     )
    //     .await
    //     .map_err(|e| ErrorObject::owned(-1, ErrorReporter(e).to_string(), None::<()>))?
    //     .data
    //     .expect("ibc store object exists on chain")
    //     .object_ref();

    // let metadata_ref = module
    //     .sui_client
    //     .read_api()
    //     .get_object_with_options(
    //         ObjectID::from_str(
    //             "0x3df31bdfc6452c2e72cfc0e3d9ac0dfd92ee375e4f294504e89e2c539847f9b4",
    //         )
    //         .unwrap(),

Review comment (bug):
note to the reviewer (ben): its nice to keep these as commented out, it's very helpful when debugging

Code after:
        }
        _ => panic!("tf?"),
    };

    let wrapped_token = predict_wrapped_denom(
        zkgm_packet.path.to_le_bytes().into(),
        packet.destination_channel_id,
        fao.base_token.to_vec(),
        metadata_image,
    );

    // A token might still be received with `INITIALIZE` although it's already registered. So, we do this
    // additional check and do an early return if we find a registered token.
    if let Some(wrapped_token_t) = get_registered_wrapped_token(module, &wrapped_token).await? {
        return Ok(Some(wrapped_token_t));
    }

    let Some(coin_metadata) = coin_metadata else {
        return Err(anyhow!(
            "the coin is going to be received for the first time, so the metadata must be provided"
        ));
    };
    let (treasury_ref, metadata_ref, coin_t) =
        publish_new_coin(module, pk, coin_metadata.decimals).await?;

    // let treasury_ref = module
    //     .sui_client
    //     .read_api()
    //     .get_object_with_options(
    //         ObjectID::from_str(
    //             "0x9053c2370c0c751cea3f937339c0ee429dadca72220b51186b6f23fab6d4b2eb",
    //         )
    //         .unwrap(),
    //         SuiObjectDataOptions::default().with_owner(),
    //     )
    //     .await
    //     .map_err(|e| ErrorObject::owned(-1, ErrorReporter(e).to_string(), None::<()>))?
    //     .data
    //     .expect("ibc store object exists on chain")
    //     .object_ref();

    // let metadata_ref = module
    //     .sui_client
    //     .read_api()
    //     .get_object_with_options(
    //         ObjectID::from_str(
    //             "0x3df31bdfc6452c2e72cfc0e3d9ac0dfd92ee375e4f294504e89e2c539847f9b4",
    //         )
    //         .unwrap(),
    //         SuiObjectDataOptions::default().with_owner(),
    //     )