Skip to content

Add QuGate smart contract#773

Open
fyllepo wants to merge 1 commit intoqubic:developfrom
fyllepo:feature/2026-02-20-QuGate
Open

Add QuGate smart contract#773
fyllepo wants to merge 1 commit intoqubic:developfrom
fyllepo:feature/2026-02-20-QuGate

Conversation

@fyllepo
Copy link

@fyllepo fyllepo commented Feb 20, 2026

Proposal

Interactive demo running against a live Qubic testnet node: https://qugate.fyll.co.uk/demos

Deflationary payment routing primitive with 5 gate modes:
SPLIT, ROUND_ROBIN, THRESHOLD, RANDOM, CONDITIONAL.

All fees burned via qpi.burn(). Permissionless, multi-tenant.
Local testnet verified on core-lite.
Copy link
Collaborator

@cyber-pc cyber-pc left a comment

Choose a reason for hiding this comment

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

Please also add an unit test for the end epoch to make sure it works as your expectation.

}
}

PUBLIC_PROCEDURE_WITH_LOCALS(closeGate)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add the braces in this function according to https://github.com/qubic/core/blob/main/doc/contributing.md#curly-braces-style for all belows

if (qpi.invocationReward() > 0)
    qpi.transfer(qpi.invocator(), qpi.invocationReward());

LOG_INFO(locals.logger);
}

PUBLIC_PROCEDURE_WITH_LOCALS(updateGate)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add the braces in this function according to https://github.com/qubic/core/blob/main/doc/contributing.md#curly-braces-style for all belows

if (qpi.invocationReward() > 0)
    qpi.transfer(qpi.invocator(), qpi.invocationReward());

PUBLIC_FUNCTION_WITH_LOCALS(getGatesByOwner)
{
output.count = 0;
for (locals.i = 0; locals.i < state._gateCount && output.count < 16; locals.i++)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please use a named constants instead of 16 here and getGatesByOwner_output's Array<uint64, 16> gateIds; to avoid forgetting to update the loop if the gateIds is expanded.

// Batch gate query — fetch up to 32 gates in one call
PUBLIC_FUNCTION_WITH_LOCALS(getGateBatch)
{
for (locals.i = 0; locals.i < 32; locals.i++)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please use a named constants instead of 32 here and getGateBatch_input's Array<uint64, 32> gateIds;

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.

2 participants