Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom colored #168

Merged
merged 2 commits into from
May 16, 2024
Merged

Conversation

shadowv0vshadow
Copy link
Collaborator

Define a "z" op, for custom color outputs.

Payload like this:

    operation_found_at_inputs["payload"] = {
        "9527efa43262636d8f5917fc763fbdd09333e4b387afd6d4ed7a905a127b27b4i0": {
            "0": 200,
            "1": 300,
        },
        "8888e25790cc118773c8590522e1cab2ccc073a9375b238aaf9aadb13a764a13i0": {
            "2": 8000,
            "4": 8000,
        }
    }

We can set any int in every outputs. and custom colored ft.
Be careful, If your payload is flawed, it may lead to unnecessary burned.

if expected_value <= 0 or remaining_value <= 0:
continue
if expected_value > txout.value:
expected_value = txout.value
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This results in a burn correct?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the value to be colored in the payload exceeds the actual Satoshis contained, only the Satoshis actually contained in this UTXO will be colored, and the burn amount will also be calculated correctly.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

for atomical_id, atomical_info in sorted(ft_atomicals.items()):
remaining_value = atomical_info.total_atomical_value
for out_idx, txout in enumerate(tx.outputs):
expected_output_index = str(out_idx)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we check that isinstance(out_idx, int) is true first?

@shadowv0vshadow shadowv0vshadow marked this pull request as ready for review April 25, 2024 06:22
@shadowv0vshadow shadowv0vshadow requested a review from atomicals May 6, 2024 13:21
Copy link
Owner

@atomicals atomicals left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

if expected_value <= 0 or remaining_value <= 0:
continue
if expected_value > txout.value:
expected_value = txout.value
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@atomicals atomicals merged commit 55bbba5 into atomicals:develop May 16, 2024
1 check passed
# print(hash_to_hex_str(subject_atomical_id1))
operation_found_at_inputs = parse_protocols_operations_from_witness_array(tx, tx_hash, True)
# z means costom color

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo

@ChanHongMing
Copy link
Contributor

may I know what will happen if the user input float number in the payload's utxo?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants