# Circuit used to mint arbitrary coins for given token attributes.
k = 11;
field = "pallas";

constant "TokenMint_V1" {
    EcFixedPointShort VALUE_COMMIT_VALUE,
    EcFixedPoint VALUE_COMMIT_RANDOM,
    EcFixedPointBase NULLIFIER_K,
}

witness "TokenMint_V1" {
    # CoinAttributes {
    Base coin_public_x,
    Base coin_public_y,
    Base coin_value,
    Base coin_spend_hook,
    Base coin_user_data,
    Base coin_blind,
    # }

    # TokenAttributes {
    Base token_auth_parent,
    Base token_user_data,
    Base token_blind,
    # }
}

circuit "TokenMint_V1" {
    # Derive the token ID
    token_id = poseidon_hash(token_auth_parent, token_user_data, token_blind);
    constrain_instance(token_auth_parent);

    # Then show the coin contains the token ID
    coin = poseidon_hash(
        coin_public_x,
        coin_public_y,
        coin_value,
        token_id,
        coin_spend_hook,
        coin_user_data,
        coin_blind,
    );
    constrain_instance(coin);
}
