Skip to content

refactor: modernize SDK and overhaul access, pause, and mint flow - #86

Merged
cak3ninja merged 46 commits into
mainfrom
dev
Jun 11, 2026
Merged

refactor: modernize SDK and overhaul access, pause, and mint flow#86
cak3ninja merged 46 commits into
mainfrom
dev

Conversation

@cak3ninja

Copy link
Copy Markdown
Collaborator

A modernization of the SWEAT token contract that overhauls its security model, removes legacy minting paths, and prepares the contract for an upgrade migration. End-user behavior is preserved; operational and governance behavior changes significantly.

New capabilities

  • Role-based access control. Privileged operations are now governed by named roles (Super Admin, Oracle, DenylistManager, PauseManager, UnpauseManager) managed through standard grant/revoke calls. Replaces the previous ad-hoc oracle list.
  • Account denylist. A new DenylistManager role can flag any account as restricted. Restricted accounts can no longer send, receive, or burn tokens, and cannot deregister from storage while restricted.
  • Group pause / unpause. Operations are split into two pause groups — minting (the oracle deferred-mint flow) and token (transfers and burns) — each independently pausable and unpausable by the corresponding role.
  • Mandatory holding account. The deferred-mint flow now requires a configured holding contract: user payouts are routed there for later claim, while the oracle fee goes to the calling oracle. The holding account is set at initialization and locked thereafter.
  • Upgrade migration. A first-class migration entry point lets the contract be upgraded in place from the previous deployed version, with the old wasm preserved for reference.

Removed / hardened behavior

  • Direct mint methods removed. Tokens can only enter circulation through the deferred-batch oracle flow; there is no longer an ad-hoc admin mint.
  • Legacy non-deferred recording removed. The older "record" path and its oracle-management methods are gone; oracles now operate exclusively through the deferred batch path and the ACL.
  • Failure rollback for step accounting. If a batch record fails on callback, the global step-since-TGE counter is reverted so that the issuance formula stays accurate.
  • Holding-account identity locked. The configured holding account cannot be changed after initialization, removing a class of misconfiguration risk.

Quality & operations

  • Modernized NEAR SDK. Contract is updated to the current NEAR SDK and a current Rust toolchain, with the contract-standards library vendored locally so future SDK bumps are reproducible.
  • Comprehensive integration test suite. New end-to-end test coverage for access control, pausing, denylist restrictions, migration, deferred minting, payout splits, and callback-attack resistance.
  • Refreshed documentation and tooling. README rewritten to describe the new mint/claim model, role management, deployment, and build workflow; build, lint, test, and coverage commands consolidated behind a single make interface.
  • Published contract artifacts. Built wasm and ABI for both the token and the holding-contract stub are now checked in as release artifacts, alongside the previous wasm for upgrade reference.

Net product impact

The token now has a clearly defined permission model, a single auditable path for issuance, an account-level compliance lever (denylist), independent kill-switches for minting vs. transfers, and a supported upgrade path — all without changing the end-user-facing token economics or the NEP-141/145/148 surface.

@cak3ninja
cak3ninja merged commit 02d12c5 into main Jun 11, 2026
8 checks passed
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.

1 participant