Skip to content

Implement Fee Function in EntityRegistry Precompile #87

@arrivets

Description

@arrivets

Refer to arkiv fee spec: https://github.com/Arkiv-Network/arkiv-architecture/blob/main/arkiv/tokenomics/arkiv-fee-spec.md

Extend the EntityRegistry precompile (crates/arkiv-node/src/precompile.rs) so
that each of the six ops charges its fee per spec §1–§2 before mutating state.

Inside the precompile:

  • Read fee_multiplier, usd_per_glm, op_cost_*, storage_rate from the governance
    contract (Implement Governance SmartContract #86). Cache per-block.
  • For SET_ATTRIBUTE and EXTEND_LIFETIME, look up the entity's current state to
    source current_entity_size_KB and remaining_duration_days.
  • Evaluate the pure formula:
    fee_USD = op_base + storage_rate × size_KB × time_days
    fee_GLM = (fee_USD × fee_multiplier) / usd_per_glm
  • Charge the fee through the EVM gas mechanism so it flows into the standard
    OP Stack sequencer revenue path (spec §7).

Tests: all six §6 worked examples (A–F, plus C′ at fee_multiplier=10).

Depends on: #86 (contract ABI).

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions