Skip to content

Add:Pxiel Contract , tests and readme#6

Open
D45putspin wants to merge 5 commits intoHathorNetwork:masterfrom
D45putspin:add/pxiel_contract
Open

Add:Pxiel Contract , tests and readme#6
D45putspin wants to merge 5 commits intoHathorNetwork:masterfrom
D45putspin:add/pxiel_contract

Conversation

@D45putspin
Copy link

@D45putspin D45putspin commented Jan 21, 2026

Canvas Management
Customizable Grid: The canvas size and the per-pixel fee are defined at initialization.
Persistent State: Stores the color, owner, and timestamp of every painted pixel.
Batch Painting: Supports painting multiple pixels in a single transaction (up to 32) to optimize network fees and user experience.

Economy & Ownership
Fee Collection: Every "paint" action requires a deposit of HTR. These fees accumulate within the contract.
Admin Withdrawal: The blueprint owner (the address that initialized the contract) can withdraw the collected fees at any time.
Strict Validation: Includes checks for coordinate bounds, valid hex color formats (#RRGGBB), and sufficient fee deposits.

@D45putspin D45putspin closed this Jan 21, 2026
@D45putspin D45putspin deleted the add/pxiel_contract branch January 21, 2026 10:28
@glevco
Copy link
Contributor

glevco commented Jan 21, 2026

Can you please add a PR description with high-level functionality of the blueprint?

@github-project-automation github-project-automation bot moved this from Submitted to Review Done in Community Blueprints Jan 21, 2026
@public(allow_deposit=True)
def paint(self, ctx: Context, x: int, y: int, color: str) -> None:

action = ctx.get_single_action(HATHOR_TOKEN_UID)
Copy link
Contributor

Choose a reason for hiding this comment

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

Note: get_single_action gets a single action for the passed token, in this case HTR. This doesn't mean there aren't more actions for other tokens, which I think wasn't the intention here. Same for the other methods that use it.

Copy link
Contributor

@glevco glevco Jan 21, 2026

Choose a reason for hiding this comment

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

This is only informational. Changing it is not required for approval.

Copy link
Author

Choose a reason for hiding this comment

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

Sorry could you elaborate more on this? We only use Htr
We should Let owner set the token ? is that what you mean?

Copy link
Contributor

Choose a reason for hiding this comment

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

No, sorry for not being clear. What I meant is, the get_single_action method only checks that a single action exists for the token passed in its argument. So action = ctx.get_single_action(HATHOR_TOKEN_UID) asserts that there's only one action for HTR.

However, this doesn't mean there aren't other actions for other tokens in the transaction. For example, in you paint method, the user could deposit 1 HTR and 1 hUSDC, and it would success. The hUSDC balance would be added to the contract, but would be ignored by your code.

What you probably meant to do (I think), was to also assert that there's a single action across all tokens, and that it is HTR, so your code should be:

Suggested change
action = ctx.get_single_action(HATHOR_TOKEN_UID)
action = ctx.get_single_action(HATHOR_TOKEN_UID)
assert len(ctx.actions) == 1, 'expected only one token'

Let me know if you find this confusing, so we can take it into account in the documentation and future improvements to the API.

Copy link
Author

Choose a reason for hiding this comment

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

oh, ok i got it , yeah probably better to add it to avoid user misuse

Copy link
Contributor

Choose a reason for hiding this comment

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

You would also have to do it on the paint_batch and withdraw methods

@glevco glevco moved this from Review Done to In Review in Community Blueprints Jan 21, 2026
@D45putspin
Copy link
Author

Can you please add a PR description with high-level functionality of the blueprint?

done

glevco
glevco previously approved these changes Jan 22, 2026
Copy link
Contributor

@glevco glevco left a comment

Choose a reason for hiding this comment

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

LGTM

Co-authored-by: Gabriel Levcovitz <g.levcovitz@gmail.com>
@pedroferreira1 pedroferreira1 requested a review from glevco January 22, 2026 16:37
@github-project-automation github-project-automation bot moved this from In Review to Approved in Community Blueprints Jan 22, 2026
@glevco
Copy link
Contributor

glevco commented Feb 26, 2026

The blueprint Pxiel, contained in blueprints/pxiel/pxiel.py, is approved for release on the Hathor mainnet in accordance with the restricted blueprints policies.

This approval DOES NOT include any review of the blueprint's business logic, correctness, or security. Hathor does not perform such assessments. Full responsibility for the blueprint's behavior and any resulting consequences rests solely with its author.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Approved

Development

Successfully merging this pull request may close these issues.

3 participants