2 Commits

Author SHA1 Message Date
Ricardo Guilherme Schmidt
7d2e4a810d refactor: migrate KarmaTiers to contiguous array-based tier management (#228)
* refactor: migrate KarmaTiers to contiguous array-based tier management

- Replaced mapping-based tier storage with a contiguous Tier[] array
- Introduced batch update via updateTiers(), enforcing non-overlapping, gapless ranges
- Removed individual tier operations (add, update, deactivate, activate)
- Simplified tier resolution with linear lookup

test: rewrite test suite for new KarmaTiers structure

- Added tests for ownership, empty input, non-contiguous tiers, invalid names
- Validated proper behavior for unlimited tiers (maxKarma = type(uint256).max)
- Included edge case checks for getTierIdByKarmaBalance
- Added event verification for TiersUpdated

* ci: update python version to fix bug in certora

---------

Co-authored-by: r4bbit <445106+0x-r4bbit@users.noreply.github.com>
2025-07-28 10:39:49 -03:00
r4bbit
382b1c1643 feat: implement KarmaTiers
This commit introduces a new contract `KarmaTiers` that allows for
maintaing tiers for gasless transactions.

The owner of the contract can add tiers, update tiers and deactivate or
activate them.

Tier names can only be 32 bytes long and there's no overlap allowed
between min and max Karma bounds of the tiers.

Closes #216
2025-06-26 15:36:02 +02:00